jcombobox
tags question: http://stackoverflow.com/q/24043163
tags question: http://stackoverflow.com/q/24064824
tags question: http://stackoverflow.com/q/24029893
tags question: http://stackoverflow.com/q/24056118
tags question: http://stackoverflow.com/q/24018634
tags question: http://stackoverflow.com/q/24082600
tags question: http://stackoverflow.com/q/24087223
tags question: http://stackoverflow.com/q/24018880
tags question: http://stackoverflow.com/q/23986441
tags question: http://stackoverflow.com/q/24034926
tags question: http://stackoverflow.com/q/24081941
tags question: http://stackoverflow.com/q/24075267
type: Tag
tags question: http://stackoverflow.com/q/24072071
tag name: jcombobox
tags question: http://stackoverflow.com/q/23968290

http://stackoverflow.com/comment/37129449
type: Comment
comment on: http://stackoverflow.com/a/24076635
score: 0
type: AnswerComment
has text: @Splunk, Call this method with action of `saveCloseBtn` button.

http://stackoverflow.com/comment/37151563
comment on: http://stackoverflow.com/q/24087576
score: 0
type: Comment
has text: Thanks, but it didnt work.
type: QuestionComment

http://stackoverflow.com/comment/36911737
type: Comment
comment on: http://stackoverflow.com/q/23959357
has text: @DinoTw I've followed this pattern before. In fact I've followed this pattern for over a year without issue. I'm trying this in a new environment for a new job. One interesting fact is that I'm not using any dependency management because the place I work at is not using maven/ivy and I haven't been here long enough to try to convince them to use something. I basically took the jars downloaded by maven for my personal project (which uses spring mvc + spring data) and dumped it into here.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37083038
comment on: http://stackoverflow.com/a/24041969
type: AnswerComment
score: 0
type: Comment
has text: For Analytics 10g reports download I have used the method as in the following link http://stackoverflow.com/questions/23778094/how-to-download-all-the-urls-one-by-one-and-keep-in-different-folders/23782065#23782065 Please review this

http://stackoverflow.com/a/26623249
type: Answer
score: 0
has body: import javax.swing.*; import java.awt.*; /* @ Author 12CSE54 @ Date 29.10.14 */ public class calculator1 extends JFrame { public calculator1() { initComponents(); } int a,b,c; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { a=Integer.parseInt(jTextField1.getText()); b=Integer.parseInt(jTextField2.getText()); c=a+b; jTextField3.setText(String.valueOf(c)); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { a=Integer.parseInt(jTextField1.getText()); b=Integer.parseInt(jTextField2.getText()); c=a-b; jTextField3.setText(String.valueOf(c)); } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { a=Integer.parseInt(jTextField1.getText()); b=Integer.parseInt(jTextField2.getText()); c=a*b; jTextField3.setText(String.valueOf(c)); } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { a=Integer.parseInt(jTextField1.getText()); b=Integer.parseInt(jTextField2.getText()); c=a/b; jTextField3.setText(String.valueOf(c)); } private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setText(""); jTextField2.setText(""); jTextField3.setText(""); } public static void main(String ar[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new calculator1().setVisible(true); } }); }
answers question: http://stackoverflow.com/q/24084293

http://stackoverflow.com/comment/121828925
type: Comment
score: 1
type: AnswerComment
has text: There is not report folder!
comment on: http://stackoverflow.com/a/50239165

java
tags question: http://stackoverflow.com/q/24057901
tags question: http://stackoverflow.com/q/24066425
tags question: http://stackoverflow.com/q/24008589
tags question: http://stackoverflow.com/q/23979242
tags question: http://stackoverflow.com/q/23988021
tags question: http://stackoverflow.com/q/24032978
tags question: http://stackoverflow.com/q/23976481
tags question: http://stackoverflow.com/q/23946407
tags question: http://stackoverflow.com/q/23950134
tags question: http://stackoverflow.com/q/24102828
tags question: http://stackoverflow.com/q/24056303
tags question: http://stackoverflow.com/q/24033695
tags question: http://stackoverflow.com/q/24003490
tags question: http://stackoverflow.com/q/24079542
tags question: http://stackoverflow.com/q/23997106
tags question: http://stackoverflow.com/q/23954388
tags question: http://stackoverflow.com/q/23958414
tags question: http://stackoverflow.com/q/23989271
tags question: http://stackoverflow.com/q/24055944
tags question: http://stackoverflow.com/q/24065680
tags question: http://stackoverflow.com/q/24096331
tags question: http://stackoverflow.com/q/23961173
tags question: http://stackoverflow.com/q/24011485
tags question: http://stackoverflow.com/q/23996358
tags question: http://stackoverflow.com/q/23961605
tags question: http://stackoverflow.com/q/24081388
tags question: http://stackoverflow.com/q/24066935
tags question: http://stackoverflow.com/q/24100138
tags question: http://stackoverflow.com/q/23980983
tags question: http://stackoverflow.com/q/24088880
tags question: http://stackoverflow.com/q/23971514
tags question: http://stackoverflow.com/q/24026855
tags question: http://stackoverflow.com/q/24055468
tags question: http://stackoverflow.com/q/24000242
tags question: http://stackoverflow.com/q/24082487
tags question: http://stackoverflow.com/q/24025173
tags question: http://stackoverflow.com/q/24061422
tags question: http://stackoverflow.com/q/24096448
tags question: http://stackoverflow.com/q/24094196
tags question: http://stackoverflow.com/q/24027348
tags question: http://stackoverflow.com/q/24035214
tags question: http://stackoverflow.com/q/24063884
tags question: http://stackoverflow.com/q/23948610
tags question: http://stackoverflow.com/q/24062982
tags question: http://stackoverflow.com/q/24001269
tags question: http://stackoverflow.com/q/24003674
tags question: http://stackoverflow.com/q/24104545
tags question: http://stackoverflow.com/q/23977688
tags question: http://stackoverflow.com/q/24091372
tags question: http://stackoverflow.com/q/24020332
tags question: http://stackoverflow.com/q/24012325
tags question: http://stackoverflow.com/q/23996709
tags question: http://stackoverflow.com/q/24095322
tags question: http://stackoverflow.com/q/23942753
tags question: http://stackoverflow.com/q/24019845
tags question: http://stackoverflow.com/q/23995502
tags question: http://stackoverflow.com/q/24027249
tags question: http://stackoverflow.com/q/23998597
tags question: http://stackoverflow.com/q/24085207
tags question: http://stackoverflow.com/q/23961539
tags question: http://stackoverflow.com/q/23958548
tags question: http://stackoverflow.com/q/24048215
tags question: http://stackoverflow.com/q/24011759
tags question: http://stackoverflow.com/q/24086946
tags question: http://stackoverflow.com/q/24055105
tags question: http://stackoverflow.com/q/24079515
tags question: http://stackoverflow.com/q/23973131
tags question: http://stackoverflow.com/q/24091393
tags question: http://stackoverflow.com/q/23991694
tags question: http://stackoverflow.com/q/23966535
tags question: http://stackoverflow.com/q/24037822
tags question: http://stackoverflow.com/q/24055496
tags question: http://stackoverflow.com/q/24035898
tags question: http://stackoverflow.com/q/24096002
tags question: http://stackoverflow.com/q/24034636
tags question: http://stackoverflow.com/q/24013328
tags question: http://stackoverflow.com/q/24083620
tags question: http://stackoverflow.com/q/23948560
tags question: http://stackoverflow.com/q/24080680
tags question: http://stackoverflow.com/q/23944219

http://stackoverflow.com/comment/37209338
score: 0
comment on: http://stackoverflow.com/a/24118759
type: AnswerComment
type: Comment
has text: @CasperSky it's for server side validations , your rest api provider filter will check the user agent is valid or not !

runtime
tags question: http://stackoverflow.com/q/24061674
tags question: http://stackoverflow.com/q/24077524
type: Tag
tag name: runtime
tags question: http://stackoverflow.com/q/23945219
tags question: http://stackoverflow.com/q/24054125
tags question: http://stackoverflow.com/q/23983315

http://stackoverflow.com/comment/37123282
type: Comment
comment on: http://stackoverflow.com/a/24073265
score: 0
type: AnswerComment
has text: @JasonDelgado: yep Edwin Torres was right. You're shooting yourself in the foot.

http://stackoverflow.com/q/24089968
tagged with: asynchronous
has answer: http://stackoverflow.com/a/24090162
favorite count: 0
has body: I read from http://docs.oracle.com/javaee/7/tutorial/doc/servlets012.htm Java EE provides asynchronous processing support for servlets and filters. If a servlet or a filter reaches a potentially blocking operation when processing a request, it can assign the operation to an asynchronous execution context and return the thread associated with the request immediately to the container without generating a response. The blocking operation completes in the asynchronous execution context in a different thread, which can generate a response or dispatch the request to another servlet. I am wondering where is the different thread come from? Assuming the container has 10 threads, 5 of them are processing request, we have to use another 5 to process the long running business logic?. where do we get the performance improvement? the total threads available to use is limited, right? Thanks.
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: multithreading
has title: how asynchronous servlet processing improve performance
accepted answer: http://stackoverflow.com/a/24090162
upvote count: 1
type: Question
tagged with: servlets
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23943931
has comment: http://stackoverflow.com/comment/36883320
type: Answer
answers question: http://stackoverflow.com/q/23943868
has body: It's not clear what SDK you're working with which offers Area.intersect(). Depanding on what you intend to intersect your path with, however, it may be a complex problem - notice that a path2D intersected with a polygon may turn into several paths! However, there are some known algorithm for intersecting a path with a polygon, such as Cyrus-Beck or Sutherland-Cohen. I found this piece of code for Cohen-Sutherland in Java: http://worldofenggcodes.blogspot.co.il/2013/10/cohen-sutherland-line-clipping-algorithm.html Which seems OK, although you might need to extract the code into a more usable function. Cyrus-Beck would probably be a better option, though I could only find pseudo-code: http://www.moreprocess.com/computer-graphics/cyrus-beck-line-clipping-algorithm Once you've implemented either, you need to apply it to every line in your path, to get a new list of lines which intersect with the square.
score: 1
has comment: http://stackoverflow.com/comment/36902654
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/24073764
type: UnansweredQuestion
tagged with: docx4j
linked to: http://stackoverflow.com/q/7038740
tagged with: vml
type: Question
linked to: http://stackoverflow.com/q/11224850
has title: Parse VML Path attribute value using java libraries
tagged with: ms-word
has body: docx files using docx4j, I am able to parse ovals and rectangles from the CTRect and CTOval object from docx4j. But when I get to the custom shapes docx4j give me objects in CTShape or CTShapetype. I have already read the VML Specification link. The path value sometimes has the following values m1,1 l1,200,200,200,200,1 xe m100,1 l1,100,100,200,200,100 xe m,l,21600r21600,xe more combinations..., some using the adjusts values and some uses the formulas like path="wr@22,0@21@3,,0@21@4@.." I want to parse those values to get the points or coordinates in the path. I am having problem parsing them and also for the fact that I am new to VML and I havent grasped it all. Do you have some suggested source codes, libraries, or existing opensource projects that I can use as reference or use or any resource that will help retreive the path coordinates? FYI: I have tried looking up to LibreOffice source code but I didnt get much from the code, also I find it hard because it is on a different programming language.
score: 0
has comment: http://stackoverflow.com/comment/37199385
has answer: http://stackoverflow.com/a/24275403
answer count: 1
has comment: http://stackoverflow.com/comment/37165817
tagged with: java

http://stackoverflow.com/q/24097409
has answer: http://stackoverflow.com/a/24097734
type: AnsweredQuestion
tagged with: layout
type: Question
tagged with: android
has body: Now I've searched a lot but nothing really is coming up that really answers my question. How can I make my view half the size? Like for example, the android keyboard, the view only covers half the screen, how can I make my app do that? Instead of being full screen make it half in height view.
accepted answer: http://stackoverflow.com/a/24097734
score: 0
has comment: http://stackoverflow.com/comment/37168531
answer count: 1
tagged with: java
tagged with: eclipse
has title: How can I make my view height half the size?
tagged with: class

http://stackoverflow.com/a/23947242
answers question: http://stackoverflow.com/q/23941763
has comment: http://stackoverflow.com/comment/36888880
has body: There is now default mechanism to wait for alert to appear/disappear but, we can write our own logic something like below instead of waiting for static amount of time (Thread.sleep(10000)). waitForAlert(WebDriver driver) { int i=0; while(i++&lt;5) { try { Alert alert = driver.switchTo().alert(); alert.accept(); break; } catch(NoAlertPresentException e) { Thread.sleep(1000); continue; } } }
score: 0
has comment: http://stackoverflow.com/comment/36892597
has comment: http://stackoverflow.com/comment/36889283
has comment: http://stackoverflow.com/comment/36907086
has comment: http://stackoverflow.com/comment/36926995
type: Answer

http://stackoverflow.com/comment/37011794
has text: and how to onvert the text in the text field into number?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24013358
score: 0

http://stackoverflow.com/comment/37257166
comment on: http://stackoverflow.com/a/24090567
type: Comment
has text: I would agree with Gabriele seeing as he is the creator! This library has dependencies that are required to be build with gradle/maven
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36958239
type: AnswerComment
comment on: http://stackoverflow.com/a/23984714
type: Comment
has text: please check the code. I have tested with the suggested code also. Does not work!
score: 0

http://stackoverflow.com/a/24007501
type: Answer
has comment: http://stackoverflow.com/comment/37025455
score: 1
has comment: http://stackoverflow.com/comment/37041381
upvote count: 1
has body: The JodaTime-Hibernate library is deprecated, and is probably the source of your problem. Don't dispair however as there is a (better) alternative. You will need to use the JadiraTypes library to create the correct JodaTime objects from Hibernate. Add the library which can be found here to your project classpath and then change your type to org.jadira.usertype.dateandtime.joda.PersistantDateTime. All of the JodaTime objects have a corresponding mapping in that package, so if you decide to change to another object then just update your type. This should ensure that your objects get created correctly. I should add a caveat to my answer, which is that I have never used the JadiraTypes library with Hibernate 3. If it only supports Hibernate 4 (I don't see why it would, but...) let me know and I'll delete my answer.
has comment: http://stackoverflow.com/comment/37066454
downvote count: 0
answers question: http://stackoverflow.com/q/24000461
has comment: http://stackoverflow.com/comment/37066539

http://stackoverflow.com/a/24036559
has comment: http://stackoverflow.com/comment/37063208
has comment: http://stackoverflow.com/comment/37098885
downvote count: 0
has comment: http://stackoverflow.com/comment/37056741
has comment: http://stackoverflow.com/comment/37118804
type: Answer
has body: the way i did this was by writing a plugin that shows a custom dialog without border, background shadow, etc. my execute() method looks like this: @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (resources == null) resources = cordova.getActivity().getApplication().getResources(); if (package_name == null) package_name = cordova.getActivity().getApplication().getPackageName(); if (inflator == null) { inflator = cordova.getActivity().getLayoutInflater(); } if (action.equals("show")) { this.show(args, callbackContext); return true; } return false; // Returning false results in a "MethodNotFound" error. } and the show() method contains something like this: [...] Runnable runnable = new Runnable() { public void run() { pinpad = new Dialog(cordova.getActivity()); pinpad.requestWindowFeature(Window.FEATURE_NO_TITLE); Window window = pinpad.getWindow(); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); WindowManager.LayoutParams wlp = window.getAttributes(); wlp.gravity = Gravity.BOTTOM; window.setAttributes(wlp); pinpad.setCancelable(false); pinpad.setContentView(view); pinpad.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, (int) height); pinpad.show(); } }; this.cordova.getActivity().runOnUiThread(runnable); [...] if your window (the red part) has to be placed in some particular position (not in the center or at the bottom of the screen) then you have to pass coordinates from javascript to native plugin.
upvote count: 7
has comment: http://stackoverflow.com/comment/37376116
answers question: http://stackoverflow.com/q/24035756
score: 7

http://stackoverflow.com/q/24093414
tagged with: android
tagged with: datetime
answer count: 1
has comment: http://stackoverflow.com/comment/37161201
favorite count: 0
linked to: http://stackoverflow.com/q/23968830
type: UnansweredQuestion
tagged with: timezone
has comment: http://stackoverflow.com/comment/37161258
has comment: http://stackoverflow.com/comment/37161318
linked to: http://stackoverflow.com/q/24044810
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/9429357
has body: I am trying to do it this way 1. Get my time current time and time zone. 2. I know time zone of that specific country from Google. 3. Calculate difference in time zones. 4. Subtract this difference from current time. This will give me time in other country. I am stuck at step 3 and 4. I get current time like this Date d = new Date(); CharSequence s = DateFormat.format("hh:mm:ss", d.getTime()); and time zone like this Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.getDefault()); Date currentLocalTime = calendar.getTime(); SimpleDateFormat date = new SimpleDateFormat("Z"); String localTime = date.format(currentLocalTime); let time zone of specific country be represented by string x.Now how do i get localTime - x and then currentTime - (localTime - x).
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24093507
has comment: http://stackoverflow.com/comment/37161363
has title: How can i know time in a specific country if i am in a differenet country?
downvote count: 0
linked to: http://stackoverflow.com/q/9108356
linked to: http://stackoverflow.com/q/8238661

http://stackoverflow.com/a/23977252
score: 0
answers question: http://stackoverflow.com/q/23977013
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23977013
type: Answer
has body: I made changes in the application and it worked but only for the user who created application not for other user

http://stackoverflow.com/q/24063808
has comment: http://stackoverflow.com/comment/37136140
upvote count: 1
tagged with: jsp
has title: Why Struts.xml is not working after giving namespace?
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17096637
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37106631
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/37116069
score: 1
tagged with: java
type: Question
has body: Hi I am trying to map a action in struts.xml file but it is not working properly. I am using struts2 framework of my projects.- my code is being displayed below- <?xml version="1.0" encoding="UTF-8" ?> logic/logsuccess.jsp and my web.xml is being displayed in below- <?xml version="1.0" encoding="UTF-8"?> ORDERGUIDE index.jsp struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* When i trying to login from index.jsp page with action="guideLogin"of form then it is refering in - http://localhost:8080/index.jsp URL. Please give me suggestions to solve this issue...`
has comment: http://stackoverflow.com/comment/37106524
tagged with: struts2

http://stackoverflow.com/q/23998472
favorite count: 0
tagged with: worklight-adapters
has comment: http://stackoverflow.com/comment/37237615
has title: worklight multi thread/servletcontext calling adapter
tagged with: ibm-mobilefirst
type: UnansweredQuestion
tagged with: multithreading
score: 1
tagged with: java
type: Question
has body: I've been having some problems with worklight and multi threading. We have a batch importer that needs to run once everyday. What we have done so far Importer is a servletContextListener Use Quartz to run importer as a cronjob Everything in the code works fine except for calling the HTTP Adapters. Everytime a adapter is called a error message "BaseProjectLocal is null" is retured. The code does work fine if it is started by another worklight adapter. It seems the error is there because he does not know how to access the adapters (i assume) java.lang.RuntimeException: BaseProjectLocal is null at com.worklight.common.util.BaseProjectLocal.get(BaseProjectLocal.java:41) at com.worklight.server.util.ProjectLocal.get(ProjectLocal.java:55) at com.worklight.server.util.ProjectLocal.getWorklightBundlesS(ProjectLocal.java:113) at com.worklight.server.bundle.api.WorklightBundles.getInstance(WorklightBundles.java:28) at com.ibm.nl.wwdw.server.util.AdapterCaller.doCall(AdapterCaller.java:25) at com.ibm.nl.wwdw.server.connections.CommunityCollector.getMembersFromCommunity(CommunityCollector.java:50) at com.ibm.nl.wwdw.server.importer.ConnectionsImporter.StartImport(ConnectionsImporter.java:53) at com.ibm.nl.wwdw.server.importer.MyJob.execute(MyJob.java:17) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) 2-jun-2014 17:38:56 com.ibm.nl.wwdw.server.importer.ConnectionsImporter StartImport SEVERE: BaseProjectLocal is null Java code calling the adapter public static JSONObject doCall(String adapter, String path, String paramArray) { Logging.logger.warning(adapter+"/"+path+"?"+paramArray); DataAccessService service = WorklightBundles.getInstance().getDataAccessService();//This line gives the error report ProcedureQName procedureQName = new ProcedureQName(adapter, path); InvocationResult result = service.invokeProcedure(procedureQName, paramArray); Logging.logger.warning(result.toJSON().toString())…
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/29060660
upvote count: 1

http://stackoverflow.com/comment/36963666
type: QuestionComment
has text: If I call multiple functions in same program one after another,last function's result is displayed in program.For e.g,In main,I called,obj.add(a,b);obj.add(a,b,c) then result of obj.add(a,b,c) is only shown.First result is vanished.
score: 0
comment on: http://stackoverflow.com/q/23987613
type: Comment

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

http://stackoverflow.com/comment/37232455
comment on: http://stackoverflow.com/a/24091162
has text: You have both a hex and a character dump listed above. The left hand side is the hex bytes, 16 bytes per line, 2 lines (32 == size of acct token), and the bit between the |..| part is the ascii/ebcdic equivalent of the hex chars - usually converted based on the codepage of the message or something like that. You can see from the hex, that the data is in ebcdic not in ascii, so the originator of the accounting token is usually either mainframe or IBM i (iSeries / OS400).
type: AnswerComment
type: Comment
score: 1

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/24082147
tags question: http://stackoverflow.com/q/23978655
tag name: jfreechart

http://stackoverflow.com/a/26701530
type: Answer
accepted answer of: http://stackoverflow.com/q/23963297
answers question: http://stackoverflow.com/q/23963297
score: 1
has body: To obtain the ExampleSet of the process you need add IOContainer ioResult = process.run(); A shortened example taken from http://allinoneat.blogspot.de/2013/04/integrate-rapidminer-wtih-java.html IOContainer ioResult = process.run(); if (ioResult.getElementAt(0) instanceof ExampleSet) { ExampleSet resultSet = (ExampleSet) ioResult.getElementAt(0); for (Example example : resultSet) { Iterator&lt;Attribute&gt; allAtts = example.getAttributes().allAttributes(); while (allAtts.hasNext()) { Attribute a = allAtts.next(); if (a.isNumerical()) { double value = example.getValue(a); System.out.print(value + " "); } else { String value = example.getValueAsString(a); System.out.print(value + " "); } } System.out.println("\n"); } }
upvote count: 1
type: AcceptedAnswer
downvote count: 0

send
type: Tag
tags question: http://stackoverflow.com/q/24049748
tags question: http://stackoverflow.com/q/23968832
tags question: http://stackoverflow.com/q/23971629
tag name: send

http://stackoverflow.com/comment/37020362
type: QuestionComment
has text: What does the update method in your service layer ? And does you persistance layer have an option to show the SQL commands sent to database (Hibernate does, don't know for others) ?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24012699

http://stackoverflow.com/a/24077574
answers question: http://stackoverflow.com/q/24077178
has comment: http://stackoverflow.com/comment/47171467
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/48060035
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/47140920
has body: As far as I know you can't align text to right in a TextField with vaadin. But you can do it with the CSS like this: first set the style name: TextField text = new TextField(); text.setStyleName("my-text"); add CSS : .v-textfield-my-text{ text-align:right !important; }
has comment: http://stackoverflow.com/comment/47039066
accepted answer of: http://stackoverflow.com/q/24077178

jbutton
tags question: http://stackoverflow.com/q/24004762
tags question: http://stackoverflow.com/q/23979959
tags question: http://stackoverflow.com/q/23991775
tags question: http://stackoverflow.com/q/24043350
tags question: http://stackoverflow.com/q/24070931
tags question: http://stackoverflow.com/q/23976499
tags question: http://stackoverflow.com/q/23976248
type: Tag
tags question: http://stackoverflow.com/q/23976650
tags question: http://stackoverflow.com/q/24027629
tags question: http://stackoverflow.com/q/24025938
tags question: http://stackoverflow.com/q/23967115
tags question: http://stackoverflow.com/q/23958570
tags question: http://stackoverflow.com/q/23977350
tags question: http://stackoverflow.com/q/24006928
tags question: http://stackoverflow.com/q/24028397
tags question: http://stackoverflow.com/q/24052807
tags question: http://stackoverflow.com/q/24102939
tag name: jbutton
tags question: http://stackoverflow.com/q/24028358

http://stackoverflow.com/q/23980442
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23980473
has comment: http://stackoverflow.com/comment/36950179
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36954032
type: Question
tagged with: android
answer count: 1
has title: Bizarre NoClassDefFoundError when running in Android
has body: I've tried looking at all the other NoClassDefFoundError threads on here and elsewhere, but they all seem to be a different problem. My activity refers to a custom FragmentPagerAdapter - let's call it MyFragmentPagerAdapter. The Activity refers to it with: MyFragmentPagerAdapter pagerAdapter = new MyFragmentPagerAdapter(getFragmentManager()); ViewPager viewPager = (ViewPager) findViewById(R.id.form_pager); viewPager.setAdapter(pagerAdapter); This all seems to compile and build perfectly well in Eclipse. Eclipse can certainly find all the classes - it auto filled the import statement for me. However, when I try and run the class in Android (emulator or device) I get a NoClassDefFoundError for MyFragmentPagerAdapter and (of course) the app crashes. I've tried deleting the APK on the device and re-installing in case it was a deployment issue, but it didn't help. This isn't to do with some 3rd party library - it's my own class that it fails to find! I have also tried "cleaning" the Project. I have extracted the apk and inspected the output of dexdump classes.dex | grep PagerAdapter and there are references to my class in there, so I can only assume the compiled class is getting itnot the apk - which makes me even more bemused.
score: 0

http://stackoverflow.com/a/24069563
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/24066367
score: 6
downvote count: 0
has body: (...) but I don't want to display the name of servlet in url. You don't need to use the Servlet name at all when accessing to a Servlet. In fact, you can create your servlet to point to the desired URL by defining the right URL pattern: @WebServlet("/index.jsp") public class LatestProductServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { List&lt;Product&gt; productList = ... //all the necessary code to obtain the list of products //store it as request attribute request.setAttribute("productList", productLlist); //forward to the desired view //this is the real JSP that has the content to display to user request.getRequestDispatcher("/WEB-INF/index.jsp").forward(request, response); } } Then, you will have a folder structure like this - &lt;root folder&gt; - WEB-INF + index.jsp + web.xml And in WEB-INF/index.jsp: &lt;!DOCTYPE html&gt; &lt;html lang="es"&gt; &lt;body&gt; &lt;!-- Display the data accordingly. Basic quick start example --&gt; &lt;c:forEach items="${productList}" var="product"&gt; ${product.name} &lt;br /&gt; &lt;/c:forEach&gt; &lt;/body&gt; &lt;/html&gt; Note that your clients will access to http://&lt;yourWebServer&gt;:&lt;port&gt;/&lt;yourApplication&gt;/index.jsp and will get the desired content. And you don't need to fire two GET requests to retrieve the content for your specific page. Note that you can go further with this approach: Since the pattern is now defined in servlet, you may choose to not use index.jsp for your clients, but index.html to access to your page. Just change the URL pattern in the Servlet: @WebServlet("/index.html") public class LatestProductServlet extends HttpServlet { //implementation... } And the clients will access to http://&lt;yourWebServer&gt;:&lt;port&gt;/&lt;yourApplication&gt;/index.html, which will show the results in WEB-INF/index.jsp. Now both your clients and you will be happy: clients will get their data and yo…

http://stackoverflow.com/comment/37066126
type: Comment
score: 0
type: AnswerComment
has text: @IdusOrtus it would be better if you add a setter method in your interface to specify the client of this interface, so you can set the current instance of the class that uses the interface , like `Tomcat` in its constructor. But note that this is an ugly design (not as bad as `Thread#getStackTrace` usage) and should be avoided due to generating class coupling.
comment on: http://stackoverflow.com/a/24042380

http://stackoverflow.com/comment/37006830
comment on: http://stackoverflow.com/q/24010597
score: 0
type: Comment
type: QuestionComment
has text: Did you put <http ... use-expressions="true"> ?

http://stackoverflow.com/q/23946339
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23946416
tagged with: java
has answer: http://stackoverflow.com/a/23946416
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23946428
downvote count: 0
has answer: http://stackoverflow.com/a/25934488
answer count: 3
tagged with: api
has title: Get Value from XML string
score: 1
favorite count: 0
has body: I am trying to get the value of "msg" from the returned XML response, As you can see "msg" is found twice. How can i get all values of "msg" from the returned response? Here is a sample of the returned value "msg" is found in error: &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;matches software="LanguageTool" version="2.6-SNAPSHOT" buildDate="2014-05-26 09:16"&gt; &lt;language shortname="en-US" name="English (US)" /&gt; &lt;error fromy="0" fromx="0" toy="0" tox="4" ruleId="UPPERCASE_SENTENCE_START" msg="This sentence does not start with an uppercase letter" replacements="This" context="this is a error" contextoffset="0" offset="0" errorlength="4" category="Capitalization" locqualityissuetype="typographical" /&gt; &lt;error fromy="0" fromx="8" toy="0" tox="9" ruleId="EN_A_VS_AN" msg="Use 'an' instead of 'a' if the following word starts with a vowel sound, e.g. 'an article', 'an hour'" replacements="an" context="this is a error" contextoffset="8" offset="8" errorlength="1" category="Miscellaneous" locqualityissuetype="misspelling" /&gt; &lt;/matches&gt;
has answer: http://stackoverflow.com/a/23946428
tagged with: android
tagged with: languagetool
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/37002997
score: 0
comment on: http://stackoverflow.com/q/24003612
type: Comment
type: QuestionComment
has text: @Stefoan The problem is: how to do that in Spring?

http://stackoverflow.com/comment/37059710
has text: Well you haven't shown how you're writing the XML to a file, and it's not clear what you mean by "xE4". What *bytes* are in the file? (And please show the code you're using to write it - I strongly suspect you're using the wrong encoding.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24038998
score: 0

http://stackoverflow.com/a/24097726
score: 0
has body: There is no guarantee that wgt has been initialized. For example, the user could enter '3' to the first question. You should consider and handle illegal inputs.
answers question: http://stackoverflow.com/q/24097670
type: Answer

http://stackoverflow.com/q/23984795
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has title: jsonGenerator cannot pass strings with whitespace
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23985104
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: javascript
has body: Hi i have a problem i cannot pass a string value containning whitespaces to the js function, im using jsonGenerator, here is my code: jGenerator.writeStringField(cols[8],ap.getContentId() != null ? "&lt;img src='img/active.png' onclick=authorizeContent("+ap.getContentId()+","+ ap.getName()+"); style='cursor:pointer;margin:0px 5px;width:18px;height:18px;'/&gt; &lt;img src='img/delete.png' onclick=authorizeContent('"+ ap.getContentId() +"','"+ ap.getName()+"'); style='cursor:pointer;margin:0px 5px;width:18px;height:18px;'/&gt;" : ""); This is the generated HTML &lt;td class="center"&gt;&lt;img src="img/active.png" onclick="authorizeContent(47,la" diabla);="" style="cursor:pointer;margin:0px 5px;width:18px;height:18px;"&gt; &lt;img src="img/delete.png" onclick="authorizeContent('47','la" diabla');="" style="cursor:pointer;margin:0px 5px;width:18px;height:18px;"&gt;&lt;/td&gt; Please help, i also tried this other way but didnt worked: jGenerator.writeStringField(cols[8],ap.getContentId() != null ? "&lt;img src='img/active.png' onclick=authorizeContent('"+ ap.getContentId() +"','"+ ap.getName()+"'); style='cursor:pointer;margin:0px 5px;width:18px;height:18px;'/&gt; &lt;img src='img/delete.png' onclick=authorizeContent('"+ ap.getContentId() +"','"+ ap.getName()+"'); style='cursor:pointer;margin:0px 5px;width:18px;height:18px;'/&gt;" : ""); and the html &lt;td class="center"&gt;&lt;img src="img/active.png" onclick="authorizeContent('47','la" diabla');="" style="cursor:pointer;margin:0px 5px;width:18px;height:18px;"&gt; &lt;img src="img/delete.png" onclick="authorizeContent('47','la" diabla');="" style="cursor:pointer;margin:0px 5px;width:18px;height:18px;"&gt;&lt;/td&gt;
accepted answer: http://stackoverflow.com/a/23985104

http://stackoverflow.com/q/24097425
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: rest
has body: In Jersey User Guide i read the following: @GET @Produces({"application/xml", "application/json"}) public String doGetAsXmlOrJson() { ... } If both are equally acceptable then the former will be chosen because it occurs first. However in my RESTful service (note that JSON media type occurs first): @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public User getUser(@PathParam("id") int id) { User user = userDao.getUserById(id); return user; } A request like: curl -v -X GET http://localhost:8080/myapp/users/2, returns an XML response. If the request specifies Accept header like json or xml all is ok. EDIT: curl --trace - -X GET http://localhost:8080/myapp/users/2 == Info: Adding handle: conn: 0xc2ad68 == Info: Adding handle: send: 0 == Info: Adding handle: recv: 0 == Info: Curl_addHandleToPipeline: length: 1 == Info: - Conn 0 (0xc2ad68) send_pipe: 1, recv_pipe: 0 == Info: About to connect() to localhost port 8080 (#0) == Info: Trying 127.0.0.1... == Info: Connected to localhost (127.0.0.1) port 8080 (#0) => Send header, 97 bytes (0x61) GET /myapp/users/2 HTTP/1.1..User-Agent: curl/7.31.0..Hostlocalhost:8080..Accept: */*.... <= Recv header, 17 bytes (0x11) HTTP/1.1 200 OK.. == Info: Server Apache-Coyote/1.1 is not blacklisted <= Recv header, 27 bytes (0x1b) Server: Apache-Coyote/1.1.. <= Recv header, 31 bytes (0x1f) Content-Type: application/xml.. <= Recv header, 21 bytes (0x15) Content-Length:234.. <= Recv header, 37 bytes (0x25) Date: Sat, 07 Jun 2014 15:26:17GMT.. <= Recv header, 2 bytes (0x2) .. <= Recv data, 234 bytes (0xea) <?xml version="1.0" encoding="UTF-8" standalone="yes"?> JOHN DOE 172.5 70.5 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> JOHN DOE 172.5 70.5 == Info: Connection #0 to host localhost left intact Question: Why if not Accept header is present (*/*) use xml like media type? Thanks in advance!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/74165952
upvote count: 4
has answer: http://stackoverflow.com/a/28195904
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: jersey
score: 4
answer count: 1
has comment: http://stackoverflow.com/comment/37168727
has comment: http://stackoverflow.com/comment/74165750
has title: Jersey default media type if not Accept header is present

http://stackoverflow.com/q/24039224
has comment: http://stackoverflow.com/comment/37083899
has comment: http://stackoverflow.com/comment/37083809
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24058060
tagged with: liferay
linked to: http://stackoverflow.com/q/13416157
tagged with: liferay-theme
score: 0
tagged with: liferay-ide
answer count: 1
has comment: http://stackoverflow.com/comment/37087481
tagged with: liferay-6
has title: In Liferay 6.2 unable to pass object from class to jsp
type: UnansweredQuestion
has body: I am trying to set an attribute of type list in a class and getting the attribute from the class to jsp by using following: First setting the attribute by using actionRequest.setAttribute("SEARCH_RESULT",result); For getting the object using the following request.getAttribute("SEARCH_RESULT"); But the above code always produces a null, why?
has comment: http://stackoverflow.com/comment/37060679

http://stackoverflow.com/comment/83391625
type: Comment
comment on: http://stackoverflow.com/a/23958916
has text: @AndrewMcCoist Well, `Runnable` is the only functional interface in the JDK having a method with no parameters and void return type. You can either use it whenever you need such interface, or you can define your own interface for cases you think the `Runnable` interface is not appropriate for.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37167188
comment on: http://stackoverflow.com/a/24096551
type: AnswerComment
has text: Correct, but the question was how to align them vertically, and GridLayout does the job too.
score: 0
type: Comment

http://stackoverflow.com/a/24060023
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24058908
has body: The problem seems to come from the array of Criterion, your array is sized to the number of names received even if it contains empty names, names smaller than 3 chars or duplicates. In those cases the array will contain less than names.length Criterion objects, the rest contains null references which causes your NPE. Instead of an array of Criterion you should use a List and use toArray() to pass it to Restrictions.or().
answers question: http://stackoverflow.com/q/24058908
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37098584

http://stackoverflow.com/a/23987116
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23986135
upvote count: 2
has body: You are potentially scanning the entire string several hundred times. Don't. Process it one character at a time to identify tokens you are interested in, and use a lookup table (HashMap) to convert each token to the desired output.

http://stackoverflow.com/q/23999241
upvote count: 5
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/36985673
answer count: 3
has title: How to sort two arrays with respect to eachother.
possible better answer: http://stackoverflow.com/a/23999325
has answer: http://stackoverflow.com/a/23999325
favorite count: 0
has comment: http://stackoverflow.com/comment/36985619
has answer: http://stackoverflow.com/a/23999323
has comment: http://stackoverflow.com/comment/36985790
has comment: http://stackoverflow.com/comment/36985593
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/109383
tagged with: java
has answer: http://stackoverflow.com/a/23999341
linked to: http://stackoverflow.com/q/4907683
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/23999341
has body: I have 2 arrays: private String[] placeName; private Double[] miles; The data in them look like this: placeName = {"home", "away", "here"}; miles = {111, 11, 3}; The position of the values match to each other. ie home = 111 and away = 11 I need to sort these arrays together so I don't lose how they are matched by the the number- lowest to highest. What is the best way to accomplish this? Do I need to combine the arrays first?

http://stackoverflow.com/comment/36914226
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23960212
has text: I tried your code. Its working fine even without closing. Which database are you using?
type: Comment

http://stackoverflow.com/comment/37001600
score: 0
type: Comment
type: AnswerComment
has text: @MattCoubrough Yes it is. Think of a subset this way "Can I subtract this?" and then think of the empty set or `String.Empty` in this case, as 0. You can subtract 0 from anything.
comment on: http://stackoverflow.com/a/24007827

http://stackoverflow.com/comment/36971556
has text: On second read: You keep saying 'Java' but your code looks like 'JavaScript'. You are aware that these are different languages, do you?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23948223
score: 0

http://stackoverflow.com/comment/36954202
type: Comment
has text: @user979349 Could you tell me how to do this? Thank you for your help?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23952599

http://stackoverflow.com/comment/37031263
type: QuestionComment
comment on: http://stackoverflow.com/q/24010377
score: 0
type: Comment
has text: Applets are as obsolete as classic ASP, and they also require the end user to have Java installed. Use Servlets. Then Java only needs to be installed on the server. I would also suggest using a Javascript library for the charts if you don't have the Flash app already.

http://stackoverflow.com/comment/37018954
score: 0
type: Comment
type: QuestionComment
has text: When I execute the stored procedure manually, it is working fine.
comment on: http://stackoverflow.com/q/24014434

http://stackoverflow.com/q/24017089
type: Question
tagged with: jakarta-ee
tagged with: ejb
has title: Inject an EJB into JUnit test class
has comment: http://stackoverflow.com/comment/91492624
upvote count: 7
tagged with: junit
favorite count: 0
has body: I defined an EJB as follows: @Stateless @LocalBean public class Foo { @Inject private Boo boo; public void doSomething() { boo.doOther(); } } And: @Named @RequestScope public class Boo { public void doOther() { // I do, I do... } } I would like to inject the Foo EJB into a JUnit test class: import org.junit.* public class FooTest { @EJB private Foo foo; @Test public void doSomethingTest() { foo.doSomething(); assertTrue(true); } } ... But this code returns a NullPointerException. What's wrong? How can I properly define that test by using Java EE CDI?
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/37018789
tagged with: unit-testing

http://stackoverflow.com/comment/37098450
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24059645
score: 0
has text: Yeah, you should probably try and remove the println(), printing each iteration is quite expensive...

http://stackoverflow.com/comment/36893810
has text: You should really read the docs for SimpleDateFormat, it even has examples! (And what is that doing in an infinite tight loop?)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23950228
score: 4

http://stackoverflow.com/a/23951050
downvote count: 0
upvote count: 1
has body: You should use Thread.sleep() to pause execution It's well explained here : http://docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html
answers question: http://stackoverflow.com/q/23950979
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36895234

http://stackoverflow.com/comment/37265224
has text: The file is like: `// brush from cube <line break> ( 400 100 200 ) <line break> ( 300 -100 300 ) <line break> // brush from cube <line break> ( 400 100 200 ) ( 300 -100 300 )`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24127167
type: AnswerComment

http://stackoverflow.com/q/23944422
tagged with: java
tagged with: binary-serialization
has title: Malformed binary serialization of HashMap<String,Double>
accepted answer: http://stackoverflow.com/a/23946468
type: Question
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/23945270
has answer: http://stackoverflow.com/a/23945270
tagged with: string
has answer: http://stackoverflow.com/a/23946468
tagged with: serialization
has answer: http://stackoverflow.com/a/23945194
has answer: http://stackoverflow.com/a/23944917
answer count: 4
type: AnsweredQuestion
score: 0
has body: I wrote some code to serialize a HashMap&lt;String,Double&gt; by iterating entries and serializing each of them instead of using ObjectOutputStream.readObject(). The reason is just efficiency: the resulting file is much smaller and it is much faster to write and read (eg. 23 MB in 0.6 seconds vs. 29 MB in 9.9 seconds). This is what I did to serialize: ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("test.bin")); oos.writeInt(map.size()); // write size of the map for (Map.Entry&lt;String, Double&gt; entry : map.entrySet()) { // iterate entries System.out.println("writing ("+ entry.getKey() +","+ entry.getValue() +")"); byte[] bytes = entry.getKey().getBytes(); oos.writeInt(bytes.length); // length of key string oos.write(bytes); // key string bytes oos.writeDouble(entry.getValue()); // value } oos.close(); As you can see, I get the byte array for each key String, serialize its length and then the array itself. This is what I did to deserialize: ObjectInputStream ois = new ObjectInputStream(new FileInputStream("test.bin")); int size = ois.readInt(); // read size of the map HashMap&lt;String, Double&gt; newMap = new HashMap&lt;&gt;(size); for (int i = 0; i &lt; size; i++) { // iterate entries int length = ois.readInt(); // length of key string byte[] bytes = new byte[length]; ois.read(bytes); // key string bytes String key = new String(bytes); double value = ois.readDouble(); // value newMap.put(key, value); System.out.println("read ("+ key +","+ value +")"); } The problem is that at some point the key is not serialized correctly. I've been debugging to the point where I could see that ois.read(bytes) read 8 bytes instead of 16 as it was supposed to, so the key String was not properly formed and the double value was read using the last 8 bytes from the key that were not read yet. In the end, Exceptions everywhere. Using the sample data below, the output will be like this at some point: read (2010-00-056.html,12154.250518054876) read (2010-00- ,1.40…

http://stackoverflow.com/q/24035245
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: setfocus
type: Question
has title: JFrame not responding to keylistener
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37052660
linked to: http://stackoverflow.com/q/1231622
tagged with: keylistener
has comment: http://stackoverflow.com/comment/37052789
has comment: http://stackoverflow.com/comment/37052611
has answer: http://stackoverflow.com/a/24035935
has comment: http://stackoverflow.com/comment/37053413
answer count: 2
has answer: http://stackoverflow.com/a/33613606
downvote count: 0
accepted answer: http://stackoverflow.com/a/24035935
linked to: http://stackoverflow.com/q/286727
favorite count: 0
possible better answer: http://stackoverflow.com/a/33613606
tagged with: jframe
has body: Hi Im trying to add a KeyListener to a JFrame. I've done this before and this worked perfectly. Now I am copying the code to let it listen to another JFrame, but now it stopped working for some reason. I don't know what i did wrong. EDIT: It looks like everything works untill i push a button from one of the 2 JPanels inside the screen. It's like it lost focus after that. How can i fix this? This is the constructor of the new JFrame where I add the KeyListener : public class QuizSoftwareView extends JFrame implements View{ private Observable $model; private Controller $controller; public EditQuestionsView $editQuestionsView; public EditTeamsView $editTeamsView; public AdministratorMenu $adminMenu; private boolean $isPressed; /* To check if we already listened to a key press event */ /** * Constructor to make a new quiz */ public QuizSoftwareView(Observable model, Controller controller) { this.setTitle(QuizSoftwareModel.$language.getMessages().getString("title")); $model = model; if (controller == null) $controller = new QuizSoftwareController(model); else $controller = controller; $isPressed = false; initComponents(); setFocusable(true); /* Add a keylistener for every team */ addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { System.out.println("TEST"); int teamSize; /* team size*/ teamSize = ((QuizSoftwareModel) getModel()).getQuiz().getModel().getTeams().size(); System.out.println(teamSize); /* F1 is keycode 112, so % 111 gives 1 -&gt; team 1, team 1 gets button F1, team 2 gets button F2 and so on... */ if((e.getKeyCode() % 111) &lt;= teamSize /*&amp;&amp; !alreadyPressed((e.getKeyCode() % 111))*/) { /* If you pressed a number under the teamsize we listen to it, and that team hasn't pressed their button before */ /* Give a pop up message to the admin that a team has pushed their button */ //buttonPressed((e.getKeyCode() % 111)); System.out.println("TESTT"); ((QuizSoftwareController)getController()).showScoreView((e.getKeyCode() % 111)); } } }); …

http://stackoverflow.com/q/23975569
favorite count: 0
type: UnansweredQuestion
score: -4
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/36941340
tagged with: java
has comment: http://stackoverflow.com/comment/36941593
type: Question
linked to: http://stackoverflow.com/q/1489665
has comment: http://stackoverflow.com/comment/36941292
has answer: http://stackoverflow.com/a/23975859
downvote count: 4
has body: Many people use Tomcat as an excellent Servlet container who don't use JSPs/Taglibraries. There are many mature component oriented Java UI frameworks available now which have no need for older technologies like JSP/Tag libraries so I question why scanning every Jar for these older style Tag library artefacts is the default action for Tomcat 7 and which needs to be turned off in order for Tomcat to start up in reasonable time. Wouldn't it be better if Tomcat treated JSP as 'just another' UI framework that it supports but not one that it is intrinsically bound to? What is the quickest way to configure Tomcat 7 to turn off this scanning and make it work in 'Tomcat 6' mode?
upvote count: 0
answer count: 1
has title: Why does Tomcat default to scanning for TLDs, a framework specific artefact

jquery
tags question: http://stackoverflow.com/q/24000029
tags question: http://stackoverflow.com/q/24101135
tags question: http://stackoverflow.com/q/24018120
tags question: http://stackoverflow.com/q/23955709
type: Tag
tags question: http://stackoverflow.com/q/24074221
tags question: http://stackoverflow.com/q/23954428
tags question: http://stackoverflow.com/q/24053111
tags question: http://stackoverflow.com/q/23977256
tag name: jquery
tags question: http://stackoverflow.com/q/23970960
tags question: http://stackoverflow.com/q/23970663
tags question: http://stackoverflow.com/q/24100075
tags question: http://stackoverflow.com/q/24094443
tags question: http://stackoverflow.com/q/24039989
tags question: http://stackoverflow.com/q/24017544

image-processing
tags question: http://stackoverflow.com/q/24078235
tags question: http://stackoverflow.com/q/24011156
tags question: http://stackoverflow.com/q/24070327
tags question: http://stackoverflow.com/q/24036185
tags question: http://stackoverflow.com/q/23976766
tags question: http://stackoverflow.com/q/23998603
type: Tag
tags question: http://stackoverflow.com/q/24082006
tags question: http://stackoverflow.com/q/23955911
tags question: http://stackoverflow.com/q/23952685
tags question: http://stackoverflow.com/q/24048202
tag name: image-processing
tags question: http://stackoverflow.com/q/23961652
tags question: http://stackoverflow.com/q/23992700
tags question: http://stackoverflow.com/q/23993150

http://stackoverflow.com/comment/37035450
score: 1
has text: @BoristheSpider There is not a lot to say. This might be a good start. http://vanillajava.blogspot.com/2011/08/double-your-money-again.html
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23990875

http://stackoverflow.com/comment/36971408
score: 0
type: Comment
has text: Added JavaConfig sample
type: AnswerComment
comment on: http://stackoverflow.com/a/23991500

http://stackoverflow.com/a/24051434
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24049197
has comment: http://stackoverflow.com/comment/37088804
type: Answer
has body: The problem is that Android already includes an older version (it's unclear exactly which, but around 4.0beta2) of Apache HttpClient. When you add the jars of the new version as libraries of your application, duplicate classes are ignored when the APK is loaded. Since some new classes in HttpClient depend on modifications made on these other classes, dalvik does what it can (e.g. removing references, &amp;c) but unless they are used conditionally, this is likely to cause crashes. For example, you can see messages like these in logcat: 06-05 00:46:39.083: I/dalvikvm(6286): Could not find method org.apache.http.client.protocol.RequestDefaultHeaders.&lt;init&gt;, referenced from method org.apache.http.impl.client.HttpClientBuilder.build 06-05 00:46:39.083: W/dalvikvm(6286): VFY: unable to resolve direct method 22794: Lorg/apache/http/client/protocol/RequestDefaultHeaders;.&lt;init&gt; (Ljava/util/Collection;)V 06-05 00:46:40.434: D/dalvikvm(6286): DexOpt: couldn't find static field Lorg/apache/http/impl/client/DefaultHttpRequestRetryHandler;.INSTANCE 06-05 00:46:40.434: W/dalvikvm(6286): VFY: unable to resolve static field 8420 (INSTANCE) in Lorg/apache/http/impl/client/DefaultHttpRequestRetryHandler; This particular message is because DefaultHttpRequestRetryHandler has a new INSTANCE static field in 4.3, which it does not have in Android. There are many more. Going back to your original question, the only way to use a newer httpclient would be to rename all classes so these name conflicts don't occur. This is what httpclientandroidlib does. Going even further back: DefaultHttpClient has indeed been deprecated in 4.3, but it is not deprecated in Android (unless you consider the trend towards using HttpUrlConnection a stealth form of deprecation -- in which case a newer HttpClient wouldn't be the preferred alternative either). Why exactly would you want/need to change it?
accepted answer of: http://stackoverflow.com/q/24049197
score: 5

http://stackoverflow.com/comment/36997987
has text: I'm going to completely uninstall and reinstall java
type: Comment
comment on: http://stackoverflow.com/a/24005500
score: 0
type: AnswerComment

http://stackoverflow.com/q/23975663
favorite count: 0
tagged with: imageicon
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/23975692
accepted answer: http://stackoverflow.com/a/23975692
type: Question
has comment: http://stackoverflow.com/comment/36940916
tagged with: image
upvote count: 2
has body: This is my code: Image img1 = new ImageIcon("http://www.funchap.com/wp-content/uploads/2014/05/Cute-Dog- Wallpapers.jpg").getImage();" setLayout(new GridLayout(2,3,5,5)); add(new ImageViewer(img1)); I got an error that cant put url typed image into the ImageIcon how to fix it. thank you.
downvote count: 1
answer count: 1
tagged with: url
has title: How to input URL type image into imageviewer

http://stackoverflow.com/q/23973188
possible better answer: http://stackoverflow.com/a/26272938
type: AnsweredQuestion
has body: I faced an fetal error with eclipse ide, when i try to open eclipse load GUI and then close, that occur each time opened eclipse ide. Error Loading DDMS Preferences # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f5a0c9822a1, pid=4316, tid=140027354994432 # # JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libsoup-2.4.so.1+0x6c2a1] soup_session_feature_detach+0x11 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /opt/eclipse/hs_err_pid4316.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug Work around change eclipse owwner. run eclipse as root. Extract jdk again on /opt. Made link to jre from /opt to /usr/bin. But problem still exists, any help will be appreciated.
has answer: http://stackoverflow.com/a/26272938
linked to: http://stackoverflow.com/q/20203771
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36936220
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23977968
has title: Eclipse crash and close every time opened
accepted answer: http://stackoverflow.com/a/23977968
has comment: http://stackoverflow.com/comment/36945199

http://stackoverflow.com/a/24102876
upvote count: 3
has body: It is generally considered that hashmap look ups only take O(1) time. This is the average time for look up. But in the worst case scenario it can be O(n) as well. For an example if a linked list is used in the implementation of hashmap this scenario can occur. But it can be avoided if self-balancing trees are used which reduces the worst case scenario to O(log n) time.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37179902
has comment: http://stackoverflow.com/comment/37180184
has comment: http://stackoverflow.com/comment/37179871
answers question: http://stackoverflow.com/q/24102828
score: 3

http://stackoverflow.com/comment/37119351
type: Comment
has text: By the way, please note that this does not addresses the need of holding a lock when the task is running as requested in the question. Not an answer thus. Feel free to add a new one as Alex did or vote for any answer that you think satisfy all the requirements. Thanks.
comment on: http://stackoverflow.com/a/24006603
type: AnswerComment
score: 0

http://stackoverflow.com/q/23988977
has comment: http://stackoverflow.com/comment/36965878
has comment: http://stackoverflow.com/comment/36966082
type: Question
has title: Class Random only Generates 0
possible better answer: http://stackoverflow.com/a/23989017
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23989017
tagged with: class
has answer: http://stackoverflow.com/a/23989035
accepted answer: http://stackoverflow.com/a/23989035
answer count: 2
tagged with: random
downvote count: 1
favorite count: 0
has body: Okay I have The problem that i want to generate 64 numbers between 0 and 1 (that means 0 or 1) the function i have currently is: public static int randNr(int max) { Random r = new Random(); int o = r.nextInt(max); return o; } But it always returns 0. Is there any way to make that it generates also a 1 ? EDIT: the function is located in a different java file than when i calling it!
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36965907

http://stackoverflow.com/comment/37005953
comment on: http://stackoverflow.com/a/24010210
score: 1
has text: I think in this case, start() should better receive NewClass Object as paramater to create a thread of it.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36936414
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23973561
score: 0
has text: Unclear asking. See "minus is an operator", converting an operator into number is meaning less.

http://stackoverflow.com/q/24068989
has comment: http://stackoverflow.com/comment/37152383
type: Question
score: 3
has title: CAS SingleSignOutFilter
tagged with: cookies
tagged with: java
has comment: http://stackoverflow.com/comment/37115679
has comment: http://stackoverflow.com/comment/37143424
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/21258113
tagged with: jsessionid
has comment: http://stackoverflow.com/comment/37115882
tagged with: cas
has comment: http://stackoverflow.com/comment/37140875
has body: I followed the CAS Best Practices for building a cas.war (v4.0.0) and deploying it to Tomcat7. When I spin up Tomcat, I am able to access my CAS login page at: https://localhost:8443/cas/login I then deploy one of my "client" apps (a Grails web app using Shiro for authentication), which comes online at: http://localhost:9100/myapp I go to an authenticated URL for myapp: http://localhost:9100/myapp/secret I am successfully redirected to my CAS login page (for now, I'm using the default casLoginView.jsp). I check my browser cookies, and for the CAS site I have a JSESSIONID. I login using the CAS default credentials (username is casuser; password is Melon) and am successfully redirected to http://localhost:9100/myapp/secret. Great success! I check my cookies again and see that I have the same JSESSIONID as well as a new CASTGC cookie. I now go directly to my CAS logout page: https://localhost:8443/cas/logout I see a "Logout successful" message, and check my cookies again. The CASTGC cookie is gone, and I still have a JSESSIONID, however, it's a different JSESSIONID than the first one I got. I now go back to my authenticated URL: http://localhost:9100/myapp/secret I expect to be redirected to the CAS login page: instead I am allowed to view the /secret page and appear to still be authenticated, even after logging out!!! I believe I need to implement the SingleSignOutFilter by placing it in myapp's web.xml as instructed here. What I need to know: Will configuring SingleSignOutFilter in web.xml complete my implementation for single sign out, or is there more config that I need to do? Once single sign out is implemented, will it have the expected behavior that I describe above? Meaning, if I go to the /logout link, then anytime I try to go to an authenticated URL, it should redirect me back to the /login page? How can I tell which protocol (CAS 2.0 or SAML 1.1) I'm using? I should be using whatever default CAS 4.0.0 ships with as I didn't override anything in my project. W…
tagged with: single-sign-on
has comment: http://stackoverflow.com/comment/49237121
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/59095647

http://stackoverflow.com/q/24081491
has comment: http://stackoverflow.com/comment/37137908
score: -1
has body: I need to change the below code in java 1.4, can anyone help me to do so. the main problem I am getting is to convert the string type of list line List splitStringList = new ArrayList () and line for (String str: splitStringList) is generating error for java 1.4 public class Demo2ReferDemo1 { public static void main (String [] args) { String inputStr = "00400 - 00479,00100 - 0022200su,00100 - 00228,00100 - 00228,00400 - 00479,lab661,"; StringBuffer sb = new StringBuffer (inputStr); List&lt;String&gt; splitStringList = new ArrayList&lt;String&gt; (); boolean insideDoubleQuotes = false; StringBuffer field = new StringBuffer (); for (int i=0; i &lt; sb.length(); i++) { if (sb.charAt (i) == '"' &amp;&amp; !insideDoubleQuotes) { insideDoubleQuotes = true; } else if (sb.charAt(i) == '"' &amp;&amp; insideDoubleQuotes) { insideDoubleQuotes = false; splitStringList.add (field.toString().trim()); field.setLength(0); } else if (sb.charAt(i) == ',' &amp;&amp; !insideDoubleQuotes) { // ignore the comma after double quotes. if (field.length() &gt; 0) { splitStringList.add (field.toString().trim()); } // clear the field for next word field.setLength(0); } else { field.append (sb.charAt(i)); } } for (String str: splitStringList) { System.out.println ("Split fields: "+str); } } }
has answer: http://stackoverflow.com/a/24081952
answer count: 2
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24081568
has answer: http://stackoverflow.com/a/24081568
accepted answer: http://stackoverflow.com/a/24081952
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37137955
tagged with: java1.4
downvote count: 1
type: Question
has title: change the String List code in java 1.4
tagged with: java

http://stackoverflow.com/q/23983410
has comment: http://stackoverflow.com/comment/36958141
has title: multicastSocket doesn't receive packets
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36959586
has comment: http://stackoverflow.com/comment/36955921
type: Question
has comment: http://stackoverflow.com/comment/36955857
has comment: http://stackoverflow.com/comment/36956481
has comment: http://stackoverflow.com/comment/36958615
has body: I am working on a simple audio streamer with multicast. I wrote serer and client on the same machine, so I worked with localhost and multicast-groups. The system works on one machine but when I tried to use another PC as the server, I can't get them to connect. Here is the situation: The client first knocks on a tcp-server which lets the client know the multicasting-group IP an port. After this, the client starts listining to the address via multicastSocket.receive();. Here are the important bits from the system: (I left out the exceptions and other non-important stuff in the following code) Server Important to know is that the "LAN-Connection" is the name of my network interface on the servers system. int multicastPort = 8888; InetAddress multicastIP = InetAddress.getbyName("228.5.6.7"); InetSocketAddress multicastAddress = new inetSocketAddress( multicastIP, multicastPort ); NetworkInterface multicastInterface = NetworkInterface.getByName( "LAN-Connection" ); MulticastSocket multicastSocket = new MulticastSocket( multicastPort ); multicastSocket.joinGroup( multicastAddress, multicastIP); while(true) { byte [] buffer = audioIn.readBytes(); DatagramPacket packet = new DatagramPacket(buffer, buffer.length, multicastIP, multicastPort); multicastSocket.send(packet ); } Client The client requests the multicast-IP and Port from the server. (a tcp-server-thread handles this) Like with the server "LAN-Connection" is the name of the clients network interface. int multicastPort = server.request("port"); String multicastIP_String = server.request("IP"); InetAddress multicastIP = InetAddress.getbyName(multicastIP_String ); InetSocketAddress multicastAddress = new inetSocketAddress( multicastIP, multicastPort ); NetworkInterface multicastInterface = NetworkInterface.getByName( "LAN-Connection" ); MulticastSocket multicastSocket = new MulticastSocket( multicastPort ); multicastSocket.joinGroup( multicastAddress, multicastIP); while(true) { byte [] buffer = new byte[2048]; Datagr…
favorite count: 0
has comment: http://stackoverflow.com/comment/44099712
has comment: http://stackoverflow.com/comment/36958660
tagged with: multicast
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/58222015
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24225297
has text: It isn't necessary here since a "plain" Persister is enough to handle the cases. If your Persister in the `read()`-method should use any custom Converter, you have to use eg. an AnnotationStrategy - but in this example it's just optional.

http://stackoverflow.com/a/23975553
has comment: http://stackoverflow.com/comment/40164723
answers question: http://stackoverflow.com/q/23963455
upvote count: 1
has comment: http://stackoverflow.com/comment/40196731
has body: (I know I could have edited my previous answer, but this one's so different...) Thanks to @OldCurmudgeon, I have come up with what I think is pretty good. Here's "proof" (I may just leave each label and tooltip as is): public enum Colors { TRIPLE_WORD (255, 220, 50), TRIPLE_LETTER (255, 255, 150), DOUBLE_WORD ( 0, 255, 0), DOUBLE_LETTER (214, 245, 214), NOT_A_BONUS (255, 255, 255); private final int red, green, blue; Colors(int r, int g, int b){ this.red = r; this.green = g; this.blue = b; } public java.awt.Color background(Colors c){ return new java.awt.Color(c.red, c.green, c.blue); } } private void makeScoremasterBonuses(){ Colors c; Colors all [] = Colors.values(); String labels[] = new String[all.length]; String abbrs [] = new String[all.length]; JButton but; pnlBonuses = new JPanel(); pnlBonuses.add(new JLabel("Legend:")); for (int i = 0; i &lt; all.length; i++) { labels[i] = all[i].name().replace("_", " ").toLowerCase(); abbrs [i] = abbreviate(all[i].name()); c = Colors.values()[i]; but = new JButton(abbrs[i]); but.setToolTipText(labels[i]); but.setBackground(c.background(c)); but.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); but.setActionCommand("" + i); but.addActionListener(this); pnlBonuses.add(but); } }
has comment: http://stackoverflow.com/comment/36956428
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/36930010
comment on: http://stackoverflow.com/q/23969553
score: 0
type: Comment
type: QuestionComment
has text: Thanks, I will check it out. But I'm still Interested about the traditional way to do that.

http://stackoverflow.com/a/24003600
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36994298
has body: Looks like one of the lines in the file doesn't have a &gt; or ) character. In fact I don't see the &gt; in your file data at all. One of the operators might be multiline. Extract the indexOf into separate variables and check that those symbols are there. int index1 = line.indexOf("&gt;"); if (index1 &lt; 0) { //skip this line continue; } Also, you might want to swap the trim and isEmpty check so it would filter out lines consisting of just whitespaces.
accepted answer of: http://stackoverflow.com/q/24003464
type: Answer
answers question: http://stackoverflow.com/q/24003464
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36994231
has comment: http://stackoverflow.com/comment/36994408
upvote count: 1

http://stackoverflow.com/comment/37142723
comment on: http://stackoverflow.com/q/24083924
has text: Ya , i have data on server side , and i need to create a JSON to send it to Front end .
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37040294
score: 1
type: AnswerComment
has text: As I said, it is old code. Maybe not the best example to use a null layout, but it does demonstrate how hit detection on Swing components works even when components are stacked on top of one another by overriding the contains(...) method.
type: Comment
comment on: http://stackoverflow.com/a/24028405

http://stackoverflow.com/comment/37059456
has text: Seems to break in `Server.dataEnc`. Did you get an informational message from line `System.out.println("Client Info:" + client);`
comment on: http://stackoverflow.com/q/24037463
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/78777816
type: Answer
has body: You can check out another open-source tool Bytebase. It provides GUI interface for authoring and reviewing schema changes and it supports ES.
score: 0
answers question: http://stackoverflow.com/q/23977688

http://stackoverflow.com/comment/36956206
type: Comment
has text: I thought about that too, but that's not 100% true to the original operation. Getting the value at a single position is different than getting the values for a given range. Perhaps this would be a more ideal solution if the code were rewritten to make use of the fact that one is getting five numbers at a time instead of one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23983637

http://stackoverflow.com/comment/74901019
type: QuestionComment
comment on: http://stackoverflow.com/q/23952888
has text: Possible duplicate of [Error unmarshalling xml in java-8 "secure-processing org.xml.sax.SAXNotRecognizedException causing java.lang.IllegalStateException"](http://stackoverflow.com/questions/25644023/error-unmarshalling-xml-in-java-8-secure-processing-org-xml-sax-saxnotrecognize)
type: Comment
score: 0

http://stackoverflow.com/comment/37031029
has text: It gives another error on bitmap2 in the RunOnUiThread if I do this. I got it working (for the most part) and my updated code is in the main post now. Could you see if you think its good now? Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24023299
type: Comment

http://stackoverflow.com/a/24004080
type: AcceptedAnswer
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24003802
has body: The bits you're passing into ActionBar.setDisplayOptions are telling the ActionBar to only show the "home" icon and your custom view. You should also pass in ActionBar.DISPLAY_HOME_AS_UP. As in: actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM); Alternatively, just call ActionBar.setDisplayShowCustomEnabled: actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.actionbar_view);
type: Answer
has comment: http://stackoverflow.com/comment/36995001
answers question: http://stackoverflow.com/q/24003802
score: 5

http://stackoverflow.com/a/23951498
accepted answer of: http://stackoverflow.com/q/23943100
answers question: http://stackoverflow.com/q/23943100
upvote count: 1
has comment: http://stackoverflow.com/comment/36912482
type: AcceptedAnswer
downvote count: 0
score: 1
has body: When unmarshalling, you must: Provide as root of your XML an element marked with @XMLRootElement. Define your classes as fully compliant Java Beans (get/set methods over attributes). Here is the code that worked for me: Parent.java package dummy; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @XmlRootElement @XmlSeeAlso({ Child.class }) public abstract class Parent implements Serializable{} Child (with a small main method marshalling and unmarshalling the same payload) package dummy; import java.io.ByteArrayInputStream; import java.io.Serializable; import java.io.StringWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Child extends Parent implements Serializable { private String attribute; private List<String> values = new ArrayList<String>(); /** * @return the attribute */ public String getAttribute() { return attribute; } /** * @param attribute * the attribute to set */ public void setAttribute(String attribute) { this.attribute = attribute; } /** * @return the values */ public List<String> getValues() { return values; } /** * @param values * the values to set */ public void setValues(List<String> values) { this.values = values; } public static void main(String[] args) throws JAXBException { JAXBContext context = JAXBContext.newInstance(Parent.class); Child child = new Child(); child.setAttribute("dummy"); child.setValues(Arrays.asList("value1", "value2")); StringWriter writer = new StringWriter(); context.createMarshaller().marshal(child, writer); System.out.println(writer.getBuffer().toString()); Child unmarshalledChild = (Child) context.createUnmarshaller().unmarshal(new ByteArrayInputStream(writer.getBuffer().toString().getBytes())); System.out.println("attribute: " + unmarshalledChild.attribute); System.…
has comment: http://stackoverflow.com/comment/36902855
type: Answer

http://stackoverflow.com/comment/37056261
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24036826
has text: Hi Thomas Uhrig, I am sorry, i could not get you as i am not well aware of SSH connection.
score: 0

http://stackoverflow.com/comment/37120135
has text: You might get closest to "extending a Jython class" by "extending" a Jython *object* with a [dynamic proxy class](http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html), but that might be overkill for what your real needs are?
comment on: http://stackoverflow.com/q/24006154
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24008994
has body: You can use regex check in Java as follows: String testString = "1.2.3"; boolean isCorrectFormat = testString.matches("\\d\\.\\d\\.\\d"); Sample Tests: And some input/output samples: "11.22.33" -&gt; false "1.2.3." -&gt; false "1.23" -&gt; false "1.1.1" -&gt; True
answers question: http://stackoverflow.com/q/24008946
type: Answer
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/comment/37030558
score: 1
type: QuestionComment
has text: makes it parametrized that's what it's designed by you. If you don't want to use generic they why are you making the interface generic. First read why use generic? What is benefit of using Generic?
comment on: http://stackoverflow.com/q/24023422
type: Comment

http://stackoverflow.com/a/24027019
upvote count: 2
has body: The javadoc of Selector.open() states The new selector is created by invoking the openSelector method of the system-wide default java.nio.channels.spi.SelectorProvider object. They are equivalent.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24027007
downvote count: 0

http://stackoverflow.com/comment/37168065
type: Comment
comment on: http://stackoverflow.com/q/24097110
has text: @OliCharlesworth I want to return an int
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37035718
type: QuestionComment
comment on: http://stackoverflow.com/q/24016348
has text: Play doesn't seem to like spaces in it's path on windows for some reason. Life would be much easier if you'd just place it in `C:\play` or something simple.
score: 0
type: Comment

http://stackoverflow.com/a/24032403
has comment: http://stackoverflow.com/comment/37048969
has body: A cached Thread Pool allows you to start with a non-fixed size that will expand as needed. Please see: Executors.newCachedThreadPool Code change: ExecutorService executor = Executors.newCachedThreadPool();
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24032301
upvote count: 2
type: Answer

http://stackoverflow.com/q/24030010
has comment: http://stackoverflow.com/comment/37043003
answer count: 2
has answer: http://stackoverflow.com/a/24030066
score: 3
linked to: http://stackoverflow.com/q/38922754
downvote count: 0
possible better answer: http://stackoverflow.com/a/67425424
has answer: http://stackoverflow.com/a/67425424
favorite count: 0
has title: What is the relation between number "41794" and todays date(i.e 04/06/2014)?
tagged with: time
accepted answer: http://stackoverflow.com/a/24030066
has comment: http://stackoverflow.com/comment/37043293
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37042972
has comment: http://stackoverflow.com/comment/37042988
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9754600
has body: I am trying to extract the id 41794 from a website. But the said number depends on the start date(today's date). See snippet below from the site, 'index.cfm?fuseaction=c_availabilityGrid.displayAvailabilityGrid&amp;startDate=41794&amp;timeSpan=ww,2&amp;showBeds=1&amp;showMlos=0&amp;showprice=1' I am interested to know how the value 41794 is obtained from today's date so that i can put that logic in my code. Is there any function in java which takes input as date and returns the number as mentioned above? Any help in this matter would be greatly appreciated.
tagged with: date

http://stackoverflow.com/a/23951345
has body: In Java 8 you could achieve this using default methods but that was never the intent of defaults so this may be bad advice: interface Foo { default void one () { System.out.println("ONE!"); } } interface Bar { default void two () { System.out.println("TWO!"); } } class FooBar implements Foo, Bar { } public void test() { FooBar fooBar = new FooBar(); fooBar.one(); fooBar.two(); } However, I would like to reiterate what @Thomas said in his comment The need for multiple inheritance is often a sign of a flaw in the design.
has comment: http://stackoverflow.com/comment/36895898
type: Answer
has comment: http://stackoverflow.com/comment/36895778
has comment: http://stackoverflow.com/comment/36896311
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23951234
has comment: http://stackoverflow.com/comment/36895868
has comment: http://stackoverflow.com/comment/36895851
score: 5
has comment: http://stackoverflow.com/comment/36895983

http://stackoverflow.com/q/24002937
type: Question
has answer: http://stackoverflow.com/a/24002961
has body: I tried to use assertions in java from an example put forth from a site but it is not throwing an Assertion Error even if it does not conform to the requirements. Where am I doing wrong? package Sources; import java.util.Scanner; public class MyAssertion { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter your age"); int age = scanner.nextInt(); assert age&gt;=18:"Not Valid !!"; System.out.println("Age is -- "+age); } } I have also used the following command : java -ea -cp ./classes Sources.MyAssertion But even if I enter the age as 33 it is not throwing an error . Why? Any help is much appreciated :)
tagged with: java
score: -1
answer count: 1
has comment: http://stackoverflow.com/comment/36992820
favorite count: 0
downvote count: 1
has title: Why assertions in Java is not working?
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24048408
has answer: http://stackoverflow.com/a/24048469
type: Question
has comment: http://stackoverflow.com/comment/37077792
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24048448
has title: How can I add the ActionEvent to the JButton so that when i click it it will fire the event?
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/24048665
has body: I want to be able to add the ActionListener to the JButton but cannot seem to get it to work properly. I have tried to add the ActionListeneer and also the ActionEvent and neither seems to fire the ActionPerformed method. I did not one curious aspect was the the compiler made me take off the @Override keyword since the interface is used to create a variable and not implemented. Does this make a difference? I am certain that you can do it this way but I think I am just a bit off the mark. Code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; public class testInterfaces2 { static ActionListener m; static ActionEvent me; testInterfaces2() { } public void actionPerformed(ActionEvent e) { System.out.println("Mouse Clicked"); } public static void main(String[] args) { JFrame f = new JFrame("Test"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); JButton pButton = new JButton("Print"); pButton.addActionListener(m); //pButton.addActionListener(m.actionPerformed(me)); f.add("Center", pButton); f.pack(); f.setVisible(true); } }
tagged with: java

http://stackoverflow.com/a/24006157
downvote count: 0
answers question: http://stackoverflow.com/q/24005938
upvote count: 2
type: Answer
has body: Craig already addressed the unhandled exception issue, but I wanted to make it clear. I coded up two examples (the last is just bad because you could be working with a broken connection after an exception has occurred, don't do that). Here is a simple example that throws an ArrayIndexOutOfBoundsException: class TryCatchFinally { static int [] array = new int[1]; public static void main(String [] args) throws Exception { if (args[0].startsWith("1")) { version1(); } else if (args[0].startsWith("2")) { version2(); } } static int version1() { int r = 0; try { System.out.println("In Try."); return array[1]; } catch (Exception e) { System.out.println("In Catch."); } finally { System.out.println("In Finally."); } System.out.println("In Return."); return r; } static int version2() { int r = array[1]; try { System.out.println("In Try."); } catch (Exception e) { System.out.println("In Catch."); } finally { System.out.println("In Finally."); } System.out.println("In Return."); return r; } } And here is the execution: (TryCatchFinally)$ javac *.java (TryCatchFinally)$ java TryCatchFinally 1 In Try. In Catch. In Finally. In Return. (TryCatchFinally)$ java TryCatchFinally 2 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at TryCatchFinally.version2(TryCatchFinally.java:24) at TryCatchFinally.main(TryCatchFinally.java:7) (TryCatchFinally)$ As you can see in the first version an exception handler was registered because the exception occurred within the context of a try block. In the second version there was no registered exception handler and the default exception handler was invoked (meaning an uncaught exception).
score: 2

http://stackoverflow.com/q/23985558
linked to: http://stackoverflow.com/q/23986724
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42286037
tagged with: android
has body: I am reading Android Native Development Kit Cookbook. And there are sample codes in each chapter. Current chapter is dedicated to Debugging an Android NDK application with NDK GDB. But I have problems with it. The cookbook requires that AndroidManifest.xml has the android:debuggable attribute of the &lt;application&gt;element set to true. But when I set it true or false Eclipse complains with an error. I have read that android:debuggable=true is not mandatory, you can just do ndk-build NDK_DEBUG=1 and app will be debuggable. So I have omitted setting debuggable flag in Manifest and just build the app. Then deployed the app on device run it and called ndk-gdb from terminal. But I got this message: $ ndk-gdb ERROR: Package cookbook.chapter3 is not debuggable ! You can fix that in two ways: Rebuilt with the NDK_DEBUG=1 option when calling 'ndk-build'. Modify your manifest to set android:debuggable attribute to "true", then rebuild normally. How to overcome this problems (the flag in manifest and achieve debugging)? Please help me to debug my test project. I am just learning.
has title: ERROR: Package cookbook.chapter3 is not debuggable (ndk-gdb)
tagged with: c++
linked to: http://stackoverflow.com/q/17219906
downvote count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37550372
tagged with: android-ndk
type: Question
score: 1
tagged with: java-native-interface
tagged with: java

http://stackoverflow.com/q/24076053
upvote count: 0
has answer: http://stackoverflow.com/a/24076286
downvote count: 12
tagged with: arrays
favorite count: 0
has body: I want to shuffle a int array with 8 element but I want that when I shuffle it array index and element on that index should not be same My array is int num[]={0,1,2,3,4,5,6,7,8}; Shuffel(num); int a = num[0]; //a should not be equal to 0 int b = num[1]; //b should not be equal to 1 int c = num[2]; //c should not be equal to 2 int d = num[3]; //d should not be equal to 3 int e = num[4]; //e should not be equal to 4 Can anyone help in shuffling like this??
type: Question
linked to: http://stackoverflow.com/q/1519736
tagged with: android
has comment: http://stackoverflow.com/comment/37128133
has comment: http://stackoverflow.com/comment/37128246
duplicate of: http://stackoverflow.com/q/1519736
tagged with: java
score: -12
has comment: http://stackoverflow.com/comment/37128314
answer count: 1
has comment: http://stackoverflow.com/comment/37128342
type: UnansweredQuestion
has title: Randomly Shuffle int Array in Android/Java

http://stackoverflow.com/a/24033152
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24033027
type: Answer
answers question: http://stackoverflow.com/q/24033027
has comment: http://stackoverflow.com/comment/37049190
has comment: http://stackoverflow.com/comment/37048661
has comment: http://stackoverflow.com/comment/37049628
has comment: http://stackoverflow.com/comment/37048950
has body: The synchronized statement only causes the disp method to be executed as a whole. Since you are starting a new thread for each string, you can't control which thread gets executed first. Although the threads are being started in order, they don't complete in the same order.
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/37082896
comment on: http://stackoverflow.com/q/24051150
score: 0
type: QuestionComment
has text: So `yam yw` is one group after splitting, or would it be `yam, yw`?
type: Comment

http://stackoverflow.com/q/23993633
type: Question
has answer: http://stackoverflow.com/a/23993775
score: 0
answer count: 1
has title: How to put own jar to project(non local) repository?
has comment: http://stackoverflow.com/comment/36974609
type: UnansweredQuestion
has body: I have a jar file with source code. Our project has own Nexus repository. I want load this file to into this repository and get dependency tag for download it. Can you describe the procedure ? I want to write line in cmd
tagged with: maven
duplicate of: http://stackoverflow.com/q/8414008
tagged with: java
linked to: http://stackoverflow.com/q/8414008

http://stackoverflow.com/comment/36896623
comment on: http://stackoverflow.com/q/23951696
score: 0
type: Comment
type: QuestionComment
has text: @Thilo Im posting values from Java

http://stackoverflow.com/comment/36968613
type: Comment
type: QuestionComment
has text: @Opiatefuchs no. I even tried downloading a fresh Eclipse ADT bundle from google, and it's the same in my projects. Some work, some don't. And I can't for the life of it understand what it is.
comment on: http://stackoverflow.com/q/23989101
score: 0

http://stackoverflow.com/comment/37153370
type: QuestionComment
comment on: http://stackoverflow.com/q/24064551
score: 0
has text: You need to create an executable jar by including a "Class-Path" entry in your jar's manifest. For an example see: http://stackoverflow.com/questions/3143567/cannot-find-main-class-in-file-compiled-with-ant/3144290#3144290
type: Comment

http://stackoverflow.com/a/24026404
answers question: http://stackoverflow.com/q/24026333
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: public enum MyClassRegistry { MyClass(1,com.example.MyClass); private int typeId; private Class&lt;? extends SomeInterface&gt; theClass; MyClassRegistry(int typeId, Class&lt;? extends SomeInterface&gt; theClass) { this.typeId = typeId; this.theClass = theClass; } }
score: 2
accepted answer of: http://stackoverflow.com/q/24026333
upvote count: 2

http://stackoverflow.com/a/32642684
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: public void sendFriendRequest(String skypeId) throws SkypeException { Skype.getContactList().addFriend(skypeId, "Confirmation message here, etc! :D"); } it should be on line 198 on - https://github.com/taksan/skype-java-api/blob/master/src/main/java/com/skype/ContactList.java Just realize that its a different Skype-API. Sorry.
answers question: http://stackoverflow.com/q/24008697

http://stackoverflow.com/comment/37187760
type: Comment
type: QuestionComment
score: 0
has text: You might try using something like this to capture your desktop window - [JCropFrame](http://java-articles.info/articles/?p=76).
comment on: http://stackoverflow.com/q/24104636

http://stackoverflow.com/comment/36884994
score: 0
has text: When the OP builds their application, this code will no longer work. The `src` folder will not exist when the program is built. Resources contained within the context of application (those included within the applications Jar for example) need to be loaded differently
type: Comment
comment on: http://stackoverflow.com/a/23945094
type: AnswerComment

http://stackoverflow.com/comment/37026189
type: QuestionComment
has text: If this isn't for a class project and you're trying to make a website specifically in java, I would try reading into the Spring framework. You can download a plugin for eclipse and get a well - programmed starting point for one! Otherwise if you are feeling adventurous look into the play framework
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23962359

http://stackoverflow.com/comment/37101094
has text: What do you mean with "flickering" and why is this a problem?
score: 0
comment on: http://stackoverflow.com/q/24058030
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37143446
has text: after cleaning the project logcat generate the same errors. please see the updated manifest and logcat errors
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24083995
type: Comment

http://stackoverflow.com/q/24014434
has comment: http://stackoverflow.com/comment/37018244
score: 0
tagged with: jdbc
tagged with: spring-jdbc
accepted answer: http://stackoverflow.com/a/24017026
has comment: http://stackoverflow.com/comment/37018821
tagged with: spring
type: Question
type: AnsweredQuestion
has body: I am using Spring Integration in my project. As per my requirement, I have to call two stored procedures simultaneously. Here is my code: &lt;int:service-activator ref="msgHandler" method="buildRequestBasedDataSource" /&gt; &lt;int-jdbc:stored-proc-outbound-gateway id="PQIssueHistory-StoredProcedure-PQCOMMENTLOOKUP" auto-startup="true" data-source="routingDataSource" stored-procedure-name="${PQIssueHistory-StoredProcedure-PQCOMMENTLOOKUP}" skip-undeclared-results="true" ignore-column-meta-data="true" use-payload-as-parameter-source = "false" expect-single-result="true" &gt; &lt;int-jdbc:sql-parameter-definition name="P_CRDATTIM" direction="IN" type="VARCHAR" /&gt; &lt;int-jdbc:sql-parameter-definition name="P_RECORDCD" direction="IN" type="VARCHAR" /&gt; &lt;int-jdbc:sql-parameter-definition name="P_CRNODE" direction="IN" type="VARCHAR" /&gt; &lt;int-jdbc:parameter name="P_CRDATTIM" expression="#xpath(payload, '//CRDATTIM')" /&gt; &lt;int-jdbc:parameter name="P_RECORDCD" expression="#xpath(payload, '//RECORDCD')" /&gt; &lt;int-jdbc:parameter name="P_CRNODE" expression="#xpath(payload, '//CRNODE')" /&gt; &lt;int-jdbc:returning-resultset name="rowMapper" row-mapper="com.dsths.cs.awd.utils.ResultSetRowMapper"/&gt; &lt;/int-jdbc:stored-proc-outbound-gateway&gt; &lt;int:service-activator ref="msgHandler" method="buildMessageFromExtSysResponseTestOne" /&gt; &lt;int:header-enricher default-overwrite="true" should-skip-nulls="true" &gt; &lt;int:header name="${headerNames.originalPayload}" expression="payload" /&gt; &lt;/int:header-enricher&gt; &lt;/int:chain&gt; &lt;int:channel id="test" /&gt; &lt;int:chain input-channel="test" output-channel="PQIssueHistory-XsltTransformInputChannel" &gt; &lt;int-jdbc:stored-proc-outbound-gateway id="PQIssueHistory-StoredProcedure-PQHISTORYLOOKUP" auto-startup="true" data-source="routingDataSource" stored-procedure-name="${PQIssueHistory-StoredProcedure-PQHISTORYLOOKUP}" skip-undeclared-results="true" ignore-column-meta-data="true" use-pay…
tagged with: spring-integration
has comment: http://stackoverflow.com/comment/37018954
tagged with: java
has title: Uncategorized SQLException for SQL
has comment: http://stackoverflow.com/comment/37020493
has comment: http://stackoverflow.com/comment/37020686
answer count: 2
has answer: http://stackoverflow.com/a/24017026
possible better answer: http://stackoverflow.com/a/24599435
has comment: http://stackoverflow.com/comment/37020898
has answer: http://stackoverflow.com/a/24599435

http://stackoverflow.com/comment/119635129
score: 0
comment on: http://stackoverflow.com/a/24098805
type: Comment
has text: @Holger I am surprised you are saying this, because there is in fact a big difference. `foo(myAnonymousInnerClassInstanceImplementingMyInterface);` will receive the same instance each time it is called. However, as Java currently works, (as of Java 16 today,) `foo(this::myMethodImplementingMyInterface);` will receive a different instance each time it is called.
type: AnswerComment

http://stackoverflow.com/q/24096532
favorite count: 0
has comment: http://stackoverflow.com/comment/37174796
has title: How to use multiple ArgumentCaptor parameter
type: UnansweredQuestion
has body: When I use more than 1 ArgumentCaptor parameter I receive a Nullpointer. May be anyone has an idea what goes wrong? @RunWith(PowerMockRunner.class) @PrepareForTest(FileHelper.class) public class MyTest { ... @Before public void setUp() throws Exception { PowerMockito.mockStatic(FileHelper.class); } @Test public void save() throws Exception { ArgumentCaptor&lt;String&gt; argName = ArgumentCaptor.forClass(String.class); ArgumentCaptor&lt;List&gt; argList = ArgumentCaptor.forClass(List.class); PowerMockito.doNothing().when(FileHelper.class, "saveTextFile", argName.capture(), argList.capture()); ... } The saveTextFile methods in the FileHelper class: public static void saveTextFile(String filename, List&lt;String&gt; data) { ... } If I run the code I get this exception: java.lang.NullPointerException at java.lang.Class.isAssignableFrom(Native Method) at org.powermock.reflect.internal.WhiteboxImpl.checkIfParameterTypesAreSame(WhiteboxImpl.java:2432) at org.powermock.reflect.internal.WhiteboxImpl.getMethods(WhiteboxImpl.java:1934) at org.powermock.reflect.internal.WhiteboxImpl.getBestMethodCandidate(WhiteboxImpl.java:1025) at org.powermock.reflect.internal.WhiteboxImpl.findMethodOrThrowException(WhiteboxImpl.java:948) at org.powermock.reflect.internal.WhiteboxImpl.doInvokeMethod(WhiteboxImpl.java:882) at org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:859) at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:466) at org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl.when(PowerMockitoStubberImpl.java:106) If I call a method that has only one argument, i.e. the list argument everything works fine.
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/37206601
tagged with: java
linked to: http://stackoverflow.com/q/17695356
type: Question
score: 5
tagged with: mockito
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/28115494
answer count: 1
tagged with: junit

http://stackoverflow.com/q/23971149
type: Question
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/36933172
has comment: http://stackoverflow.com/comment/36932944
score: -1
has title: Handle sqlite database in searching
tagged with: android-sqlite
downvote count: 1
answer count: 1
has body: in my app searchbar is there, wheren in user types the text. Whenever a text get changes in the filed i will call a query to DB to get the related search items. But sometimes it crashes. Here is the code i'm doing to call DB @Override public boolean onQueryTextChange(String newText) { // TODO Auto-generated method stub if(newText.trim().equals("")) { return false; } //showSearchSuggestions(newText); mfilterdata = mController.get_controllerObj().getDBManager().getAllSuggestedFilter(newText); if(mSearchadapter != null) mSearchadapter.swapCursor(mfilterdata); return false; } Here is how i m querying in DB manager public Cursor getAllSuggestedFilter(String filterString) { String READ_QUERY = "SELECT * FROM " + Tbl_ITEM_TABLE + " where "+ item.TITLE + " Like" + "\"%" + filterString + "%"+"\""; if(mcursorForFilter != null) { mcursorForFilter.close(); mcursorForFilter = null; } try { mcursorForFilter = getReadableDatabase().rawQuery(READ_QUERY, null); } catch(Exception ee) { } return mcursorForFilter; } randomly i get exception like java.lang.IllegalStateException: attempt to re-open an already-closed object: android.database.sqlite.SQLiteQuery (mSql = SELECT * FROM itemtable where title Like"%t%")
tagged with: java
type: UnansweredQuestion
tagged with: cursor
upvote count: 0
has answer: http://stackoverflow.com/a/23973069
has comment: http://stackoverflow.com/comment/36933092
favorite count: 0

http://stackoverflow.com/a/24072127
upvote count: 4
has body: When you use byte[] packet2 = packet.getBytes() you are converting the string based on the default encoding, which could be UTF-8, for example. That's fine. But then you convert the ciphertext back to a string like this: return packet = new String(encrypted) and this can get you into trouble if this does not round-trip to the same byte array later in decrypt() with another byte[] packet2 = packet.getBytes(). Try this instead: return packet = new String(encrypted, "ISO-8859-1"), and byte[] packet2 = packet.getBytes("ISO-8859-1") -- it's not what I would prefer, but it should round-trip the byte arrays.
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24066679

http://stackoverflow.com/comment/37167843
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24097059
has text: [Not according to the docs](http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html). (Obviously, that doesn't prevent someone from writing an implementation that *does* return `null`, but that would be a violation of the interface.)

http://stackoverflow.com/a/23953408
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23953358
has body: Object choices is never initialized. In Java, objects must be initialized before you can use them. That's why an attempt to call choices.add(choice) yields such an exception. It is often a good idea to initialize member objects in constructors. In this case, it looks like you should write a constructor for ChoiceQuestion and initialize your choices ArrayList there. class ChoiceQuestion extends Question { private ArrayList&lt;String&gt; choices; ChoiceQuestion(){ choices = new ArrayList&lt;&gt;(); } //...
has comment: http://stackoverflow.com/comment/36899521
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23953358

http://stackoverflow.com/a/24028619
answers question: http://stackoverflow.com/q/24026003
accepted answer of: http://stackoverflow.com/q/24026003
score: 0
has body: Annotations only exist when the text editor is open, so they're best used for exclusively in-editor features, such as identifying spelling mistakes. Markers are automatically represented by MarkerAnnotations when the editor is reopened. See https://www.eclipse.org/articles/Article-Mark%20My%20Words/mark-my-words.html for how to work with Markers.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23951975
answer count: 4
has comment: http://stackoverflow.com/comment/36896842
has answer: http://stackoverflow.com/a/23953970
score: 0
has answer: http://stackoverflow.com/a/23952462
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/36896844
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/36896999
has body: I was wondering if there was a way to reduce code redundace inside a simple java method. I've been running lately into issues like the following: public String myMethod() { String errorMsg = null; //Do bunch of stuff, that might set errorMsg if (errorMsg != null) { return errorMsg + somethingElse; } //Do bunch of stuff, that might set errorMsg if (errorMsg != null) { return errorMsg + somethingElse; } //Do bunch of stuff, that might set errorMsg if (errorMsg != null) { return errorMsg + somethingElse; } } Would there be a way to maybe only write the redundant code once? Possibly write a method that would return the caller method? Or is this just a bad design? Ovsiouly there is a lot of maintenance with this code, is there a better way?
has answer: http://stackoverflow.com/a/23952459
type: UnansweredQuestion
has title: Redundant code inside a method in java
has answer: http://stackoverflow.com/a/23952061

http://stackoverflow.com/q/24005108
accepted answer: http://stackoverflow.com/a/24253014
tagged with: struts2
has comment: http://stackoverflow.com/comment/37220240
tagged with: hibernate3
linked to: http://stackoverflow.com/q/15269786
has body: First of all the final purpose is that i'm trying to inject a DAO connection into an SMD context (Ajax) so i'll ensure that transactions are being Commited (or Rollback), my problem is that i'm not being able to know if the invoke() method throws an exception, I have the following Interceptor: public class SomeInterceptor implements Interceptor { private static final long serialVersionUID = 1L; @Override public String intercept(ActionInvocation invocation) { String result = ""; GenericDAO dao = new GenericDAO(); try { dao.begin(); invocation.getInvocationContext().put("contextDao", dao); result = invocation.invoke(); //attempt to solve Object exception = invocation.getInvocationContext().getValueStack().findValue("exception"); if (exception != null && exception instanceof Exception){ dao.rollback(); } else { dao.commit(); } } catch (Exception ex) { dao.rollback(); System.out.println("ROLLBACK!"); ex.printStackTrace(); } finally { dao.close(); } return result; } } The line "attempt to solve" is based on this question. Inside the invoke i'm just throwing a NullPointerException, the result right now is that the exception is being catch before the catch at the Interceptor, however is not a catch that i had set, @SMDMethod public HashMap<String,String> someMethod() { IGenericDAO dao = (IGenericDAO) ActionContext.getContext().get("contextDao"); //dao's deletes, updates that i want to rollback HashMap<String,String> x = null; x.put("x","x"); //<---- NPE! return null; } I want ActionInvocation.invoke() to throw the exception so i'll know i need to rollback the DB session. Any approach who succeed this purpose is welcome, Edit 1: I've found this question that does almost the same as me but i dont understand how is using rollback (at my point of view is always doing rollback) Greetings
favorite count: 0
tagged with: interceptor
tagged with: smd
upvote count: 1
has title: How to get exception inside ActionInvocation.invoke()
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/10313279
has answer: http://stackoverflow.com/a/24253014
type: Question
has comment: http://stackoverflow.com/comment/37095964
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24043840
has body: The javax.tools package provides a Java-based interface to the Java compiler from your JDK (JavaCompiler). JavaCompiler uses a JavaFileManager's methods to find and access the source files to be compiled. The StandardFileManager (used by default) offers a getJavaFileObjectsFromFiles() method that provides iteration over all java files found in a given root. The links above will take you to the JDK sources (in case you actually want to roll your own version after modifying those sources, read this); and to the JavaDoc for StandardFileManager.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24042456
type: Answer
answers question: http://stackoverflow.com/q/24042456

http://stackoverflow.com/a/23990661
has comment: http://stackoverflow.com/comment/36973589
has comment: http://stackoverflow.com/comment/36974332
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36974205
has comment: http://stackoverflow.com/comment/36985948
has comment: http://stackoverflow.com/comment/36973144
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/36982692
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23990510
has body: There is no such implementation in the JDK. Your best bet here is to use composition: public final class CustomMap&lt;K, V&gt; implements Map&lt;K, V&gt; { private final Map&lt;K, V&gt; delegate; public CustomMap(final Map&lt;K, V&gt; delegate) { this.delegate = delegate; } @Override public V put(final K key, final V value) { // Can't use the return value of delegate.put(), since some implementations // allow null values; so checking delegate.put() == null doesn't work if (delegate.containsKey(key)) throw new IllegalArgumentException("duplicate key: " + key); return delegate.put(key, value); } @Override public void putAll(@Nonnull final Map&lt;? extends K, ? extends V&gt; m) { for (final Entry&lt;? extends K, ? extends V&gt; entry: m.entrySet()) put(entry.getKey(), entry.getValue()); } // delegate all other methods } Otherwise, as others suggested, if you use Guava, use ForwardingMap; this is essentially a generalized version of the above code. In fact, do use Guava. other note: you can't just // throws some exception here; Map's .put() doesn't declare to throw any exception, so your only option is to throw an unchecked exception here.
has comment: http://stackoverflow.com/comment/36984877
has comment: http://stackoverflow.com/comment/36994125
answers question: http://stackoverflow.com/q/23990510
has comment: http://stackoverflow.com/comment/36982390
upvote count: 13
has comment: http://stackoverflow.com/comment/36985903

http://stackoverflow.com/comment/36891849
has text: a) what have you tried? b) what is your code? c) what is the problem?
comment on: http://stackoverflow.com/q/23948922
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/24005353
upvote count: 1
type: Question
has body: I am trying to open a dialog when a button is clicked. The dialog basically lists few items, which it gets from a database. And so I am running an AsynTask to get the items from the database and then I call setAdapter to list them in the dialog. But I always get a nullPointerException. I am new to Android programming and I may be doing something wrong. Can someone please help me. Following is my code : public class nextPub extends ActionBarActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_next_pub); leave = (Button) findViewById(R.id.nextPub_leave_button); oslist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); leave.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { new listPubs().execute(); new PubListDialog().onCreateDialog(b).show(); } }); } private class PubListDialog extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("Which pub next ?").setAdapter(new SimpleAdapter(nextPub.this, oslist, R.layout.list_pubs, new String[]{TAG_pubname}, new int[]{ R.id.list_pubname} ), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // The 'which' argument contains the index position // of the selected item Toast.makeText(nextPub.this, "You Clicked at Pub : " + oslist.get(+which).get(TAG_pubname), Toast.LENGTH_SHORT).show(); } }); return builder.create(); } } private class listPubs extends AsyncTask&lt;String, String, JSONObject&gt; { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(nextPub.this); pDialog.setMessage("Loading Pubs.."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected JSONObject doInBackground(String... args) { // Building Parameters List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValu…
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24005396
tagged with: android-studio
has title: Why am I getting NullPointerException when I try to open a dialog in Android?
score: 1

http://stackoverflow.com/comment/37135060
score: 0
comment on: http://stackoverflow.com/a/24071366
type: AnswerComment
type: Comment
has text: @jacho981 Both your observations confuse me. Especially the second one: The invokeLater should take place at the _end_ of your update method, meaning the last line of `getNewValues()` (or equivalently as last line of the Thread's `run()` method).

http://stackoverflow.com/comment/37161704
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24093373
has text: then I stoped the program and restart it, both The InputStream from the ClassLoader and the one from the FileInputStream read the content is the same, so I can promise they read the same file.

http://stackoverflow.com/comment/37031590
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24020148
has text: I'm not sure what you mean by in the case of int or string. Do you mean `read()` vs `readLine()`? What is it you're really trying to read? If you're trying to read strings, use a `Reader/BufferedReader` as you're doing. But if you're trying to read anything else, you should use an `InputStream/BufferedInputStream`. Java draws a clear distinction between `char`s (unicode characters) and `byte`s ("raw" data). The only reason that `read()` returns an `int` rather than `char` is that it wants to return `-1` to signify the end of the stream, and `char`s in Java are unsigned (so can't be `-1`).

http://stackoverflow.com/q/24059253
has answer: http://stackoverflow.com/a/24059313
downvote count: 10
type: Question
score: -9
has answer: http://stackoverflow.com/a/24059310
has title: variable assignment syntax in java
has body: I'm trying to learn Android development and java at the same time. In this code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_layout); Button b = (Button)findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ActivityA.this, ActivityB.class); startActivity(intent); } }); } Can someone explain the Button b = ... line - is b an alias of Button, and why is the (Button) before findViewById?
has answer: http://stackoverflow.com/a/24059329
has comment: http://stackoverflow.com/comment/37097198
has answer: http://stackoverflow.com/a/24059322
has answer: http://stackoverflow.com/a/24059351
has answer: http://stackoverflow.com/a/24059352
answer count: 7
possible better answer: http://stackoverflow.com/a/24059322
has comment: http://stackoverflow.com/comment/37097503
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24059376
upvote count: 1
accepted answer: http://stackoverflow.com/a/24059351
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24009849
has body: What is the best way to overcome Same Origin Policy in Ajax calls with spring MVC Rest service? Is it adding header values or using JSONP? How to Map a request with both RequestParam and PathVariable in Spring Mvc REST? @RequestMapping(value = "/getstudent/{userId}", method = RequestMethod.GET) public @ResponseBody Student getStudent(@PathVariable String userId, @RequestParam("callback") String callback) { StudentRegister studentRegister = new StudentRegister(); return studentRegister.getStudent(userId); }
tagged with: spring-mvc
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24010102
tagged with: same-origin-policy
tagged with: cors
answer count: 1
tagged with: ajax
score: 0
has title: Spring MVC, Ajax and Same Origin Policy
type: UnansweredQuestion

http://stackoverflow.com/a/24075360
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24074164
has comment: http://stackoverflow.com/comment/50369831
has comment: http://stackoverflow.com/comment/41568126
upvote count: 61
has comment: http://stackoverflow.com/comment/89438398
type: Answer
score: 61
has comment: http://stackoverflow.com/comment/68313364
has comment: http://stackoverflow.com/comment/58308925
has comment: http://stackoverflow.com/comment/41578627
has body: Is MetaSpace by default is GC collected? Yes, GC will run on metaspace when its getting full, it would also dynamically increase (given its allowed to) the memory allocated for metadata. Even the PermGen is GC collected by adding the args like -XX:+CMSClassUnloadingEnabled, then what makes MetaSpace better than PermGen? The improvement is with the dynamic expansion of the metaspace which is something permgen wasn't able to do. MetaSpace is based on native memory, so it keeps the java objects on the disks rather than on VM? Based on the description of metaspace, it only uses the native memory (no paging). Based on the research by Pierre - Hugues Charbonneau (link here), it's clear that the introduction of metaspace doesn't necessarily solve the OOM issue, it's a bandaid to the problem at best, it attempts to dynamically resize the metaspace memory to accomodate the growing number of classes which get loaded with a possible side effect of growing uncontrollably (so long as the native memory permits it). We can achieve the famed OOM error by setting the MaxMetaspaceSize argument to JVM and running the sample program provided. many thanks to Pierre - Hugues Charbonneau.
answers question: http://stackoverflow.com/q/24074164

http://stackoverflow.com/q/24104738
favorite count: 0
tagged with: exception
type: UnansweredQuestion
tagged with: android
has body: Hi I am making a chat application however when I try to update the view with the received string I get an CalledFromWrongThreadException, however it worked earlier, and my understanding of the handler is that it is created exactly for calls from another thread. public class ChatActivity extends ActionBarActivity { ServerSocket serverSocket; Thread listenThread; Thread sendThread; Socket socket = null; String strIP = ""; volatile String error; final static int port = 6000; TextView chatView; TextView errorView; volatile static String rcv = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } if (socket == null) { try { this.listenThread = new Thread(new Listener()); this.listenThread.start(); } catch (Exception e) { } } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.chat, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } else if (id == R.id.action_connectIP) { Intent intent = new Intent(this, ConnectActivity.class); startActivityForResult(intent, 1); } return super.onOptionsItemSelected(item); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == 1) { if (requestCode == 1) { if (data.hasExtra("IP")) strIP = data.getExtras().getString("IP"); Toast.makeText(this, strIP, Toast.LENGTH_LONG).show(); // luk for at forhindre flere i at forbinde try { serverSocket.close(); } catch (IOExc…
answer count: 0
score: 1
has title: android CalledFromWrongThreadException
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37184265
type: Question
has comment: http://stackoverflow.com/comment/37183220
has comment: http://stackoverflow.com/comment/37183255
downvote count: 0

http://stackoverflow.com/comment/36974857
has text: Yeah I know that even when you don´t use @Transaction annotation, the DB creates a transaction for every operation (even SELECT queries). My question was about if it was needed to write the annotation in my code.
type: AnswerComment
comment on: http://stackoverflow.com/a/23989908
score: 0
type: Comment

http://stackoverflow.com/comment/37075493
score: 0
type: AnswerComment
has text: you could do:insert into OutStream select * from pattern[a=A ... b=B..] , then "select *, a.xyz from OutStream..."
comment on: http://stackoverflow.com/a/24046040
type: Comment

http://stackoverflow.com/a/23991827
has comment: http://stackoverflow.com/comment/36972332
type: Answer
score: 1
upvote count: 1
has body: I like to handle this by using a custom Application class. For example: public class Helper extends Application { private Context mContext; public void onCreate() { super.onCreate(); mContext = this; } public Context getContext() { return mContext; } } This way you can get the context of the application every time you need it.
has comment: http://stackoverflow.com/comment/36971501
answers question: http://stackoverflow.com/q/23991613
downvote count: 0

http://stackoverflow.com/a/24050904
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/24007824
has body: You can acces the API of TFS, but it's not the best way to do. If you want just get the to work and back to repository, a normal cycle of development, you can use the command line! To get the entire workspace: tf get To commit/checkin edited code: tf checkin /comment:"New version of API" You found the help commands of the tool in: Use Team Foundation version control commands
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37132426
downvote count: 0
answers question: http://stackoverflow.com/q/24007824
type: Answer

http://stackoverflow.com/comment/37166305
has text: IMHO wrong site: Please try asking this on http://superuser.com
comment on: http://stackoverflow.com/q/24096281
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23989965
has title: How to access Window Phone drive path in java to read and write on phone drive
tagged with: java
has answer: http://stackoverflow.com/a/23990070
answer count: 1
has body: I am developing an app in java in which i have to excess my window phone drive. I want to be able to read and write on window phone through my java program. Problem: My problem is , i cannot find the path to my window phone device on windows. window is not assigning any drive letter to phone drive, rather than this , window is showing the path something like (Computer\Windows Phone\Phone\Videos). And when i use that path in my java program then file not found exception is raised which means that i cannot excess that folder (Videos) using that path (Computer\Windows Phone\Phone\Videos) . i have visited the following links Portable Device Path on Windows Getting Portable Devices using java Both links did not work for me. Obviously there are some libraries like libmtp , jmtp and jusbpmp out there but all these are buggy, and i do not want to use these libraries. My question is that how can i get the path to the window phone drive using which i can read and write on window phone in java..... ? Is there any way to assign Window fone a drive letter so that my java can locate that drive ? I have tried to get that path from registory and device manager also but in vain. I also tried to read Win32_USBHub database but that also didn't bring the solution. Guide me to right direction. Thanks
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2481300
type: Question
upvote count: 1
linked to: http://stackoverflow.com/q/12775528

http://stackoverflow.com/comment/37147994
comment on: http://stackoverflow.com/a/24083829
score: 0
type: AnswerComment
type: Comment
has text: @Ipratlong yes! i wanted to add some zeros to number, then convert it to int and still be able to see the added zeros.e.g(00000144) so that i can be able to covert the number again to string, get the substring starting at index 2(which is zero) to index 5(which is 1) convert it to int and squre it. somthing like that. let me update my question

http://stackoverflow.com/q/24008657
has comment: http://stackoverflow.com/comment/37004166
has comment: http://stackoverflow.com/comment/37003239
has title: Regex to replace a repeating string pattern
tagged with: regex
upvote count: 4
has comment: http://stackoverflow.com/comment/37003408
possible better answer: http://stackoverflow.com/a/24008759
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37003296
tagged with: java
has comment: http://stackoverflow.com/comment/37003207
has comment: http://stackoverflow.com/comment/37003135
has answer: http://stackoverflow.com/a/24008759
has body: I need to replace a repeated pattern within a word with each basic construct unit. For example I have the string "TATATATA" and I want to replace it with "TA". Also I would probably replace more than 2 repetitions to avoid replacing normal words. I am trying to do it in Java with replaceAll method.
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37003766
score: 4
has comment: http://stackoverflow.com/comment/37003260
has comment: http://stackoverflow.com/comment/37003450
has comment: http://stackoverflow.com/comment/37003063
answer count: 3
tagged with: replaceall
has comment: http://stackoverflow.com/comment/37003168
tagged with: string
has comment: http://stackoverflow.com/comment/37003525
has comment: http://stackoverflow.com/comment/37003098
favorite count: 0
tagged with: pattern-matching
has answer: http://stackoverflow.com/a/24009129
accepted answer: http://stackoverflow.com/a/24009129
has answer: http://stackoverflow.com/a/24008780

http://stackoverflow.com/comment/37119545
score: 0
type: Comment
has text: DataOutputStream wr; for(int i=0; i<trades.size(); i++){ con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Accept-Language", "en-US,en;q=0.8"); con.setRequestProperty("Cookie", cookie); con.setDoOutput(true); wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes("trade=" + trades.get(i) + "&code=" + code); wr.flush(); wr.close(); System.out.println(i); }
type: AnswerComment
comment on: http://stackoverflow.com/a/24052803

http://stackoverflow.com/q/24005223
score: 1
tagged with: serialization
type: Question
tagged with: file-io
has answer: http://stackoverflow.com/a/24816144
type: AnsweredQuestion
favorite count: 0
possible better answer: http://stackoverflow.com/a/24816144
accepted answer: http://stackoverflow.com/a/24816129
answer count: 2
tagged with: file
has body: If I'm using the serialization proxy pattern, should I provide a custom writeObject method for the containing class, or just the proxy? Should I even use a custom form for the proxy? I've read the chapter from Effective Java about Serialization, but it wasn't clear about custom forms and the proxy pattern.
upvote count: 1
tagged with: java
has title: Serialization Proxy With Custom Form?
has answer: http://stackoverflow.com/a/24816129
downvote count: 0

http://stackoverflow.com/comment/37151195
has text: ... And you shouldn't call `setVisible(true)` before adding all components. Only call this after adding all components. Again, create and post your [minimal example program](http://stackoverflow.com/help/mcve) if you are seriously in need of help.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24088094

http://stackoverflow.com/comment/56700062
type: QuestionComment
comment on: http://stackoverflow.com/q/24054968
score: 0
type: Comment
has text: In general cross-posting at the same time is generally frowned upon. However if you choose to do it anyway, please add a link of the other locations of your question in all copies. This is helpful for later answers to check that your question has not been answered elsewhere prior to writing an answer, and it is helpful for future readers to find more answers should any particular instance of the question not have attracted answers the reader finds useful.

http://stackoverflow.com/a/23980921
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: There are different ways of printing two newlines: Write an empty print statement twice or more: System.out.println(); System.out.println(); System.out.print( "\n\n\n" ) Use a loop in case you want to use a single println and even without using /n: public void foo(int n) { if (n &gt; 3) return; println(currNum); foo(n+1); }
answers question: http://stackoverflow.com/q/23980834

http://stackoverflow.com/a/24012676
has body: i am not able to reproduce the behaviour using the following: public static String decToBin(int n) { StringBuilder result = new StringBuilder(); while (n &gt; 0) { int dec = n % 2; result.append(dec); n = n / 2; } return result.reverse().toString(); } however, consider using the build-in public static String decToBin(int n) { return Integer.toBinaryString(n); } (or even BigInteger as stated above)
score: 0
answers question: http://stackoverflow.com/q/24012430
type: Answer

http://stackoverflow.com/q/24083528
favorite count: 0
upvote count: 5
type: UnansweredQuestion
downvote count: 4
tagged with: oop
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24083700
has title: Separation of concern vs encapsulation vs loose coupling vs spaghetti code
linked to: http://stackoverflow.com/q/226977
type: Question
has body: What's the exact meaning and relation between these terms. It looks like many people confuse them a lot. My idea is that separation of concern is what you get with encapsulation. Loose coupling is in some blog confused with separation of concerns, wheras in other is just a separation as components that do not know each other. Spaghetti code is tangled code. So not following the 3 above concepts can lead to spaghetti code. Is it correct?
tagged with: encapsulation
answer count: 1
has comment: http://stackoverflow.com/comment/37141898

http://stackoverflow.com/comment/37126411
type: QuestionComment
has text: You will be suprised how easy you can do it without ImageViews only by drawing Bitmaps by yourself, its gonna be much faster too
comment on: http://stackoverflow.com/q/24074659
score: 0
type: Comment

http://stackoverflow.com/comment/62788194
has text: Do you get this error regardless of what (trivial) pig code you try to run?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24091016
type: QuestionComment

http://stackoverflow.com/q/24060455
has title: 16 bit Rotate Left and Right for Java
has answer: http://stackoverflow.com/a/24061389
has body: I have tried to search for circular rotate left and circular rotate right for 16 bits of data (not the 8 bit ones) in Java but most circular rotates I can find handles 8 bits of data. How do I perform 16 bits of circular rotate left and right in Java ? Thanks. Below are my current codes that do not work: public byte[] rotr(byte[] input, int shift) { int output = (binToInt(input) &lt;&lt; shift) | (binToInt(input) &gt;&gt; (16 - shift)); return BigInteger.valueOf(output).toByteArray(); } public int binToInt(byte[] b) { return new BigInteger(b).intValue(); } public String byteToHex(byte b) { char hexDigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; char[] array = {hexDigit[(b &gt;&gt; 4) &amp; 0x0f], hexDigit[b &amp; 0x0f]}; return new String(array); } public String byteArrayToHex(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; bytes.length; i++) { sb.append(byteToHex((byte) bytes[i])); } return sb.toString(); } public static void main(String[] args) { byte[] out = rotr(new byte[] {(byte) 0x97, (byte) 0xA1}, 7); System.out.println(byteArrayToHex(out)); } Hex (0x97A1) bit string: 1001011110100001 After attempted rotr-7: 11001011; Excepted bit string: 1101000011001011 (0xD0CB)
tagged with: java
has comment: http://stackoverflow.com/comment/37099875
type: Question
has comment: http://stackoverflow.com/comment/37099287
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: bit-manipulation

http://stackoverflow.com/q/24010920
score: 0
duplicate of: http://stackoverflow.com/q/10882952
has comment: http://stackoverflow.com/comment/37007329
has body: I'm writing a Java program for school (so: strict rules to it...) to graphically visualize mathematical function (like Sin, Cosine and Tangent, to make an example). I have two interfaces: Function and DifferentiableFunction, and every mathematical function is stored in a class that extends Function or DifferentiableFunction. When I launch the program, I have a textfield in which I need to write the name of the mathematical function (they will be added by the professor as a test) and my idea is to be able to reference the class name by the Text Field input. The problem is: after days of searching, I really don't know how to do this thing, or even if it is possible. Please help me, I'm stuck and the deadline is near!
has comment: http://stackoverflow.com/comment/37008068
has comment: http://stackoverflow.com/comment/37007271
has comment: http://stackoverflow.com/comment/37007200
has comment: http://stackoverflow.com/comment/37007507
accepted answer: http://stackoverflow.com/a/24011059
tagged with: jtextfield
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: class
has title: How can I use a Java Text Field as input for a class name?
answer count: 1
linked to: http://stackoverflow.com/q/10882952
has answer: http://stackoverflow.com/a/24011059

http://stackoverflow.com/a/24020063
upvote count: 2
answers question: http://stackoverflow.com/q/24019427
has body: I think there is a problem about the relationship. You have to map entities, not specific columns of them. I suggest the following construct: @Entity @Table(name = "STYLE") public class Style implements IterableById, Serializable { ... @OneToMany(fetch = FetchType.LAZY, mappedBy = "style", cascade=CascadeType.ALL, orphanRemoval = true) private Set&lt;Attribute&gt; attributes; ... And the attribute: @Entity @Table(name="ATTRIBUTE") public class Attribute{ ... @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "PRODUCT_ID", nullable = false) protected Style style; ... There is no explicit ID for the referenced parent entity Style. Hibernate resolve it to its entity. Why do you use such a complicated ID in your attribute class? B.T.W.: By default there is no deterministic order for child entities, so you should better use a Set instead of List
has comment: http://stackoverflow.com/comment/37051353
downvote count: 0
type: Answer
score: 2

charts
tags question: http://stackoverflow.com/q/23979907
type: Tag
tags question: http://stackoverflow.com/q/24082147
tag name: charts
tags question: http://stackoverflow.com/q/23998955

http://stackoverflow.com/comment/37107659
has text: Thanks for reply. Config Browser Plugin only get S2 configuration, can't help me this action is really used my system. I mean can trace from index page.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24039570
score: 0

http://stackoverflow.com/a/23996868
has body: The problem is not the XML preamble. It fails even if you remove that completely. I did a little experimenting and the culprit was this: &lt;g clip-path="url(http://127.0.0.1:8888/ChartTest.html?gwt.codesvr=127.0.0.1:9997#_ABSTRACT_RENDERER_ID_0)"&gt; It is trying to reference a clip path at another URL. Batik doesn't like it. If you change that to just a simple: &lt;g&gt; the file seems to render fine.
has comment: http://stackoverflow.com/comment/36990409
type: Answer
answers question: http://stackoverflow.com/q/23996145
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/24098444
upvote count: 1
type: Answer
has body: Don't write your own validator. Email has been around for decades and there are many standard libraries which work, address parts of the standard you may not know about, and are well tested by many other developers. Apache Commons Email Validator is a good example. Even if you use a standard validator you need to be aware of the limitations or gotchas in validating an email address. Here are the javadocs for Commons EmailValidator which state, "This implementation is not guaranteed to catch all possible errors in an email address. For example, an address like nobody@noplace.somedog will pass validator, even though there is no TLD "somedog"" . So you can use a good email validator to determine if an address is valid, but you will have to do extra work to guarantee that the domain exists, accepts email, and accepts email fro that address. If you require good addresses you will need a secondary mechanism. A confirmation email is a good mechanism. You send a link to the given address and the user must visit that link to verify that email can be sent to that address.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24098269

postgresql
tags question: http://stackoverflow.com/q/23999851
tags question: http://stackoverflow.com/q/23949396
tags question: http://stackoverflow.com/q/24045431
tags question: http://stackoverflow.com/q/23985604
tags question: http://stackoverflow.com/q/24067663
tags question: http://stackoverflow.com/q/24045527
tags question: http://stackoverflow.com/q/24055583
tags question: http://stackoverflow.com/q/23945908
tags question: http://stackoverflow.com/q/23948223
tag name: postgresql
tags question: http://stackoverflow.com/q/23967770
tags question: http://stackoverflow.com/q/24012311
tags question: http://stackoverflow.com/q/23948593
tags question: http://stackoverflow.com/q/23979524
type: Tag
tags question: http://stackoverflow.com/q/24075534
tags question: http://stackoverflow.com/q/24035743
tags question: http://stackoverflow.com/q/24082890
tags question: http://stackoverflow.com/q/23950559
tags question: http://stackoverflow.com/q/23993065

http://stackoverflow.com/q/23976012
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37613086
tagged with: jersey
has answer: http://stackoverflow.com/a/23987668
has body: I'm attempting to add a method to an existing Jersey Rest service to take a post of a list of objects. It doesn't like the way I'm doing it, or I'm missing a dependency or something... any help is appreciated. Service markup: @POST @Consumes({ MediaType.APPLICATION_JSON }) public boolean update(@HeaderParam("Authorization") String token, @FormParam("photos") ArrayList&lt;UiPhoto&gt; uiPhotos) { Errors: SEVERE: The following errors and warnings have been detected with resource and/or provider classes: SEVERE: Missing dependency for method public boolean com.creo.services.PhotoService.update(java.lang.String,java.util.ArrayList) at parameter at index 1 SEVERE: Method, public boolean com.creo.services.PhotoService.update(java.lang.String,java.util.ArrayList), annotated with POST of resource, class com.creo.services.PhotoService, is not recognized as valid resource method. This compiles, but a request to method on the service blows up with these errors.
has title: Jersey consuming JSON on POST
tagged with: post
tagged with: arraylist
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23976090
linked to: http://stackoverflow.com/q/14075422
tagged with: rest

http://stackoverflow.com/comment/37175306
type: Comment
type: QuestionComment
score: 2
has text: 'with' is the Spawn of Satan.
comment on: http://stackoverflow.com/q/24092731

http://stackoverflow.com/comment/37110194
type: Comment
has text: Alright, but this may help someone else with a similar question but thanks for letting me know.
comment on: http://stackoverflow.com/a/24065623
score: 0
type: AnswerComment

http://stackoverflow.com/a/23975456
has comment: http://stackoverflow.com/comment/36941696
has comment: http://stackoverflow.com/comment/36940500
has body: BufferedImage extends Image, so you can cast it: BufferedImage buffered = (BufferedImage) image; But you must check the type of your image object in runtime, because it can contain other kind of Image. UPDATE To convert an Image to a BufferedImage you should check this class and try it: http://www.dzone.com/snippets/converting-images
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/36940458
answers question: http://stackoverflow.com/q/23975388
type: Answer
score: -1

http://stackoverflow.com/q/24040997
type: Question
has body: I am creating a Powerpoint presentaion(s) with apache poi xslf library. I need to create a Autoshape and when click on the autoshape it should go to the specific slide. I can do this by adding text to the autoshape and creating a hyperlink like below. XMLSlideShow ppt = new XMLSlideShow(); XSLFSlide slide1 = ppt.createSlide(); XSLFSlide slide2 = ppt.createSlide(); XSLFSlide slide3 = ppt.createSlide(); XSLFAutoShape sh1 = slide1.createAutoShape(); sh1.setAnchor(new Rectangle(100, 50, 100, 50)); XSLFTextRun r2 = sh1.addNewTextParagraph().addNewTextRun(); XSLFHyperlink link2 = r2.createHyperlink(); r2.setText("Go to Slide 3"); link2.setAddress(slide3); But the problem is when I create an Auto shape like this, it actually link the text and not the shape. Also when I open it from Powerpoint it show the hyperlink in blue color underlined text which I don't want. In Powerpoint, you can right click on an Autoshape and then link it to a different slide. This links the auto shape and if you click anywhere in the autoshape it takes you to the linked slide, also it does not show the text in blue underlined format. This is the effect I am trying to achieve. I need to use org.apache.poi.xslf library. I found a way to do a similar thing in org.apache.poi.hslf library. But I can't use it since I need the XSLF library for some other features. Please let me know if there is a way to do this. Thank you in Advance.
answer count: 1
tagged with: slideshow
has answer: http://stackoverflow.com/a/36127140
has comment: http://stackoverflow.com/comment/37072745
has title: Add hyperlink to apache.poi.xslf autoshape
score: 0
tagged with: apache-poi
type: UnansweredQuestion
tagged with: powerpoint
has comment: http://stackoverflow.com/comment/37117478
tagged with: java

http://stackoverflow.com/q/24100603
upvote count: 3
tagged with: java
downvote count: 2
tagged with: calendar
type: Question
has title: get month of year from Calendar class of java
answer count: 3
linked to: http://stackoverflow.com/q/38922754
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24100671
has answer: http://stackoverflow.com/a/48492304
type: UnansweredQuestion
has body: I wrote simple java program in which I get day of month, days in month and month see below code : //Calendar calendar = Calendar.getInstance(); Calendar calendar = new GregorianCalendar(); log.info("day of month: "+calendar.get(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH); log.info("days in month: "+calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); log.info("month: "+calendar.get(Calendar.MONTH)); Running above code I get this output: day of month: 7 days in month: 31 month: 2 But when I put below statement log.info("month: "+calendar.get(Calendar.MONTH)); before log.info("day of month: "+calendar.get(Calendar.DAY_OF_MONTH)); I get this output: (which is what I want) day of month: 7 days in month: 31 month: 5 Can any body help me understand why I get month: 2 ?
has comment: http://stackoverflow.com/comment/37174524
has answer: http://stackoverflow.com/a/24100629
has comment: http://stackoverflow.com/comment/84393503

http://stackoverflow.com/q/23990859
tagged with: spring
has answer: http://stackoverflow.com/a/23991905
score: 2
linked to: http://stackoverflow.com/q/6443672
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23996049
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36969461
tagged with: unique-key
answer count: 3
has comment: http://stackoverflow.com/comment/36972008
has comment: http://stackoverflow.com/comment/36971212
favorite count: 0
has body: I am using Spring+Hibernate for my application. I have a few CRUD operations. Before inserting, I need to check if a similar entry is already in the database, if yes it should not be inserted. For eg: If I am trying to create a Department, before inserting the row, I should check if a department with the same name already exist or not. If yes, the method returns error message. Now, I know the unique key constraint can be set on the column to do the check. But, I want to know if there is any other way to do this. The only way I can think of is first fetching all the departments from the database and check against each object. Please let me know if there is any other way.
has answer: http://stackoverflow.com/a/23990911
has title: Check duplicate value before insertion using Hibernate
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/37117425
comment on: http://stackoverflow.com/q/24069912
has text: check this for learning how to debug android: http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37070365
type: Comment
comment on: http://stackoverflow.com/q/24041747
has text: Within this context, I am having a hard time seeing any issues. would you mind posting the entire method or function? @wiz3kid Thanks for the info, I did not know that... I've never used the NDK.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23994276
accepted answer of: http://stackoverflow.com/q/23992797
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37000255
type: Answer
has body: You initialize all page parameters when you do document.newPage(), hence changing the page size or margins doesn't make sense after triggering document.newPage(). If you want a different page size (or orientation, or margins), you need to set the values for the page size, orientation and margins before invoking document.newPage() (and before document.open() if you want to change the first page). For instance: in your case, you should create your document like this: Document document = new Document(new Rectangle(33,33,550,770)); And you should change the page size like this: document.setPageSize(left1); document.newPage(); column.setSimpleColumn(left1); You don't have any margins because you use the same Rectangle for the page size as for the column. You are creating a PDF of which the coordinate of the lower-left corner is not equal to (0, 0). This isn't illegale, but it's unusual. My guess is that you want to do something like this: document.setPageSize(new Rectangle(0, 0, 550, 750);); document.newPage(); column.setSimpleColumn(new Rectangle(50,50,500,700)); This will result in a page size of 7.64 by 10.42 inch (550 by 750 pt) and you'll have a margin of 0 69 inches on every side (50 pt).
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23992797

http://stackoverflow.com/q/24074221
tagged with: http://stackoverflow.com/tag/html
has title: How to dynamically populate the drop down list in my JSP page from the database?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24074291
tagged with: java
has comment: http://stackoverflow.com/comment/37125008
possible better answer: http://stackoverflow.com/a/24074419
type: Question
has body: I am working with JSP and Ajax for the first time. I am trying to get one column data from database and populate it in my drop down list in my JSP page using Ajax call. I don't want to refresh the page so that is the reason, I am making aN Ajax call. Here is my jsfiddle which has Process button and as soon as I click Process button, it will show an empty drop down list as of now. This is in my another test.jsp page. I have a table as account and I need to make this select query from the jsp - SELECT USERS FROM ACCOUNT; As soon as I am clicking Process button, I need to execute above SQL query on my POSTGRESQL database using Ajax. And whatever users, I am getting back from the database, I need to populate those USERS in my drop down list as shown in my above jsfiddle. Below is my JSP page (databasecall.jsp) in which I am making a call to my database to get all the USERS - &lt;%@page contentType="text/html; charset=UTF-8" %&gt; &lt;%@ page import="java.sql.*" %&gt; &lt;% response.setContentType("application/json"); try { // Step 1. Load the JDBC driver Class.forName("org.postgresql.Driver"); // Step 2. Create a Connection object Connection con = DriverManager.getConnection( "jdbc:postgresql://localhost/test","root", "root!"); Statement s = con.createStatement(); String sql ="SELECT USERS FROM ACCOUNT"; ResultSet rs = s.executeQuery(sql); while (rs.next()) { // what to do here? } rs.close(); s.close(); con.close(); } catch (Exception e3) { e3.printStackTrace(); } %&gt; Problem Statement:- Now my question is, how do I populate all the USERS data which I got from the database in my drop down list in the test.jsp page? Meaning, somehow I need to call this JSP on the Process button click and then pass all the users data which we got and then dynamically populate the drop down list? Suppose if I am getting 10 USERS from the database, then the drop down list should have 10 users in it. Is this possible to do?
linked to: http://stackoverflow.com/q/4112686
linked to: http://stackoverflow.com/q/22550913
has answer: http://stackoverflow.com/a/24074291
has comment: http://stackoverflow.com/comment/37127859
has answer: http://stackoverflow.com/a/24074419
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/37124970
tagged with: ajax
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37141594

http://stackoverflow.com/comment/37029718
score: 0
type: Comment
type: QuestionComment
has text: Your question is too broad. However, you have clearly identified where the gap is in your knowledge, where you said *I have no idea how to get the name of a file and assign it to a scanner\bufferwriter\ect*, which is a great starting point. Split that up in to two concerns: getting the name of a file(s), and writing to / reading from text files. That should be where your research begins. Write some prototype programs to text what you find, and then put it all together and write the main program. Post back when you've encountered a question or problem that hasn't already been answered here.
comment on: http://stackoverflow.com/q/24022880

google-cloud-datastore
tags question: http://stackoverflow.com/q/23956349
tags question: http://stackoverflow.com/q/23990900
tags question: http://stackoverflow.com/q/24100635
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/24103953
tags question: http://stackoverflow.com/q/24102830
tags question: http://stackoverflow.com/q/23975070
tags question: http://stackoverflow.com/q/24053179
tags question: http://stackoverflow.com/q/24095300
type: Tag
tags question: http://stackoverflow.com/q/24061803
tags question: http://stackoverflow.com/q/24084140

http://stackoverflow.com/q/24022769
tagged with: sockets
has comment: http://stackoverflow.com/comment/37029781
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37029585
tagged with: java
type: Question
has body: I want to send a byte[] array from a java client to a server that receives the data in C++. The byte array contains characters and integers that are converted to bytes (its a wave header). The server doesn't receive the values correctly. How can I send the byte[] so that the server socket can write it to a char[]? I am using the following code: Client.java: //Some example values in byte[] byte[] bA = new byte[44]; bA[0]='R'; ... bA[4]=(byte)(2048 &amp; 0xff); ... bA[16] = 16; .... //Write byte[] on socket DataOutputStream out = new DataOutputStream(socket.getOutputStream()); out.write(bA,0,44); Server.cpp int k = 0,n = 0; char buffer[100]; ofstream wav("out.wav", ios::out | ios::binary); while(k&lt;44){//receive 44 values memset(buffer ,0 , 100); n = recv(sock , buffer , 100 , 0); k += n; buffer[99] = '\0'; wav.write(buffer,n); }
accepted answer: http://stackoverflow.com/a/24023038
tagged with: arrays
score: 0
has answer: http://stackoverflow.com/a/24023038
has title: How to send java byte[] on tcp socket to c++ char[] on server?
answer count: 1
has comment: http://stackoverflow.com/comment/37029529

http://stackoverflow.com/comment/37088489
has text: Read my post here [Why Date is not Serializing in GWT 2.6?](http://stackoverflow.com/questions/23824835/why-date-is-not-serializing-in-gwt-2-6?answertab=votes#tab-top). It might help you.
type: Comment
comment on: http://stackoverflow.com/q/24054410
score: 1
type: QuestionComment

http://stackoverflow.com/comment/36966075
score: 0
comment on: http://stackoverflow.com/q/23957295
has text: Thanks! I will try and analyze aforementioned views. Will post my findings.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24058954
downvote count: 1
has title: How to know which constructor I am using
has comment: http://stackoverflow.com/comment/37096537
tagged with: java
has answer: http://stackoverflow.com/a/24059827
type: Question
has comment: http://stackoverflow.com/comment/37096808
upvote count: 0
answer count: 1
tagged with: invoke
has comment: http://stackoverflow.com/comment/37097325
has comment: http://stackoverflow.com/comment/37096507
favorite count: 0
score: -1
tagged with: constructor
has body: I hava a class which contents two construcors and a method. the return value of the method depends which construor I m calling. I made a simple program here (It doesn't work). package test; import java.lang.reflect.Constructor; public class TestUsingConstructor { public TestUsingConstructor(String string) { System.out.println("String as param !"); } public TestUsingConstructor(int i) { System.out.println("Int as param !"); } public void CalledMethod (){ if(this.usingConstructor() == 1){ System.out.println("Get 'int' Constructor"); }else if(this.usingConstructor() == 2){ System.out.println("Get 'String' Constructor"); } } public int usingConstructor() { Constructor[] allConstructors = this.getClass().getConstructors(); for (Constructor constructor : allConstructors) { Class&lt;?&gt;[] pType = constructor.getParameterTypes(); for (int i = 0; i &lt; pType.length; i++) { if (pType[i].equals(int.class)) { return 1; } else { return 2; } } } return 1; } public static void main(String[] args) { TestUsingConstructor t1 = new TestUsingConstructor(1); t1.CalledMethod(); //TestUsingConstructor t2 = new TestUsingConstructor("test"); //t2.CalledMethod(); } } what I want to get the result like: Int as param ! "Get 'int' Constructor" but this exemple's result is: Int as param ! Get 'String' Constructor Thanks for your help!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37096918

http://stackoverflow.com/q/23991623
type: Question
has body: I have a Class system @Entity abstract class System{ @Id int systemId; //setter and getters.. } and which is extended by class @Entity class PhysicalSystem extends System { @Id int place; //setter and getters.. } in need to make the composite key by using the systemId and place how can i do this.. if i have @Id in both class its throws exception Initial SessionFactory creation failed.java.lang.ClassCastException: org.hibernate.mapping.JoinedSubclass cannot be cast to org.hibernate.mapping.RootClass How can i solve this? Tables: System{ systemid PK systemName } PhysicalSystem { systemId PK locationId PK }
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24010071
score: 2
has title: Composite Key with subclass in hibernate
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: hibernate-mapping
tagged with: hibernate-annotations
upvote count: 2
has comment: http://stackoverflow.com/comment/37005359
has comment: http://stackoverflow.com/comment/37005077

http://stackoverflow.com/comment/36913178
type: QuestionComment
has text: "I get not do that walk again, I have only 1 and 5" what? You are only printing `lugar1` and `lugar5`. `System.out.println(lugar1);` `System.out.println(lugar5);`
comment on: http://stackoverflow.com/q/23960536
type: Comment
score: 0

http://stackoverflow.com/comment/36952495
comment on: http://stackoverflow.com/a/23980760
score: 0
type: AnswerComment
type: Comment
has text: Make the url ` /test* `.In this case if your URL is `http://localhost:8080/Traders/test.jsp` you will hit your apis.Test servlet.

http://stackoverflow.com/a/58926286
answers question: http://stackoverflow.com/q/24013855
has body: I think it's not easy to use print to verify the lazy loading in mybatis. We can use configuration.getLazyLoadTriggerMethods().clear(); to remove the default triggerMethods as the previous answer. But when we print it, or using toString, It still will call getXXX. so It still trigger lazy loading to select more. So we can't debug or print to see the procedure to lazy loading. I found a way to verify this function. set log level to debug. write the follow codes and see the console. log.info("user :{}", userLazyDepartment); log.info("user :{}", userLazyDepartment.getDepartment());
score: 0
type: Answer

http://stackoverflow.com/q/24096448
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41998923
has body: In my jsp page , I have 2 different select option tags menü . I fill first one with a list from mysql database. when i select one value from this List ,I want to fill second select tag with a List which sended from Mysql . So , In Ajax , When i send a List from servlet to jsp , how to fill second Select option menu with this list in Jsp page ?
tagged with: servlets
score: 0
answer count: 1
tagged with: jsp
tagged with: ajax
linked to: http://stackoverflow.com/q/1363245
type: UnansweredQuestion
has title: How to use Ajax with select option tags in Jsp page ?
has answer: http://stackoverflow.com/a/24096796

tomcat
tags question: http://stackoverflow.com/q/23967467
tags question: http://stackoverflow.com/q/23956904
tags question: http://stackoverflow.com/q/24039451
tags question: http://stackoverflow.com/q/23971641
tags question: http://stackoverflow.com/q/24030366
tags question: http://stackoverflow.com/q/23967861
tags question: http://stackoverflow.com/q/23942745
tags question: http://stackoverflow.com/q/23955391
tags question: http://stackoverflow.com/q/24045540
tags question: http://stackoverflow.com/q/23942703
tags question: http://stackoverflow.com/q/24029199
tags question: http://stackoverflow.com/q/24025996
tags question: http://stackoverflow.com/q/24084834
tags question: http://stackoverflow.com/q/23974886
tags question: http://stackoverflow.com/q/23958511
tags question: http://stackoverflow.com/q/23941174
tags question: http://stackoverflow.com/q/24051547
tags question: http://stackoverflow.com/q/23970009
tags question: http://stackoverflow.com/q/24024599
tags question: http://stackoverflow.com/q/24096381
tags question: http://stackoverflow.com/q/24075301
tags question: http://stackoverflow.com/q/23957701
tags question: http://stackoverflow.com/q/24036471
tags question: http://stackoverflow.com/q/24003745
tags question: http://stackoverflow.com/q/24010015
tags question: http://stackoverflow.com/q/24040753
tags question: http://stackoverflow.com/q/23977023
tags question: http://stackoverflow.com/q/23980446
tags question: http://stackoverflow.com/q/24019380
tags question: http://stackoverflow.com/q/23999474
tags question: http://stackoverflow.com/q/24055716
tags question: http://stackoverflow.com/q/24084945
tags question: http://stackoverflow.com/q/23946369
tags question: http://stackoverflow.com/q/23979933
tags question: http://stackoverflow.com/q/23960451
tags question: http://stackoverflow.com/q/24101781
tags question: http://stackoverflow.com/q/24025352
tags question: http://stackoverflow.com/q/23942630
tags question: http://stackoverflow.com/q/24066664
tag name: tomcat
tags question: http://stackoverflow.com/q/24065120
tags question: http://stackoverflow.com/q/23944595
tags question: http://stackoverflow.com/q/23943990
tags question: http://stackoverflow.com/q/24019267
tags question: http://stackoverflow.com/q/23950967
tags question: http://stackoverflow.com/q/24024385
tags question: http://stackoverflow.com/q/23969953
tags question: http://stackoverflow.com/q/23984752
tags question: http://stackoverflow.com/q/23946562
tags question: http://stackoverflow.com/q/23980384
tags question: http://stackoverflow.com/q/24042908
tags question: http://stackoverflow.com/q/23992680
tags question: http://stackoverflow.com/q/24088600
tags question: http://stackoverflow.com/q/23967529
tags question: http://stackoverflow.com/q/24052191
tags question: http://stackoverflow.com/q/24049246
tags question: http://stackoverflow.com/q/24063836
tags question: http://stackoverflow.com/q/23976737
tags question: http://stackoverflow.com/q/23947701
tags question: http://stackoverflow.com/q/24088924
tags question: http://stackoverflow.com/q/23955703
tags question: http://stackoverflow.com/q/24034490
tags question: http://stackoverflow.com/q/24089980
tags question: http://stackoverflow.com/q/24102017
tags question: http://stackoverflow.com/q/24096472
type: Tag
tags question: http://stackoverflow.com/q/23993032
tags question: http://stackoverflow.com/q/24034563
tags question: http://stackoverflow.com/q/24054200
tags question: http://stackoverflow.com/q/24019115
tags question: http://stackoverflow.com/q/24027573
tags question: http://stackoverflow.com/q/24037409
tags question: http://stackoverflow.com/q/24028105
tags question: http://stackoverflow.com/q/24028494
tags question: http://stackoverflow.com/q/24015397
tags question: http://stackoverflow.com/q/23994904
tags question: http://stackoverflow.com/q/23968791
tags question: http://stackoverflow.com/q/23976844
tags question: http://stackoverflow.com/q/24003612
tags question: http://stackoverflow.com/q/24007778

http://stackoverflow.com/q/23973097
tagged with: time
has comment: http://stackoverflow.com/comment/36936347
has comment: http://stackoverflow.com/comment/36935685
type: UnansweredQuestion
tagged with: datetime
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36936063
has answer: http://stackoverflow.com/a/24099198
type: Question
has answer: http://stackoverflow.com/a/24101002
has title: Combining Human Time with Computer Time into Synthetic Time
has answer: http://stackoverflow.com/a/24098967
has comment: http://stackoverflow.com/comment/36935926
has body: I am trying to write a high data rate UDP streaming interface simulator/tester in Java 8 to a realtime machine that has a very accurate time processor card. Every message has a time field in it and this field is in microseconds resolution. The interface relies on the high resolution time processor for packet ordering. The interface relies on the high precision time card which I don't have and need to simulate out of the equation. I figured I could get away with using something like this: TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); It does work but after running for extended periods of time I found UDP bites me because I send a couple hundred packets out of order with the same exact time stamp and the other side of the interface can't tell that the packets it received were out of order. The interface is tolerant of this to an extent but this isn't really an issue on the real system with the high precision clocks. To mitigate this I have added a sense of synthetic microseconds to my currentTimeMillis() as follows: class TimeFactory { private long prev; private long incr; public long now() { final long now = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); long synthNow = now; if(now == prev) { if(incr &lt; 999) { incr += 1; } synthNow += incr; } else { incr = 0; } prev = now; return synthNow; } } Has anyone ever dealt with synthetic time like this? Is there any other way to tighten this code up or even a better way to handle this (using nanoTime somehow)? If I ever did send more then 999 packets would it be safe to increment into the milliseconds range (ie: increment + 1000 or more)? It looks like I am getting around ~10-15ms difference between currentTimeMillis() calls but I'm sure this is very system dependent.
linked to: http://stackoverflow.com/q/510462
answer count: 3
downvote count: 0
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/23981226
type: Answer
has body: There is no such action android.provider.Telephony.SMS_SENT. Android does not broadcast sent messages. There is an alternative solution described here: Android Broadcast Receiver for Sent SMS messages?
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23980582
answers question: http://stackoverflow.com/q/23980582
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/36999945
comment on: http://stackoverflow.com/q/24006512
score: 0
type: Comment
type: QuestionComment
has text: Tried http://stackoverflow.com/questions/4344469/several-activities-using-same-listener but met problems (that answer is incomplete), so I posted this question. After debugging, I kind of solve this and will post my working answer.

http://stackoverflow.com/comment/37076640
has text: Make sure that the keystore is AOK by using the 'keytool -list -v -keystore <your_keystore_name_here>' command. Other things to try: Use the full path to both your keystore and truststore (instead of just classpath). It looks like your keystore and truststore are the same file, this is ok, but I typically try to keep the two separate. The keystore contains your client certificates while the truststore would contain certificates and CAs that you trust.
type: AnswerComment
comment on: http://stackoverflow.com/a/24043671
type: Comment
score: 2

http://stackoverflow.com/q/24074366
downvote count: 0
has body: I'm trying to write a class, TelemeterTester, which implements the Telemeter class. Telemeter extends Comparator. I keep getting this runtime error... TelemeterTester.java:12: error: cannot find symbol return e1.compareTo(e2); ^ symbol: method compareTo(Comparable) location: variable e1 of type Comparable where Comparable is a type-variable: Comparable extends Object declared in class TelemeterTester 1 error Here is the code for Telemeter interface /** @param &lt;E&gt; the type on which distance and order are defined * */ public interface Telemeter&lt;E&gt; extends Comparator&lt;E&gt; { /** * Returns the distance between e1 and e2. * * @param e1 the first object * @param e2 the second object * @return the distance between e1 and e2 * */ double distance(E e1, E e2); } Here is my code for TelemeterTester class, which implements Telemeter public class TelemeterTester&lt;Comparable&gt; implements Telemeter&lt;Comparable&gt;{ private TelemeterTester() {} public double distance(Comparable e1, Comparable e2) { return 0; } public int compare(Comparable e1, Comparable e2) { return e1.compareTo(e2); } } Can anyone explain to me what I'm doing wrong? I don't understand generics very well and I've been stuck on variations of this error for a few hours now.
tagged with: generics
favorite count: 0
upvote count: 2
tagged with: interface
has title: How to implement an interface with generic types?
has answer: http://stackoverflow.com/a/24074607
has answer: http://stackoverflow.com/a/24074710
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24074418
type: Question
has answer: http://stackoverflow.com/a/24074418
accepted answer: http://stackoverflow.com/a/24074607
tagged with: comparator
linked to: http://stackoverflow.com/q/2770321
answer count: 3

http://stackoverflow.com/q/24102830
has body: I have an App Engine Connected Android Project, so I am using endpoints. I ultimately converted the bitmap from my Android project into an encoded string to use in my setter, where I converted this string back into a byte array and then to a Blob, and then persisted the blob to the datastore. I know when to retrieve this Blob and display it as the actual image on the app engine front end. How can I do this? I'm a very beginner, especially with using Blobs.
answer count: 1
tagged with: google-app-engine
tagged with: android
has answer: http://stackoverflow.com/a/29284385
tagged with: google-cloud-endpoints
score: 0
type: UnansweredQuestion
type: Question
has title: Displaying Blob from App Engine Datastore as an image
tagged with: java
tagged with: google-cloud-datastore

http://stackoverflow.com/q/23976044
tagged with: java-native-interface
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36998093
tagged with: jnienv
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24027795
has body: I am trying to call method of custom Java type, but receiving SIGSEGV signal. Here is the Java Code package com.example.JniApi; public class JniApi { public void test() { MyType obj = new MyType(); nativePrintMyTypeMsg(obj); } public static native void nativePrintMyTypeMsg(MyType obj); } public class MyType { public void printMsg() { android.util.Log.d("TestJni", "From Java"); } } And here is the native code JNIEXPORT void JNICALL Java_com_example_JniApi_JniApi_nativePrintMyTypeMsg (JNIEnv *env , jclass, jobject myObj) { jclass myTypeClass = env-&gt;GetObjectClass(myObj); jmethodID printMsgMethodId = env-&gt;GetMethodID(myTypeClass,"printMsg", "()V"); for(size_t i = 0; i &lt; 1000; ++i){ env-&gt;CallObjectMethod(myObj, printMsgMethodId); } return; }
type: Question
tagged with: android
has title: Android JNI: SIGSEGV on CallObjectMethod
has comment: http://stackoverflow.com/comment/37033752
has comment: http://stackoverflow.com/comment/36977183
answer count: 1
has comment: http://stackoverflow.com/comment/36942072
has answer: http://stackoverflow.com/a/24027795

http://stackoverflow.com/comment/36973023
type: AnswerComment
comment on: http://stackoverflow.com/a/23992722
score: 0
type: Comment
has text: See the comment from @Task below your question, it should resolve your query.

http://stackoverflow.com/a/24046909
answers question: http://stackoverflow.com/q/24045110
has body: Not really. Certainly not consistently. There are several reasons why not: You can only access public information from a user's profile, even with their permission. So all bets are off if they haven't made this public in the first place. Users can set a current "places lived" in their profile, but this is a free-form entry and doesn't require it to be validated in any way against a known places database. It also has the person enter a city, not a ZIP code, so you would need to convert it. They can also set contact information for home or work, and address is one such field they can enter, but this is also a free-form entry, so you would have to search such entries (if they are set) for something that resembles a ZIP (which isn't difficult, but you need to be careful). The person may not have a US address, and thus not a ZIP code.
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24045110
type: AcceptedAnswer
downvote count: 0

recursion
type: Tag
tags question: http://stackoverflow.com/q/23981453
tag name: recursion
tags question: http://stackoverflow.com/q/23952643
tags question: http://stackoverflow.com/q/24090997
tags question: http://stackoverflow.com/q/24005576
tags question: http://stackoverflow.com/q/24072793
tags question: http://stackoverflow.com/q/24014879
tags question: http://stackoverflow.com/q/24055397
tags question: http://stackoverflow.com/q/24064639
tags question: http://stackoverflow.com/q/24087459
tags question: http://stackoverflow.com/q/23976457
tags question: http://stackoverflow.com/q/24067005
tags question: http://stackoverflow.com/q/23966228
tags question: http://stackoverflow.com/q/24092288

http://stackoverflow.com/a/24063039
score: 3
upvote count: 3
has body: If you are using json, you can set the json framework to ignore unkown fields on the client side: import org.codehaus.jackson.annotate.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) OR // jackson 1.9 and before objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); // or jackson 2.0 objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); on the server side jackson 1.x @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) OR jackson 2.x @JsonInclude(Include.NON_NULL)
accepted answer of: http://stackoverflow.com/q/24049204
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24049204
type: Answer

http://stackoverflow.com/a/24073435
has comment: http://stackoverflow.com/comment/37123973
downvote count: 0
score: 1
has body: You are instanciating two times output when it is not needed. All treatment related to output should be done in the try block so it is not executed if an error happen and the stack is redirected to exception block. The output should be in a finally block to make sure the file is closed whatever happen. Doing these correction, your code shoud look like this : import java.io.*; public class WriteData { public static void main(String[] args) { File file = null; PrintWriter output = null; try { file = new File("scores.txt"); output = new PrintWriter(file); output.print("John T Smith "); output.println(90); output.print("Eric K Jones "); output.println(85); } catch (FileNotFoundException ex) { ex.printStackTrace(); } finally { //The output not be instanciated if scores.txt was not found. if(output != null) output.close(); } } } In my opinion, this is the best way to handle your case.
has comment: http://stackoverflow.com/comment/37123909
upvote count: 1
has comment: http://stackoverflow.com/comment/37123817
answers question: http://stackoverflow.com/q/24073335
type: Answer
has comment: http://stackoverflow.com/comment/37135626

http://stackoverflow.com/comment/37070982
type: QuestionComment
score: 0
has text: See this question's answer:http://stackoverflow.com/questions/1816673/how-do-i-check-if-a-file-exists-java-on-windows
comment on: http://stackoverflow.com/q/24044912
type: Comment

http://stackoverflow.com/comment/37344424
score: 0
type: Comment
has text: @CodeChimp Thanks for the suggestion! For this [Spring guide](https://spring.io/guides/gs/rest-service/), where is the file of "application.properties" for us to modify?
comment on: http://stackoverflow.com/a/23953385
type: AnswerComment

http://stackoverflow.com/a/30219956
has comment: http://stackoverflow.com/comment/89218267
type: Answer
has comment: http://stackoverflow.com/comment/81361427
score: 23
has body: To avoid ZoneId you can do: LocalDateTime date = LocalDateTime.of(1970, 1, 1, 0, 0); System.out.println("Initial Epoch (TimeInMillis): " + date.toInstant(ZoneOffset.ofTotalSeconds(0)).toEpochMilli()); Getting 0 as value, that's right!
has comment: http://stackoverflow.com/comment/110308743
has comment: http://stackoverflow.com/comment/110309532
answers question: http://stackoverflow.com/q/23944370
downvote count: 1
upvote count: 24
has comment: http://stackoverflow.com/comment/89270404

methods
tags question: http://stackoverflow.com/q/24004375
tags question: http://stackoverflow.com/q/24052807
tags question: http://stackoverflow.com/q/24101597
tags question: http://stackoverflow.com/q/23983697
tags question: http://stackoverflow.com/q/23957414
tags question: http://stackoverflow.com/q/23997302
tags question: http://stackoverflow.com/q/24098902
tags question: http://stackoverflow.com/q/24096925
tag name: methods
tags question: http://stackoverflow.com/q/24007755
tags question: http://stackoverflow.com/q/23975215
tags question: http://stackoverflow.com/q/24047733
tags question: http://stackoverflow.com/q/24053301
type: Tag
tags question: http://stackoverflow.com/q/23975708
tags question: http://stackoverflow.com/q/24001048
tags question: http://stackoverflow.com/q/23951975
tags question: http://stackoverflow.com/q/23981982
tags question: http://stackoverflow.com/q/24097110
tags question: http://stackoverflow.com/q/23986771
tags question: http://stackoverflow.com/q/24035055
tags question: http://stackoverflow.com/q/23962143
tags question: http://stackoverflow.com/q/24072153
tags question: http://stackoverflow.com/q/24004582
tags question: http://stackoverflow.com/q/23976995
tags question: http://stackoverflow.com/q/23965585
tags question: http://stackoverflow.com/q/23975758
tags question: http://stackoverflow.com/q/24071017
tags question: http://stackoverflow.com/q/24100867

http://stackoverflow.com/a/52895775
has comment: http://stackoverflow.com/comment/128312940
has body: after about 40 minutes I found that user and currentUser should not be used as well //this cause error @Column() private String user; this causes: could not prepare statement; SQL [insert into table_progress (id, created, user, progress, updated, xdip) values (default, ?, ?, ?, ?, ?)] //changed to this and works @Column() private String userP;
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/24060498
type: Answer
downvote count: 0

jersey-2.0
tags question: http://stackoverflow.com/q/23992714
type: Tag
tags question: http://stackoverflow.com/q/24028151
tags question: http://stackoverflow.com/q/23953381
tag name: jersey-2.0
tags question: http://stackoverflow.com/q/24038788

http://stackoverflow.com/q/24104443
tagged with: c#
has answer: http://stackoverflow.com/a/24104810
tagged with: stanford-nlp
has comment: http://stackoverflow.com/comment/37183125
score: -2
has comment: http://stackoverflow.com/comment/37182805
accepted answer: http://stackoverflow.com/a/24104810
has title: cant remove element from java.util.list
has comment: http://stackoverflow.com/comment/37182824
downvote count: 4
has comment: http://stackoverflow.com/comment/37182721
answer count: 1
has body: I'm using java.util in my c# program. I want to remove a element from List, however don't know why is is not working. foreach (List sentence in new DocumentPreprocessor(clfile)) { //int i = sentence.size(); string rm = "ASPECT"; Object objstr = rm; sentence.remove(objstr); string temp2 = String.Join(",", sentence.toArray()); ... } After execution of above coe the word "ASPECT" is still there in List sentence. PS: Document Preprocessor belongs to, edu.stanford.nlp.process
favorite count: 0
has comment: http://stackoverflow.com/comment/37182891
has comment: http://stackoverflow.com/comment/37182724
has comment: http://stackoverflow.com/comment/37182865
has comment: http://stackoverflow.com/comment/37182742
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37182739
type: Question
has comment: http://stackoverflow.com/comment/37182768

http://stackoverflow.com/comment/100659220
type: Comment
has text: both do the same thing: post a runnable on the ui thread execution queue.
score: 0
comment on: http://stackoverflow.com/a/23961223
type: AnswerComment

http://stackoverflow.com/comment/37143418
comment on: http://stackoverflow.com/a/24084156
has text: Read the tutorial. If you want to use Swing you need to understand why this is important. It is only a couple of extra lines of code to create the SwingWorker. Download the example code and give it a test.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24072578
type: AnsweredQuestion
has body: I am trying to do an exercise about AJAX using Servlets but I'm getting a internal server error. The program is to create a list of words and save them to a XML file. My code is as follows: HTML that calls save() Save keywords save() method: function save(){ var queryString = ""; for (var i = 0; i < list.length; i++){ if (queryString.length > 0) { queryString += "&"; } queryString += "palavra="; queryString += list[i]; } xmlhttp = createRequest(); //creates a XMLHttpRequest xmlhttp.onreadystatechange = foo; xmlhttp.open("POST", "SaveXML", true); xmlhttp.send(queryString); } My servlet (Eclipse-generated): package br.com.gabriel; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class SaveXML */ @WebServlet(description = "pega a hora do servidor", urlPatterns = { "/SaveXML" }) public class SaveXML extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public SaveXML() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String[] words = request.getParameterValues("palavra"); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); out.println(" "); for (int i = 0; i < words.length; i++) { out.println(" "); out.println(words[i]); out.println(" "); } out.println(" "); } } My server log: GRAVE: Servlet.service() for servlet [br.com.gabriel.SaveXML] in context with path [/Palavras-Chave] threw exception java.lang.NullPointerException at br.com.gabriel.SaveXML.doPost(SaveXML.java:40) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)…
has answer: http://stackoverflow.com/a/24079550
accepted answer: http://stackoverflow.com/a/24079550
has comment: http://stackoverflow.com/comment/37122145
has comment: http://stackoverflow.com/comment/37122166
tagged with: javascript
tagged with: servlets
has comment: http://stackoverflow.com/comment/37122098
has comment: http://stackoverflow.com/comment/37122111
has comment: http://stackoverflow.com/comment/37124775
answer count: 2
has comment: http://stackoverflow.com/comment/37122018
has comment: http://stackoverflow.com/comment/37122035
has title: When calling Servlet I get a 500 - Internal Server Error
upvote count: 1
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/37122034
has comment: http://stackoverflow.com/comment/37122100
has comment: http://stackoverflow.com/comment/37121976
linked to: http://stackoverflow.com/q/812925
possible better answer: http://stackoverflow.com/a/26622715
downvote count: 0
has comment: http://stackoverflow.com/comment/37122588
score: 1
has comment: http://stackoverflow.com/comment/37122048
has answer: http://stackoverflow.com/a/26622715
tagged with: java
has comment: http://stackoverflow.com/comment/37122001
type: Question

http://stackoverflow.com/comment/37203528
comment on: http://stackoverflow.com/q/24065450
score: 0
has text: Yes, it is. The DALUserTest class belongs to the same project of the DAO
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24025173
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24025225
has answer: http://stackoverflow.com/a/24025225
accepted answer: http://stackoverflow.com/a/24025240
type: AnsweredQuestion
has title: Null Pointer Exception while creating an class object to be used in adaptor for populating custom listview
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24025240
has body: I created the following class named contact data : public class ContactData { String contact_id; String first_name; String last_name; String email; Uri icon; public ContactData(String contact_id,String first_name,String last_name,String email){ this.contact_id=contact_id; this.first_name=first_name; this.last_name=last_name; this.email=email; this.icon= Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI,contact_id); if (this.icon == null){ this.icon = Uri.parse("android.resource://com.project.iandwe/drawable/ic_contacts"); } } public String getContact_id() { return contact_id; } public void setContact_id(String contact_id) { this.contact_id = contact_id; } public String getFirst_name() { return first_name; } public void setFirst_name(String first_name) { this.first_name = first_name; } public String getLast_name() { return last_name; } public void setLast_name(String last_name) { this.last_name = last_name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Uri getIcon() { if (this.icon == null){ this.icon = Uri.parse("android.resource://com.project.iandwe/drawable/ic_contacts"); } return this.icon; } public void setIcon(Uri icon) { this.icon = icon; } } Now i try to create the object of this class like this: package com.project.iandwe.Adaptor; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import com.project.iandwe.Data.ContactData; import com.project.iandwe.R; import java.util.ArrayList; /** * Created by NathanDrake on 6/4/2014. */ public class ContactSelectAdaptor extends BaseAdapter { ArrayList&lt;ContactData&gt; listViewRows; Context context; public ContactSelectAdaptor(Context context){ //Resou…
tagged with: listview

odata
tag name: odata
type: Tag
tags question: http://stackoverflow.com/q/24078784

http://stackoverflow.com/comment/36988991
has text: Removing the header worked, thank you. It seems Netbeans requires only the data and no labels
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23979841

http://stackoverflow.com/q/24029341
has answer: http://stackoverflow.com/a/24234403
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24234403
has answer: http://stackoverflow.com/a/34885633
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/60859125
has answer: http://stackoverflow.com/a/54306016
has answer: http://stackoverflow.com/a/68765985
type: Question
answer count: 8
tagged with: cucumber
score: 18
has answer: http://stackoverflow.com/a/49712180
has title: @Before doesn't execute in java Cucumber Step
has comment: http://stackoverflow.com/comment/37046433
has comment: http://stackoverflow.com/comment/37089633
has comment: http://stackoverflow.com/comment/37088382
has answer: http://stackoverflow.com/a/59143159
has comment: http://stackoverflow.com/comment/37093164
tagged with: bdd
favorite count: 0
has answer: http://stackoverflow.com/a/61597695
has comment: http://stackoverflow.com/comment/37091118
has comment: http://stackoverflow.com/comment/37082938
has body: I've got a Cucumber Step class that i'm attempting to initialise a page model for all scenarios. So I added a @Before annotated method : @Before() private void beforeScenario() { LOGGER.info("Running before!"); loginPage = BrowserDriver.getPageModel(LoginPage.class); } I've then got a bunch of steps that rely on loginPage being set. e.g. @When("^I click the help link$") public void I_click_the_help_link() { loginPage.clickHelpLink(); } I have multiple Step classes. Both of the methods above are in the same same Step class. However loginPage is always null. The beforeScenario method is never being called. Have I completely misunderstood how @Before is meant to work? Any tips on how to get what I want to work? Edit : I also have an @After annotated method that does get run after every scenario as expected. Edit : Pom can be seen at : http://pastebin.com/PJ6qQRK9
upvote count: 18
possible better answer: http://stackoverflow.com/a/49712180
has comment: http://stackoverflow.com/comment/37091099

http://stackoverflow.com/a/23977547
score: 2
has body: The use case with the if condition is debugging. AFAIK it is explicitly allowed by the spec for if-statements (not for loops) to allow code like this: class A { final boolean debug = false; void foo() { if (debug) { System.out.println("bar!"); } ... } } You can later (or via debugger at runtime) change the value of debug to get output. EDIT As Christian pointed out in his comment, an answer linking to the spec can be found here.
answers question: http://stackoverflow.com/q/23977508
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/37745136
type: Comment
has text: Yes your above comment was really useful,thanks...(:
type: AnswerComment
comment on: http://stackoverflow.com/a/24148079
score: 0

http://stackoverflow.com/a/23994287
has comment: http://stackoverflow.com/comment/36976499
has body: First you declare database create table query string in your DatabaseHelper class like this: private static final String DATABASE_CREATE_USER = "create table UserInfo(" + "_id VARCHAR(20)," + "userGOAL VARCHAR(20)," + "userName VARCHAR(20)," + "userEmail VARCHAR(20)," + "userDOB VARCHAR(20)," + "userHeight VARCHAR(10)," + "userWeight VARCHAR(10)," + "userGender VARCHAR(10)," + "userZIP VARCHAR(10) "+ ")"; Then write inside onCreate method of DatabaseHelper db.execSQL(DATABASE_CREATE_USER); Then declare object of SqliteDatabase and DatabseHelper in your AcountActivity like this: DatabaseHelper dbHelper; SQLiteDatabase db; Afer this write following code inside your button onClick method: dbHelper= new DatabaseHelper(ActountActivity.this); db = dbHelper.getWritableDatabase(); ContentValues insertValues = new ContentValues(); insertValues.put("_id", "User_Id"); insertValues.put("userGOAL", "User_Goal"); insertValues.put("userName", "User_Name"); insertValues.put("userEmail", "User_Email"); insertValues.put("userDOB", "User_DOB"); insertValues.put("userHeight", "User_Height"); insertValues.put("userWeight", "User_Weight"); insertValues.put("userGender", "User_Gender"); insertValues.put("userZIP", "User_Zip"); db.insert("UserInfo", null, insertValues); db.close(); May this help you.
has comment: http://stackoverflow.com/comment/36976571
downvote count: 1
has comment: http://stackoverflow.com/comment/36976018
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/36976926
has comment: http://stackoverflow.com/comment/36976229
answers question: http://stackoverflow.com/q/23993844
has comment: http://stackoverflow.com/comment/36976318
has comment: http://stackoverflow.com/comment/36976407
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36976262
has comment: http://stackoverflow.com/comment/36976718
has comment: http://stackoverflow.com/comment/36976976
type: Answer
has comment: http://stackoverflow.com/comment/36976662
accepted answer of: http://stackoverflow.com/q/23993844

http://stackoverflow.com/comment/37077992
score: 3
comment on: http://stackoverflow.com/q/24048157
has text: Your code DOES NOT match the instructions given in the link. Go back and reread the link and try again.
type: Comment
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/24026003
tags question: http://stackoverflow.com/q/23987546
tags question: http://stackoverflow.com/q/24001247
tags question: http://stackoverflow.com/q/23971494
tags question: http://stackoverflow.com/q/24086675
tags question: http://stackoverflow.com/q/23983170
tags question: http://stackoverflow.com/q/24056377
tag name: eclipse
tags question: http://stackoverflow.com/q/23959388
tags question: http://stackoverflow.com/q/24004357
tags question: http://stackoverflow.com/q/24033818
tags question: http://stackoverflow.com/q/23980120
tags question: http://stackoverflow.com/q/23968500
tags question: http://stackoverflow.com/q/24083920
tags question: http://stackoverflow.com/q/24025188
tags question: http://stackoverflow.com/q/23962955
tags question: http://stackoverflow.com/q/23964094
tags question: http://stackoverflow.com/q/23989099
tags question: http://stackoverflow.com/q/24067370
tags question: http://stackoverflow.com/q/24081770
tags question: http://stackoverflow.com/q/24028050
tags question: http://stackoverflow.com/q/24010810
tags question: http://stackoverflow.com/q/23962556
tags question: http://stackoverflow.com/q/24016266
tags question: http://stackoverflow.com/q/24095912
tags question: http://stackoverflow.com/q/24030030
tags question: http://stackoverflow.com/q/24005579
tags question: http://stackoverflow.com/q/24032981
tags question: http://stackoverflow.com/q/24004597
tags question: http://stackoverflow.com/q/23974699
tags question: http://stackoverflow.com/q/24066726
tags question: http://stackoverflow.com/q/24030853
tags question: http://stackoverflow.com/q/24028311
tags question: http://stackoverflow.com/q/24088600
tags question: http://stackoverflow.com/q/23974152
tags question: http://stackoverflow.com/q/24068171
tags question: http://stackoverflow.com/q/23968862
tags question: http://stackoverflow.com/q/24071370
tags question: http://stackoverflow.com/q/23998135
tags question: http://stackoverflow.com/q/24065678
tags question: http://stackoverflow.com/q/23971163
tags question: http://stackoverflow.com/q/24021680
tags question: http://stackoverflow.com/q/23974381
tags question: http://stackoverflow.com/q/23998937
tags question: http://stackoverflow.com/q/23989101
tags question: http://stackoverflow.com/q/24027229
tags question: http://stackoverflow.com/q/23947633
tags question: http://stackoverflow.com/q/23947855
tags question: http://stackoverflow.com/q/24018021
tags question: http://stackoverflow.com/q/24077290
tags question: http://stackoverflow.com/q/24024720
tags question: http://stackoverflow.com/q/23969611
tags question: http://stackoverflow.com/q/24073676
tags question: http://stackoverflow.com/q/23981476
tags question: http://stackoverflow.com/q/24028118
tags question: http://stackoverflow.com/q/24077002
tags question: http://stackoverflow.com/q/23951889
tags question: http://stackoverflow.com/q/24104796
tags question: http://stackoverflow.com/q/23970429
tags question: http://stackoverflow.com/q/24097557
tags question: http://stackoverflow.com/q/23970074
tags question: http://stackoverflow.com/q/23956739
tags question: http://stackoverflow.com/q/24078294
tags question: http://stackoverflow.com/q/24011016
tags question: http://stackoverflow.com/q/23947646
tags question: http://stackoverflow.com/q/24087994
tags question: http://stackoverflow.com/q/24095581
tags question: http://stackoverflow.com/q/23977485
tags question: http://stackoverflow.com/q/24074648
tags question: http://stackoverflow.com/q/23975609
tags question: http://stackoverflow.com/q/24034563
tags question: http://stackoverflow.com/q/24043980
tags question: http://stackoverflow.com/q/24085496
tags question: http://stackoverflow.com/q/24077682
tags question: http://stackoverflow.com/q/24019115
tags question: http://stackoverflow.com/q/23969674
tags question: http://stackoverflow.com/q/24006457
tags question: http://stackoverflow.com/q/24022038
tags question: http://stackoverflow.com/q/24016513
tags question: http://stackoverflow.com/q/24070395

http://stackoverflow.com/q/24092598
answer count: 1
tagged with: libgdx
tagged with: math
tagged with: java
downvote count: 0
type: UnansweredQuestion
has title: Setting the applcation to use "y-down" in LibGDX
tagged with: axis
score: 1
has answer: http://stackoverflow.com/a/24094471
has body: http://badlogicgames.com/forum/viewtopic.php?f=11&amp;t=2447 http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/OrthographicCamera.html There's hundreds of other links I could show you that I've looked at, but it's just not worth it because they all say the same thing. public class InGame implements Screen { SpriteBatch batch; GameWorld world; OrthographicCamera camera; @Override public void show() { batch = new SpriteBatch(); world = new GameWorld(); camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } @Override public void render(float delta) { Gdx.gl.glClearColor(0f, 0f, 0f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); batch.setProjectionMatrix(camera.combined); batch.begin(); world.render(batch, delta); batch.end(); } } What am I doing wrong? WHY is my world still being rendered with the 0,0 being at the bottom right. The math behind this while trying to work on my Tile-System is driving me absolutely insane. World->Render public void render(SpriteBatch batch, float delta) { for(int xAxis = 0; xAxis &lt; worldColumns; xAxis++) { for(int yAxis = 0; yAxis &lt; worldRows; yAxis++) { tiles[xAxis][yAxis].render(batch, delta); } } } WorldTile->Render public void render(SpriteBatch batch, float delta) { myShape.begin(ShapeType.Filled); myShape.setColor(tileColor); myShape.rect(pos.getX(), pos.getY(), TILE_WIDTH, TILE_HEIGHT); myShape.end(); } The "pos" is the Position(x, y) that was passed in the World class.
favorite count: 0
type: Question
upvote count: 1

http://stackoverflow.com/q/24096342
has title: Java JSplitPane update Components directly after resizing
has comment: http://stackoverflow.com/comment/37166490
has body: Im trying to update myJSplitPane` components directly after I drag the divider. I enabled instant updating of the components when I drag the divider. My problem is that the components getting resized a bit later than I drag the divider; that looks a littlebit confusing. Image of my Window at resizing You can see the JScrollPane outside the window. I want to avoid that problem. I tried: - Property change listener - Thread with 60fps Nothing helps. //SOLVED Added a BorderLayout to my Panel and set the setPreferredSize as I need it.
type: UnansweredQuestion
tagged with: size
answer count: 0
tagged with: swing
type: Question
tagged with: jsplitpane
has comment: http://stackoverflow.com/comment/37166484
tagged with: java
has comment: http://stackoverflow.com/comment/37168690
score: 0
linked to: http://stackoverflow.com/q/7229226

http://stackoverflow.com/comment/36937890
score: 0
type: AnswerComment
type: Comment
has text: The other problem is how to show an AlertDialog with one EditText field withing the thread. How can i do that? About the problem with showing a Toast i solved it by creating a static method that calls Toast inside the Controller class and i successfully invoked it in the thread.
comment on: http://stackoverflow.com/a/23961091

http://stackoverflow.com/q/23962143
score: 5
has answer: http://stackoverflow.com/a/23962252
tagged with: api
downvote count: 0
tagged with: access-modifiers
has answer: http://stackoverflow.com/a/23962466
has body: I am developing a java API. During my development, I keep facing the following issue: I have two classes in two different packages. Class A in package x, and class B in package y. I need the class A to access a method M defined in class B. Hence, the modifier that should be used for the method M is public. However, I do not want to allow the developer who will use my API in his/her java application to access the method M. The problem is that the method M has a public modifier as I mentioned, and hence anyone can access it within the API or from outside the API. At the same time, if I decrease the modifier level of the method M to protected or private, the class A will not be able to access the method M because it belongs to a different package. How can I solve this problem? Is my only solution to have A and B in the same package?
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/23962524
has title: I need to have a java method that can be accessed from anywhere within my API but cannot be accessed from the application using the API
has answer: http://stackoverflow.com/a/23962403
has comment: http://stackoverflow.com/comment/36916283
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36916766
has comment: http://stackoverflow.com/comment/36916631
has answer: http://stackoverflow.com/a/23962451
upvote count: 5
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/36916317
tagged with: modifier
type: Question

http://stackoverflow.com/comment/37014473
type: AnswerComment
type: Comment
has text: Im sorry. I meant with other issues as well. For instance if an object has a relationship: ManyToMany for instance, and we also have @JsonIgnore on that relationship, Hibernate figures when we want to update an object that "this object doesnt have any objects as relatives and will remove that coupling. We solve it by syncing with the database in the builders if the json-object doesnt contain this JsonIgnored attribute.
comment on: http://stackoverflow.com/a/24008935
score: 0

http://stackoverflow.com/comment/36978306
has text: can you show us a sample list?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23995584

http://stackoverflow.com/comment/37038060
has text: Note that 'z' has to have the same length (or more) as 'x'. Ielse you'll have an ArrayOutOfBoundException.
comment on: http://stackoverflow.com/a/24026732
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24086022
downvote count: 0
has comment: http://stackoverflow.com/comment/37146985
accepted answer of: http://stackoverflow.com/q/24085674
has body: What's happening is that your collection is being modified while you are iterating over it. It's could be another thread, or it's possible one of your subscribers is either unsubscribing, or subscribing to a different dataClass in response to the message it receives.
answers question: http://stackoverflow.com/q/24085674
has comment: http://stackoverflow.com/comment/37146806
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/37125780
type: AnswerComment
type: Comment
has text: How can i manage border between text4 and text5 ? @Vikalp Patel
comment on: http://stackoverflow.com/a/24074468
score: 0

http://stackoverflow.com/comment/36972131
type: Comment
comment on: http://stackoverflow.com/q/23992395
score: 0
has text: To summarize the error message: You have a "NullPointerException" (you try to access a variable of function of an object which is "null", i.e. not set/initialized) and this error occurs in the file MainActivity.java on line 28. The File you posted was main_activity.java. Was that a typo or do you have two mainactivity classes?
type: QuestionComment

http://stackoverflow.com/comment/36896882
type: Comment
score: 0
has text: I am currently referring to [this example](http://www.rgagnon.com/javadetails/java-0482.html) but I decided to post my query on stack overflow for now.
type: QuestionComment
comment on: http://stackoverflow.com/q/23951132

http://stackoverflow.com/a/24057478
answers question: http://stackoverflow.com/q/24057041
has body: I think you still have to add that jar into classPath and then it will be recognized.Im not sure what ide you use bud in netbeans for instance rightclick project>libraries>add jar/library.Then your classLoader shoudnt be complaining.
score: 2
accepted answer of: http://stackoverflow.com/q/24057041
has comment: http://stackoverflow.com/comment/37094981
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24085438
score: 0
type: Answer
has body: I would like to refer you to the top answer on this page: How to get the value from the GET parameters? This enables you to get the value of the GET-parameters in the URL.
answers question: http://stackoverflow.com/q/24083457

http://stackoverflow.com/q/23966597
tagged with: arraylist
has answer: http://stackoverflow.com/a/23966614
has title: ArrayList of Integers value Addition? Can it be done?
has answer: http://stackoverflow.com/a/23966628
has body: I have Created an ArrayList of Integers as follows: ArrayList tiles_cell_nums = new ArrayList&lt;Integer&gt;(); tiles_cell_nums.add(0); tiles_cell_nums.add(0); Now I am trying to increment one of the values inside of the ArrayList as follows: tiles_cell_nums.get(0) += 1; But it is not letting me do that: The Left side of an assignment must be a variable So I am wondering, what is the easiest alternative for doing this? Thank You
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23966628
accepted answer: http://stackoverflow.com/a/23966614
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23966807
type: Question
has answer: http://stackoverflow.com/a/23967477

http://stackoverflow.com/comment/36966182
comment on: http://stackoverflow.com/q/23989101
type: QuestionComment
score: 0
type: Comment
has text: May be problem with your ADT bundle, just try with latest one.

http://stackoverflow.com/a/23942995
answers question: http://stackoverflow.com/q/23942954
type: Answer
accepted answer of: http://stackoverflow.com/q/23942954
downvote count: 0
score: 1
has body: You used == instead of .equals() to compare the strings. Classic mistake.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23973107
type: Question
answer count: 1
downvote count: 0
score: 75
tagged with: inheritance
favorite count: 0
upvote count: 75
accepted answer: http://stackoverflow.com/a/23973331
has title: How to use @inherited annotation in Java?
has answer: http://stackoverflow.com/a/23973331
tagged with: annotations
type: AnsweredQuestion
has body: I am not getting the @Inherited annotation in Java. If it automatically inherits the methods for you then if I need to implement the method in my own way then what about that ? How does will it come to know my way of implementation ? Plus it is said if I do not want to use this and do it rather in an old fashioned Java way I have to implement the the equals(), toString(), and the hashCode() methods of the Object class and also the annotation type method of the java.lang.annotation.Annotation class. Why is that? I have never implemented those even when I did not know about the @Inherited annotation and the programs used to work fine also . Please somebody explain me from the scratch about this.
tagged with: java

http://stackoverflow.com/a/24021585
has body: No. That is a block. Groovy also has these. class A { static { println "static init block" } { println "init block" } def closure = { println "closure field" } } a = new A() The code above will print: $ groovy Block.groovy static init block init block
upvote count: 7
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/24021348

http://stackoverflow.com/comment/36937927
score: 0
type: Comment
has text: OK. See your point now. You may want to look at answers to [Modifying a file inside a jar](http://stackoverflow.com/questions/1224817/modifying-a-file-inside-a-jar) question. Do not get totally discouraged by the accepted answer.
type: QuestionComment
comment on: http://stackoverflow.com/q/23974152

primefaces
tags question: http://stackoverflow.com/q/24081869
tags question: http://stackoverflow.com/q/24000017
tags question: http://stackoverflow.com/q/24058982
tags question: http://stackoverflow.com/q/23971514
tags question: http://stackoverflow.com/q/23942753
tags question: http://stackoverflow.com/q/23978629
tag name: primefaces
tags question: http://stackoverflow.com/q/24037225
tags question: http://stackoverflow.com/q/24010698
tags question: http://stackoverflow.com/q/24036626
tags question: http://stackoverflow.com/q/24024506
tags question: http://stackoverflow.com/q/24017638
tags question: http://stackoverflow.com/q/23999818
tags question: http://stackoverflow.com/q/24002738
tags question: http://stackoverflow.com/q/23988906
tags question: http://stackoverflow.com/q/24057169
type: Tag
tags question: http://stackoverflow.com/q/24050273

http://stackoverflow.com/q/23959058
answer count: 2
upvote count: 1
favorite count: 0
tagged with: hash
has body: I have two objects based on which SHA 256 Hash needs to be generated. First value is a JSONObject Second value is a String variable. Ideally, what i need is Hash hash= new Hash(JSONObject, String); I couldn't find any hash generation methods which takes two values. Could anyone help me with this?.
has answer: http://stackoverflow.com/a/24153608
type: UnansweredQuestion
tagged with: android
has title: Generate SHA 256 Hash using multiple values in Java/Android
downvote count: 0
score: 1
tagged with: java
tagged with: sha
type: Question
has comment: http://stackoverflow.com/comment/36910346
has answer: http://stackoverflow.com/a/23959958

http://stackoverflow.com/comment/37066070
score: 0
has text: What do you mean by "which will involve a lot of javac"? Do you really need to be messing with the compiler itself?
comment on: http://stackoverflow.com/q/24042456
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37127045
score: 0
comment on: http://stackoverflow.com/a/24075122
type: Comment
has text: how can I work a resolution around this problem as I am not able to properly use ExecutionService
type: AnswerComment

http://stackoverflow.com/comment/37135488
type: QuestionComment
has text: Why maintain a separate length attribute when you can use `a.length`? Have you checked to see if the first element in the array *always is* the element you're looking for (perhaps implying a bug elsewhere in your code if that's not expected behaviour)?
comment on: http://stackoverflow.com/q/24080111
score: 0
type: Comment

http://stackoverflow.com/comment/37084356
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24052241
has text: Check the length of selArt and see if it is within range of cdes

http://stackoverflow.com/q/24043894
has comment: http://stackoverflow.com/comment/37069133
favorite count: 0
has comment: http://stackoverflow.com/comment/37072474
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37069172
tagged with: jsf
has body: im trying to save the manager id of distinct managers from collabs to managersId but i get an exeption "ConcurrentModificationException" public void fillTree() throws SystemException, PortalException { TreeNode nodeParent; TreeNode nodeFils; Set&lt;Long&gt; managersId = new HashSet&lt;Long&gt;(); UserVO user = new UserVO(); collabs = CollabLocalServiceUtil.getCollabs(-1, -1); Iterator&lt;Long&gt; iter = managersId.iterator(); long id; for (int i = 0; i &lt; collabs.size(); i++) { id = collabs.get(i).getManagerId(); synchronized (managersId) { managersId.add((Long) id); System.out.println(id); } } while (iter.hasNext()) { id = iter.next();//throw exeption user = getUserById(id); nodeParent = new DefaultTreeNode(user.getFullName(), root); for (int j = 0; j &lt; collabs.size(); j++) { if (collabs.get(j).getManagerId() == user.getUserId()) { nodeFils = new DefaultTreeNode(getUserById( collabs.get(j).getUserId()).getFullName(), nodeParent); } } } } im using liferay portal
tagged with: java
has answer: http://stackoverflow.com/a/24044731
has comment: http://stackoverflow.com/comment/37068902
downvote count: 1
has comment: http://stackoverflow.com/comment/37069436
type: Question
tagged with: liferay
has comment: http://stackoverflow.com/comment/37072630
has comment: http://stackoverflow.com/comment/37069193
has title: i get ConcurrentModificationException when adding an item
score: -1
linked to: http://stackoverflow.com/q/1655362
has comment: http://stackoverflow.com/comment/37070069
accepted answer: http://stackoverflow.com/a/24044731
upvote count: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/1655362

http://stackoverflow.com/comment/36946285
type: Comment
comment on: http://stackoverflow.com/q/23966177
has text: @MadProgrammer No.... But I've been that 2 YO. :)
score: 0
type: QuestionComment

http://stackoverflow.com/q/24103393
tagged with: jakarta-ee
answer count: 1
tagged with: http://stackoverflow.com/tag/xhtml
has body: Here is how my application currently works. 1.User fills out a "Voter Registration" XHTML form. 2.When the user clicks submit, The values are saved through using a SessionScoped CDI Java-EE file. Here are the contents of that file: import java.io.Serializable; import javax.enterprise.context.SessionScoped; import javax.inject.Named; @Named @SessionScoped public class VoterBean implements Serializable{ private String firstName; private String lastName; private String address; private String city; private String state; private String zip; private String phone; private String affil; public VoterBean(){ } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } public String getAddress(){ return address; } public String getCity(){ return city; } public String getState(){ return state; } public String getZip(){ return zip; } public String getPhone(){ return phone; } public String getAffil(){ return affil; } public void setFirstName(String firstName){ this.firstName = firstName; } public void setLastName(String lastName){ this.lastName = lastName; } public void setAddress(String address){ this.address = address; } public void setCity(String city){ this.city = city; } public void setState(String state){ this.state = state; } public void setZip(String zip){ this.zip = zip; } public void setPhone(String phone){ this.phone = phone; } public void setAffil(String affil){ this.affil = affil; } } 3.The user is given a summary of the values he/she filled in. The user is asked if the values are currently ok or not. If the user clicks "No" the user is taken back to the Registraiton form to be able to change his/her values. Now the problem is when they click "Yes". I have two issues: Issue #1: I want to create a Bean file where after a user clicks "Yes" the form information is saved as a List. So if multiple people finish the Registration process there should be multiple lists with their information. I would think that I would grab the informa…
upvote count: 1
accepted answer: http://stackoverflow.com/a/24105383
downvote count: 0
favorite count: 0
has title: Using a Java EE Bean to Save a List of Form Data and print out data in a JSF XHTML DataTable
has answer: http://stackoverflow.com/a/24105383
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
tagged with: forms
type: Question

http://stackoverflow.com/comment/37066081
type: QuestionComment
has text: @Marco: The order defines the results of the conditions needs to be displayed in the mentioned order.
score: 0
comment on: http://stackoverflow.com/q/24041812
type: Comment

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24063351
tags question: http://stackoverflow.com/q/23975388
tags question: http://stackoverflow.com/q/24048046
tags question: http://stackoverflow.com/q/24096609
tags question: http://stackoverflow.com/q/24049657
tags question: http://stackoverflow.com/q/24051573
tags question: http://stackoverflow.com/q/23965472
type: Tag
tags question: http://stackoverflow.com/q/24015545
tags question: http://stackoverflow.com/q/24090470
tags question: http://stackoverflow.com/q/24014100
tags question: http://stackoverflow.com/q/24071180
tags question: http://stackoverflow.com/q/24039229
tags question: http://stackoverflow.com/q/24010377

http://stackoverflow.com/comment/37170974
type: Comment
comment on: http://stackoverflow.com/a/24082631
has text: Is it fine if I round it to 38 (in terms of quality), or am I supposed to send a partial frame?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/52164654
score: 0
comment on: http://stackoverflow.com/q/24079913
type: Comment
type: QuestionComment
has text: Updated to 1.6, error is gone. Yeah!

http://stackoverflow.com/comment/37165338
comment on: http://stackoverflow.com/q/24047613
score: 0
type: Comment
type: QuestionComment
has text: Appreciating your help @femtoRgon ...but yes, i did try that and i am sure that filepath string I sent is the same as that is indexed by the path field. If you know of any good or reliable examples of creating indexes and deleting documents from index, Could you please give me their links?

http://stackoverflow.com/a/24013693
has comment: http://stackoverflow.com/comment/37213171
has comment: http://stackoverflow.com/comment/37213503
type: Answer
has comment: http://stackoverflow.com/comment/37016014
score: 0
answers question: http://stackoverflow.com/q/24011016
has comment: http://stackoverflow.com/comment/37067157
has comment: http://stackoverflow.com/comment/37213023
has comment: http://stackoverflow.com/comment/37053713
has comment: http://stackoverflow.com/comment/37036252
has comment: http://stackoverflow.com/comment/37045862
has comment: http://stackoverflow.com/comment/37013782
has body: It seems that there is a problem in a particular plugin that you are using in your product, and that it is affecting your users. If the plugin developer isn't helping you, your options are limited: You could "bug him" about it ... but this probably won't help. You could offer him (or someone else) money to fix the problem. You could try to find and fix the problem for yourself (assuming that the plugin is open source). You could identify an alternative plugin with the functionality you require. You could implement a replacement plugin yourself ... or pay someone else to do it. From the technical perspective, I doubt that we can help you unless you explain in depth what the nature of the problem is, and what you have found. On the face of it, it sounds like a scalability issue; i.e. the plugin is using an SWT widget that does not work with huge files. If that is what the problem is, then the technical solution is probably to use the widget in a different way ... that avoids the issue. Opening 30Mb binary files in an editor is kind of pathological.
has comment: http://stackoverflow.com/comment/37013162
has comment: http://stackoverflow.com/comment/37043261

http://stackoverflow.com/a/44350672
upvote count: 1
downvote count: 0
type: Answer
has body: To get the shadow effect on the border, you can wrap the TextView in a CardView.
answers question: http://stackoverflow.com/q/23967255
score: 1

http://stackoverflow.com/q/23979791
type: UnansweredQuestion
tagged with: filewriter
has comment: http://stackoverflow.com/comment/36948994
tagged with: bufferedwriter
tagged with: stringreader
tagged with: java
type: Question
score: 0
has title: Change FileWriter to OutputStreamWriter?
has comment: http://stackoverflow.com/comment/36953764
has body: How do I convert the FileWriter to OutputStreamWriter? This is the directory that I stored the .java files. src/RX/example.java where RX is the package name. I inserted all the images and text files inside the same directory. Here is my working code with FileWriter. try { StringReader stringReader = new StringReader("Save this Message"); BufferedReader bufferedReader = new BufferedReader(stringReader); FileWriter fileWriter = new FileWriter("src/RX/rxUser.txt"); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); for(String line = bufferedReader.readLine(); line != null; line =bufferedReader.readLine()) { bufferedWriter.write(line); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } I actually can go on with this code but in order to work with .jar I have to use the .txt file as a resource. Can someone please alter my code. I am using Netbeans. Thank you.
has comment: http://stackoverflow.com/comment/36953402
tagged with: outputstream
answer count: 0
has comment: http://stackoverflow.com/comment/36948922

java-native-interface
tags question: http://stackoverflow.com/q/23944873
tags question: http://stackoverflow.com/q/24076624
tags question: http://stackoverflow.com/q/23971688
tags question: http://stackoverflow.com/q/24007635
tags question: http://stackoverflow.com/q/23946073
type: Tag
tags question: http://stackoverflow.com/q/23976044
tag name: java-native-interface
tags question: http://stackoverflow.com/q/23965907
tags question: http://stackoverflow.com/q/24054781
tags question: http://stackoverflow.com/q/24085430
tags question: http://stackoverflow.com/q/24068308
tags question: http://stackoverflow.com/q/23985558
tags question: http://stackoverflow.com/q/23944378
tags question: http://stackoverflow.com/q/23984734
tags question: http://stackoverflow.com/q/23963129
tags question: http://stackoverflow.com/q/23962972
tags question: http://stackoverflow.com/q/24044903
tags question: http://stackoverflow.com/q/23996032

http://stackoverflow.com/a/24048377
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: I experimented with exactly this problem before. If you merge the predefined folder with the path using something like new Path(basePath, givenRelativePath); then I do not know of anything other than .. that would cause the result outside the baseDir (providing there are no symlinks pointing outside, of course). Therefore, the simpliest check is to detect the presence of two consecutive dots, just like daniels suggests. If you want to be absolutely sure (and also handle symlinks or other potentially dangerous things), you may check the result like this (just a sketch): if (givenPath.indexOf("..") &gt;= 0) throw new IllegalArgumentException(); File result = new File(basePath, givenPath); if (!result.getCanonicalPath().startsWith(basePath.getCanonicalPath())) throw new IllegalArgumentException(); serveFile(result); This is basically what I ended with a couple of months ago. Of course, in Java 7+, you may use Paths and the normalize method instead of getCanonicalPath, which is faster and does not touch the filesystem. On the other hand, it does not consider symlinks and other stuff.
answers question: http://stackoverflow.com/q/24048077
has comment: http://stackoverflow.com/comment/37085847

http://stackoverflow.com/comment/37007117
comment on: http://stackoverflow.com/a/24010862
type: AnswerComment
type: Comment
has text: yes I tried easywsdl too but, that I am getting "method is available only fro premium user"
score: 1

http://stackoverflow.com/q/23946270
tagged with: graphhopper
has title: Indoor routing using Graphhopper
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36944687
score: 1
tagged with: java
has body: I am new to Graphhopper, I am building indoor routing. Currently everything worked fine in a floor. I was wondering how to use graphhopper to navigate/routing between floors? I know that Graphhopper support elevation, can I use it? Can someone give me advice. Thanks
has comment: http://stackoverflow.com/comment/36930653
type: Question
tagged with: openstreetmap
has comment: http://stackoverflow.com/comment/36951659
has comment: http://stackoverflow.com/comment/36951690
has answer: http://stackoverflow.com/a/34467122
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36908894
type: QuestionComment
has text: Your link is to a very old version of Derby. 10.10 is current. Support for the Eclipse plugins were dropped some time ago.
comment on: http://stackoverflow.com/q/23957246
score: 0
type: Comment

http://stackoverflow.com/comment/36931114
type: Comment
has text: @Onur I didn't get u mate?
comment on: http://stackoverflow.com/q/23969552
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37105504
score: 0
has text: It was FetchType.LAZY initially, but to no avail :(
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24038185

http://stackoverflow.com/comment/37092261
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24055272
has text: @VikalpPatel shouldn't the sort using a comparator as a second parameter work according to the comparator only? That's my understanding from http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html#sort(java.util.List,%20java.util.Comparator)
type: Comment

http://stackoverflow.com/a/24109388
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37198942
downvote count: 0
has comment: http://stackoverflow.com/comment/37220470
type: Answer
has body: I've done this before, It took me so long to figure out how to do it! The only problem is that the result still shows up if you were to use a regular leather helmet, but it just doesn't let you take the result out of the crafting table. Here's how I did it: public ShapedRecipie lvl1ArmorHeadRecipie(){ ShapedRecipe recipe = new ShapedRecipe(lvl2Head); recipe.shape("AAA", "ABA", "AAA"); recipe.setIngredient('A', Material.DIAMOND); recipe.setIngredient('B', Material.LEATHER_HELMET); return recipie; } public void lvl1ArmorHead(){ this.getServer().addRecipe(lvl1ArmorHeadRecipie()); //do everything in here normally } Next, use this. Make sure to make the class that this is in implement Listener @EventHandler public void craft(CraftItemEvent e){ if(e.getInventory() instanceof CraftingInventory){ CraftingInventory inv = (CraftingInventory) e.getInventory(); if(inv.getSize() != 4 &amp;&amp; e.getRecipe().equals(lvl1ArmorHelmetRecipe())){ ItemStack helm = inv.getMatrix()[4];//get the middle item in the bench, which is the helmet if(helm.hasItemMeta()){//make sure the helmet has item meta if(helm.getItemMeta().getDisplayName().equals("Better Helmet")){//make sure the helmet's display name is 'Better Helmet' //you're done! It works! Do something like tell the player "you have crafted better armor" or something here. return; } } //the return; above would have been called if the crafting had succeeded. When it got called, the remainder of this method would not run (this part will not be run if the crafting has succeeded) //send the player a message to make it more realistic here. For my wizardry server I use: 'One of thee items used was incorrect, and unbalanced the energy. The death block hath been destroyed' e.setCanceled(true); e.setResult(new ItemStack(Material.AIR)); } } }
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24103281
has comment: http://stackoverflow.com/comment/37316818
accepted answer of: http://stackoverflow.com/q/24103281
has comment: http://stackoverflow.com/comment/37316836

http://stackoverflow.com/q/23983590
score: 2
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/36957056
has comment: http://stackoverflow.com/comment/94475437
downvote count: 0
tagged with: vlcj
has comment: http://stackoverflow.com/comment/36970560
has comment: http://stackoverflow.com/comment/36970124
has comment: http://stackoverflow.com/comment/36966257
favorite count: 0
has title: vlcj Error handling
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36956986
type: UnansweredQuestion
has body: I'm working on a selfmade video-media-player in JavaFX and therefore I'm using vlcj. I'm using a DirectMediaPlayerComponent which renders the video to a canvas. Everthing fine up to here. The video plays smooth and also the controlls are working. However, sometimes i get a lot of RuntimeErrors which cause the canvas to turn black but the sound is still played, for example java.lang.IllegalArgumentException: Image dimensions must be &gt; 0 at com.sun.prism.Image.&lt;init&gt;(Image.java:271) at com.sun.prism.Image.&lt;init&gt;(Image.java:241) at com.sun.prism.Image.fromByteBgraPreData(Image.java:79) at com.sun.javafx.sg.prism.NGCanvas.renderStream(NGCanvas.java:591) at com.sun.javafx.sg.prism.NGCanvas.renderContent(NGCanvas.java:389) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:201) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:40) at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:201) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:40) at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:201) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:40) at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:201) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:40) at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420) at com.sun…
has comment: http://stackoverflow.com/comment/36969659

http://stackoverflow.com/comment/36906202
comment on: http://stackoverflow.com/q/23955391
type: QuestionComment
type: Comment
has text: java.lang.ClassNotFoundException: org.apache.jsp.new_jsp The server encountered an internal error that prevented it from fulfilling this request.
score: 0

http://stackoverflow.com/comment/36940012
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23975200
score: 1
has text: Yes, so the image is directly related/contained/managed by the `Card` class directly

http://stackoverflow.com/a/23980537
type: AcceptedAnswer
has body: It is using the default toString() method implementation of Object. public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } So you are getting output like com.example.week3.BlogPost@58d100c8. When you iterate over the ArrayList you need to typecast it to your BlogPosts Object and use it getter methods or overridden toString() to display it's content. You can do Object o = getServletContext().getAttribute("blogpost"); if( o instanceof ArrayList) { List blogList = (ArrayList) o; for(Object blog : blogList){ BlogPost blogPost = (BlogPost) blog; System.out.println(blogPost.getBlogtext()); } }
has comment: http://stackoverflow.com/comment/36950928
accepted answer of: http://stackoverflow.com/q/23980488
type: Answer
answers question: http://stackoverflow.com/q/23980488
has comment: http://stackoverflow.com/comment/36951012
has comment: http://stackoverflow.com/comment/36950110
score: 0

http://stackoverflow.com/comment/36941753
comment on: http://stackoverflow.com/a/23975859
type: Comment
has text: @StephenC No, you were right the first time. If I was in favour I hope I would have expressed it somewhat more elegantly :-|
score: 0
type: AnswerComment

http://stackoverflow.com/a/24059549
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37099968
has comment: http://stackoverflow.com/comment/37100590
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24058176
has comment: http://stackoverflow.com/comment/37100739
type: Answer
has body: Sounds like it was an Android Lint problem you suppressed - Java problems cannot be removed that way. You can re-enable it by editing lint.xml at the root of your project and removing the relevant &lt;ignore path="..." /&gt; rules there.
accepted answer of: http://stackoverflow.com/q/24058176
has comment: http://stackoverflow.com/comment/37098064

http://stackoverflow.com/comment/37008081
type: Comment
comment on: http://stackoverflow.com/a/24009697
has text: [link]http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_cmd_expressions.htm[/link] There it says that wild cards are supported :/
score: 0
type: AnswerComment

http://stackoverflow.com/a/24096901
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37167673
has comment: http://stackoverflow.com/comment/37167869
type: Answer
answers question: http://stackoverflow.com/q/24096836
has comment: http://stackoverflow.com/comment/37168074
has comment: http://stackoverflow.com/comment/37167703
has comment: http://stackoverflow.com/comment/37168597
has comment: http://stackoverflow.com/comment/37168261
has body: You don't need intents, just separate view and data, keep news in the singleton class, for example NewsManager, and keep one list for all news, one for favourite news, and use favourite list in the ListView2 adapter
has comment: http://stackoverflow.com/comment/37167727
accepted answer of: http://stackoverflow.com/q/24096836
has comment: http://stackoverflow.com/comment/37168355
score: 0
has comment: http://stackoverflow.com/comment/37167758
has comment: http://stackoverflow.com/comment/37167561

http://stackoverflow.com/q/23971439
linked to: http://stackoverflow.com/q/2937086
has answer: http://stackoverflow.com/a/23973765
answer count: 10
linked to: http://stackoverflow.com/q/76223
has answer: http://stackoverflow.com/a/23971816
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23971920
has body: I want to get the day on which the first Monday of a specific month/year will be. What I have: I basically have two int variables, one representing the year and one representing the month. What I want to have: I want to know the first Monday in this month, preferably as an int or Integer value. For example: I have 2014 and 1 (January), the first Monday in this month was the 6th, so I want to return 6. Problems: I thought I could do that with the Calendar but I am already having trouble setting up the calendar with only Year and Month available. Furthermore, I'm not sure how to actually return the first Monday of the month/year with Calendar. I already tried this: Calendar cal = Calendar.getInstance(); cal.set(this.getYear(),getMonth(), 1); int montag = cal.getFirstDayOfWeek(); for( int j = 0; j &lt; 7; j++ ) { int calc = j - montag; if( calc &lt; 0 ) { calc += 6; } weekDays[calc].setText(getDayString(calc)); }
has answer: http://stackoverflow.com/a/59423300
tagged with: java
downvote count: 2
has title: Get the first Monday of a month
has answer: http://stackoverflow.com/a/57083446
type: Question
has comment: http://stackoverflow.com/comment/36934099
upvote count: 12
possible better answer: http://stackoverflow.com/a/33867023
has comment: http://stackoverflow.com/comment/36933494
has answer: http://stackoverflow.com/a/24458358
score: 10
accepted answer: http://stackoverflow.com/a/23971816
has answer: http://stackoverflow.com/a/33867023
has answer: http://stackoverflow.com/a/23971790
has answer: http://stackoverflow.com/a/40992435
has answer: http://stackoverflow.com/a/36862419
favorite count: 0
has comment: http://stackoverflow.com/comment/36933487
has comment: http://stackoverflow.com/comment/36933973

http://stackoverflow.com/comment/37152323
score: 0
type: AnswerComment
type: Comment
has text: @ZaidKhan you need to 'export' your project in war bundle, executing war task of maven or ant. It's not difficult, for example in a maven project mvn package command should do the job.
comment on: http://stackoverflow.com/a/24088695

http://stackoverflow.com/a/24067813
answers question: http://stackoverflow.com/q/24067736
downvote count: 0
has comment: http://stackoverflow.com/comment/37114212
score: 10
has comment: http://stackoverflow.com/comment/39408856
has body: If you only have 9 possible values, you probably want counting sort - the basic idea is: Create an array of counts of size 9. Iterate through the array and increment the corresponding index in the count array for each element. Go through the count array and recreate the original array. The running time of this would be O(n + 9) = O(n), where-as the running time of the standard API sort will be O(n log n). So yes, this will most likely be faster than the standard comparison-based sort that the Java API uses, but only a benchmark will tell you for sure (and it could depend on the size of your data). In general, I'd suggest that you first try using the standard API sort, and see if it's fast enough - it's literally just 1 line of code (except if you have to define a comparison function), compared to quite a few more for creating your own sorting function, and quite a bit of effort has gone into making sure it's as fast as possible, while keeping it generic. If that's not fast enough, try to find and implement a sort that works well with your data. For example: Insertion sort works well on data that's already almost sorted (although the running time is pretty terrible if the data is far from sorted). Distribution sorts are worth considering if you have numeric data. As noted in the comment, Arrays.parallelSort (from Java 8) is also an option worth considering, since it multi-threads the work (which sort doesn't do, and is certainly quite a bit of effort to do yourself ... efficiently).
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37118589
upvote count: 10
type: Answer
accepted answer of: http://stackoverflow.com/q/24067736
has comment: http://stackoverflow.com/comment/37113730
has comment: http://stackoverflow.com/comment/37113622

http://stackoverflow.com/q/24021348
tagged with: static-initialization
tagged with: static
has title: Is static Initializer in JAVA a closure
type: UnansweredQuestion
upvote count: 4
has body: I was wondering if static Initializer in Java as shown below is a closure which groovy built on to implement the language. public class className{ static{ } } Thanks.
tagged with: java
type: Question
score: 3
tagged with: closures
has answer: http://stackoverflow.com/a/24021585
has comment: http://stackoverflow.com/comment/37026876
tagged with: groovy
has comment: http://stackoverflow.com/comment/37102009
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/24069823
answer count: 2
has body: I am logging something to a MySQL database with a Java program, and I was wanting to create a table if the one I wanted to use did not exist. How would I got about creating a table through Java? (If clerification is needed, please say so). P.S. before you say this question is a duplicate of this question, that question did not answer mine.
has comment: http://stackoverflow.com/comment/37117341
has title: How to create a MySQL table in Java?
score: 0
has answer: http://stackoverflow.com/a/24069950
tagged with: sql
has comment: http://stackoverflow.com/comment/37117602
favorite count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/20665323
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24069989
downvote count: 1
type: Question

http://stackoverflow.com/comment/37136423
has text: Does the service run the code on the MainThread by default?
comment on: http://stackoverflow.com/q/24078865
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24003719
has title: How to use libraries within a java file
has answer: http://stackoverflow.com/a/24003807
score: -2
linked to: http://stackoverflow.com/q/7485670
tagged with: java
downvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/24003807
has body: I have downloaded a library which contains some methods within some classes that I would like to use. The library I have downloaded is the apache common lang package and I have the "commons-lang3.jar" file, I am trying to set a classpath using the environment variables in windows 7 but it doesn't do anything. Can someone check if I am doing this right: User variables for Me: Variable: PATH, Value: C:\Users\Me\Documents\JavaLib\commons-lang3.jar, JavaLib is a file I have created which contains commons-lang3.jar on its own. Java file name: Myclass.java command typed into cmd: javac Myclass.java Error returned: error: package org.apache.commons.lang3 does not exist Myclass.java contains: import org.apache.commons.lang3.StringUtils; and it can't find it even though I have put it into my environment variables. What have I done wrong?
linked to: http://stackoverflow.com/q/4910964
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36994417
type: Question

http://stackoverflow.com/a/24032374
downvote count: 0
has body: You should read the file using something like that: Read the file to a String usign Files.readAllbytes() and then split the content into a list of Strings: Then you should apply some java project like apache POI here is a example using excel: http://poi.apache.org/spreadsheet/how-to.html#sxssf Good luck!!
answers question: http://stackoverflow.com/q/24032136
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/38069126
comment on: http://stackoverflow.com/q/24056776
type: Comment
type: QuestionComment
has text: Just tried to change "spring-data-mongodb" to an older Version. Using "1.2.0.RELEASE" now throws an IllegalStateException "this Mongo has been closed", also at com.mongodb.DBTCPConnector (I'll update the question with the error message). But it does not change the behaviour - using XML for configuration results in an error. PS: Just tried the release Version 1.5.1.RELEASE, same issue.
score: 0

http://stackoverflow.com/q/24089806
has comment: http://stackoverflow.com/comment/37154394
tagged with: java
has body: Okay so what I have so far is a gui(In Java) and a program(In Python). I want the button in the gui when pressed to send the outputs to the python program and to run it. I then want the gui program to display the python print commands in the text box on the right side. So, my question is, is this possible and how would I go about making it work? GUI import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class dogedice extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField textField; private JComboBox combo; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { dogedice frame = new dogedice(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public dogedice() { setTitle("DogeDice Bot"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); contentPane.add(panel, BorderLayout.WEST); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 0}; gbl_panel.rowHeights = new int[]{0, 0}; gbl_panel.columnWeights = new double[]{0.0, 1.0}; gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); //Every new Label however needs every part that says "user" or on the Password: "pass" changed to something unique. JLabel userTag = new JLabel("Username:"); GridBagConstraints gbc_userTag = new GridBagConstraints(); gbc_userTag.insets = new Insets(0, 0, 0, 5); gbc_userTag.anchor = GridBagConstraints.EAST; gbc_userTag.gridx = 0;//Here are your x + y coords gbc_userTag.gridy = 0;//Adding to x moves left, adding to y moves down panel.add(userTag, gbc_userTag); //Every new textfield needs…
type: Question
has title: Can a Java GUI control a Python backend?
answer count: 1
has answer: http://stackoverflow.com/a/24089943
favorite count: 0
score: 8
tagged with: python
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24089943
upvote count: 9

http://stackoverflow.com/q/24082837
upvote count: 1
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/11740013
accepted answer: http://stackoverflow.com/a/24083483
has body: If I need to retrieve some collection of objects (assume its some Client), lets say from DB. So there are two possibilities: 1 in some class-receiver I would declare like: ... private final List&lt;Client&gt; clients = new ArrayList&lt;Client&gt;(); ... // the fillinng method: fillClients(){ dbHelper.getClients(clients); } So dbHelper's method will receive a ready to use collection it would NOT CREATE A NEW OBJECT (a list) but it will clear and fill the existing one, like: public void getClients(List&lt;Client&gt;clients){ clients.clear(); ... while(cursor.moveToNext()) clients.add(new Client(...)); ... return; } And the other one pattern is: ... private List&lt;Client&gt; clients; ... // the fillinng method: fillClients(){ clients = dbHelper.getClients(); } So the corresponding method gonna CREATE A NEW OBJECT (a list): public List&lt;Client&gt; getClients(){ List&lt;Client&gt;clients = new ArrayList&lt;Client&gt; clients; ... while(cursor.moveToNext()) clients.add(new Client(...)); ... return clients; } The question is related to a fact that a new object creating is a valuable operation.
has title: What is more efficient: new ArrayList() vs clear()+add()?
score: 0
has comment: http://stackoverflow.com/comment/37142765
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37140484
type: AnsweredQuestion
tagged with: performance
tagged with: java
linked to: http://stackoverflow.com/q/11740013
has answer: http://stackoverflow.com/a/24083483

http://stackoverflow.com/a/24087543
has comment: http://stackoverflow.com/comment/37149789
answers question: http://stackoverflow.com/q/24087510
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: Yup, you got it right. java.util.Arrays is a class with a bunch of helper methods - if you don't intended on using them, you don't need to import the class.

http://stackoverflow.com/comment/37184052
has text: You should be able to call it like any other class
comment on: http://stackoverflow.com/a/24103723
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23983618
answers question: http://stackoverflow.com/q/23983593
score: 2
downvote count: 0
type: Answer
has body: You need GridBagLayout in this case instead of GridLayout. Have a look at How to Use GridBagLayout where it is explained in details along with sample code of below snapshot. Is this what you want?
upvote count: 2

http://stackoverflow.com/comment/36929731
score: 0
type: Comment
type: QuestionComment
has text: Thank you!!! I know it's okay for the program to run on a specific directory but when i passed it to my instructor and he copied to another folder...the program can't locate the folder I specified...so he said i should work on it.... Now I want the program to get the destination folder where ever i put the program....
comment on: http://stackoverflow.com/q/23967602

http://stackoverflow.com/comment/37162366
has text: @EASI C# covers all those platforms and more
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24092731
score: 0

http://stackoverflow.com/q/24047500
has body: I have a web application built with Spring and running inside Jboss. I am trying, at runtime, to scan for classes that have a certain annotation. Right now I am using the open source Reflections library public static List&lt;Class&gt; scanForClassesWithAnnotation(Class&lt;? extends Annotation&gt; annotationClass) { List&lt;Class&gt; classesWithAnnotation = new ArrayList&lt;&gt;(); for(Package p : Package.getPackages()) { LOGGER.info("scanForClassesWithAnnotation: Examining package " + p.getName()); try { List&lt;ClassLoader&gt; classLoadersList = new ArrayList&lt;&gt;(); classLoadersList.add(ClasspathHelper.contextClassLoader()); classLoadersList.add(ClasspathHelper.staticClassLoader()); Reflections reflections = new Reflections( new ConfigurationBuilder() .setScanners(new SubTypesScanner(false), new ResourcesScanner()) .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[classLoadersList.size()]))) .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(p.getName())))); Set&lt;Class&lt;?&gt;&gt; classes = reflections.getSubTypesOf(Object.class); LOGGER.info("\tscanForClassesWithAnnotation: found classes " + JsonUtils.objectToJson(classes)); for(Class foundClass : classes) { if(foundClass.isAnnotationPresent(annotationClass)) { classesWithAnnotation.add(foundClass); } } } catch (Exception ignored) {} } return classesWithAnnotation; } When this code executes I see many of these such messages in the log: given scan urls are empty. set urls in the configuration This code works in a standalone Maven project, so I know it works in general. But I think the problem is with the fact that the code is running in a servlet context. How do I fix this? How do I scan for classes with an annotation in a Spring webapp? Thanks in advance.
score: 0
type: UnansweredQuestion
tagged with: annotations
tagged with: spring
tagged with: spring-mvc
tagged with: reflections
tagged with: java
has answer: http://stackoverflow.com/a/24048282
type: Question
answer count: 2
has title: How Do I Scan for Annotation in Spring Web App Using Reflections Library (or other)
has answer: http://stackoverflow.com/a/24048441

http://stackoverflow.com/a/24082048
answers question: http://stackoverflow.com/q/24079695
score: 0
has comment: http://stackoverflow.com/comment/37140750
has body: The common paradigm for photos that are taken with "take a picture" and "record a video" is to then let the user share them to a contact. That contact can be created and managed by a PHP server and can be on the receiving end of the media item being sent. This wouldn't involve any Java/Android code at all on your end. Take a look at information about the Mirror API. In particular, you will want to setup a Contact and subscribe to responses for the same.
type: Answer

http://stackoverflow.com/comment/37201012
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24103281
has text: You should also cancel the event if the item has no metadata.

http://stackoverflow.com/q/23981598
has title: SQLite and reading database from runnable .jar
type: Question
score: 0
tagged with: sqlite
has comment: http://stackoverflow.com/comment/36955300
tagged with: executable-jar
has body: I was struggling a lot last few hours to make my swing project making use of sqlite database to work from runnable jar. What I came up with was that I had to make jar, then copy existing .db files to the same location and then hit the wall. One of my db files contains logins and passwords and I couldn't get logged in for no obvious reason. This problem existed while double clicking, or right-clicking to execute. When I started my jar from command line I was finally able to use logins &amp; passwords from my database and correctly read all the data from my database. Still, need an explenation why command line works and others don't. Also, how to solve my problem and make it runnable on click? Any help will be greatly appreciated and thanks for your time.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36952830
tagged with: java

http://stackoverflow.com/comment/37011178
type: Comment
comment on: http://stackoverflow.com/a/24012798
has text: `XML path //*[name()='n2:code']/text() doesn't match.`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37130819
type: QuestionComment
comment on: http://stackoverflow.com/q/24077045
score: 1
has text: Only profiling will tell you what is most efficient for your use-case, But removing from a linked list only requires updating two fields per removal, whereas removing from an array list usually requires moving numerous elements. The performance differences are listed in this post here: http://stackoverflow.com/a/322742/3651800
type: Comment

http://stackoverflow.com/comment/37140678
has text: my problem is similar to this http://stackoverflow.com/questions/20814260/move-a-ball-on-mouse-click-in-java?rq=1 all i want to know is whether a loop can be built inside a mouselistener or not.if not what to do to acheive this
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24078486
type: QuestionComment

http://stackoverflow.com/q/23995683
has body: In my experience, package-private visibility for classes in Java is turning out to be redundant. Package-private visibility seems to be based on the premise that a class which is almost-privately used by another class is likely to be kept in the same package. Often this is not the case. Is someone exploring an improved access modifier/alternate mechanism? Problem with trying to use package-private visibility: We are tempted to put functionally unrelated classes in same package to get this benefit Problem with using public instead: APIs get polluted. Once a library Jar is imported, client sees several other public classes that he has no need to be worried about From a coding-standards perspective, there is no easy way to ensure that short-circuit calls are not done by developers on time crunches (By short-circuit calls I mean method calls that bypass a layer (like from Servlet direct to DAO bypassing the bean/BO) The current workaround: To dissuade short-circuit calls we usually package different parts of the application into several JARs and ensure only the respective JARs are available in the build environment for each build. (For example server.jar would not be available while compiling swing client classes. Only client classes and common.jar would be available.) Questions: Wouldn't it be useful to come up with a new visibility modifer/alternative? Is something along these lines already in pipeline? Are frameworks like Spring/Guice sufficient replacements?
has answer: http://stackoverflow.com/a/38675602
tagged with: java
tagged with: class-visibility
accepted answer: http://stackoverflow.com/a/38675602
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/20634993
linked to: http://stackoverflow.com/q/35913860
downvote count: 0
has title: Improvement of package-private classes in Java
linked to: http://stackoverflow.com/q/8647565
favorite count: 0
has answer: http://stackoverflow.com/a/23995911
tagged with: coding-style
linked to: http://stackoverflow.com/q/11844829
has comment: http://stackoverflow.com/comment/36988871
upvote count: 3
has comment: http://stackoverflow.com/comment/36981889
possible better answer: http://stackoverflow.com/a/23995911
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/59791365
downvote count: 0
answers question: http://stackoverflow.com/q/23957760
has body: Solution for Java 9+: Arrays.equals(indicator, 0, 5, current, 0, 5);
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/24016962
upvote count: 170
tagged with: default-method
accepted answer: http://stackoverflow.com/a/24026292
possible better answer: http://stackoverflow.com/a/24017280
answer count: 5
has body: Default methods are a nice new tool in our Java toolbox. However, I tried to write an interface that defines a default version of the toString method. Java tells me that this is forbidden, since methods declared in java.lang.Object may not be defaulted. Why is this the case? I know that there is the "base class always wins" rule, so by default (pun ;), any default implementation of an Object method would be overwritten by the method from Object anyway. However, I see no reason why there shouldn't be an exception for methods from Object in the spec. Especially for toString it might be very useful to have a default implementation. So, what is the reason why Java designers decided to not allow default methods overriding methods from Object?
has answer: http://stackoverflow.com/a/24017280
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36641849
downvote count: 0
has answer: http://stackoverflow.com/a/24017637
has answer: http://stackoverflow.com/a/46009669
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/90020442
tagged with: interface
has answer: http://stackoverflow.com/a/24026292
tagged with: java-8
score: 170
has title: Java8: Why is it forbidden to define a default method for a method from java.lang.Object
tagged with: java

http://stackoverflow.com/q/24024481
accepted answer: http://stackoverflow.com/a/24024857
tagged with: daemon
has body: I have written a small tcp server daemon in Java which is executed using the following code: TCPServer serv = new TCPServer(); serv.run(); Now, I want to take this code from development into enterprise deployment, however, as I am not familiar with enterprise Java, I was wondering how to best possibly deploy this application as a production ready daemon. I have tried to think what I really need and the answer is: Start the server Stop a running server Check if the server is still running Restart the service (I guess this one is easy given the other ones) Refresh the daemon configuration without service disruption Furthermore, I might want/need to send specific commands to the service during runtime to modify the behaviour slightly, but this is of less importance at the moment. I have some experience with servlet containers, but I am kind of loss once the application is not longer a http/https service. Are there any best practices for how to deploy and manage such Java-based services?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24024857
type: Question
score: 0
has title: java server daemon deployment options
answer count: 1

http://stackoverflow.com/a/24035175
has comment: http://stackoverflow.com/comment/37052684
accepted answer of: http://stackoverflow.com/q/24034894
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/37202930
score: 2
has body: You only need to iterate with your list songElements to retrieve all the elements, for example: SAXBuilder builder = new SAXBuilder(); File xmlFile = new File("flowmodeling.xml"); Document document = (Document) builder.build(xmlFile); Element e = document.getRootElement(); List&lt;Element&gt; songElements = document.getRootElement().getChildren("Flow"); for(Element element : songElements) { Element apiName = element.getChild("ApiName"); System.out.println(apiName.getAttribute("name")); Element request = apiName.getChild("Request"); System.out.println(request.getValue()); Element response = apiName.getChild("Response"); System.out.println(response.getValue()); } Hope it helps.
answers question: http://stackoverflow.com/q/24034894
has comment: http://stackoverflow.com/comment/37204941
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37052588
downvote count: 0

http://stackoverflow.com/comment/37146193
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24084155
score: 0
has text: I hv corrected it..! Anyways thanks Jonathan for pointing it..! Just after i posted my query i realized it.

http://stackoverflow.com/comment/37159424
type: Comment
type: QuestionComment
has text: post images where? on the game? then yes but they are TextureRegions and you cannot rotate textureRegions. there is a way but it is too hard for me.
comment on: http://stackoverflow.com/q/24092482
score: 0

http://stackoverflow.com/comment/40163757
has text: Thanks. I will definitely take a look at this.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25693784

http://stackoverflow.com/comment/37002671
type: Comment
comment on: http://stackoverflow.com/a/23994187
has text: Then you should better check the server API documentation; maybe something else is wrong (XML syntax, ...). Also inspect the error message that might come together with the error response. And do some tests using a REST-Client (e.g. Browser Plugin) to ensure the API works as expected.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24028311
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/37039986
downvote count: 0
has answer: http://stackoverflow.com/a/24360392
has comment: http://stackoverflow.com/comment/37059058
has title: Error when creating Grails project using GGTS
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24042427
tagged with: grails
has comment: http://stackoverflow.com/comment/37065845
type: Question
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/24360392
has comment: http://stackoverflow.com/comment/37066040
has answer: http://stackoverflow.com/a/24042427
has comment: http://stackoverflow.com/comment/37065238
has comment: http://stackoverflow.com/comment/37040517
tagged with: groovy
has body: I just downloaded GGTS and Grails. When I was trying to create a Grails project via the button "CREATE GRAILS PROJECT" on the dash board, it shows this error after a while: Errors occurred during the build. Errors running builder 'Java Builder' on project 'test'.org.codehaus.groovy.runtime.DefaultGroovyMethods.count(Ljava/lang/Iterable;Lgroovy/lang/Closure;)Ljava/lang/Number; I am using 64-bit Windows 7, with JDK 1.7.0 build 51 (64-bit), Grails 2.4.0, and GGTS 3.5.1 with Eclipse 4.3.2. Also, the Groovy Compiler version is 2.1.8. The project can still be built, but with an error alert whenever I tried the run it. And it runs fine (I didn't add anything, it just shows the welcome page fine). I can build a project with grails create-app in cmd.

http://stackoverflow.com/a/24080529
has body: mongo plugin of ver. 3.0.0 should have aggregation support. if you have some limitations, see how it's possible to enable aggregation in Grails pre-2.x version Aggregations in gmongo 0.9.1
has comment: http://stackoverflow.com/comment/50260532
answers question: http://stackoverflow.com/q/24075537
has comment: http://stackoverflow.com/comment/50276672
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/50295180

http://stackoverflow.com/a/24057065
has comment: http://stackoverflow.com/comment/37097848
has comment: http://stackoverflow.com/comment/37097424
has comment: http://stackoverflow.com/comment/37101418
score: 2
has comment: http://stackoverflow.com/comment/37101481
upvote count: 2
has body: Try out this Code: DateFormat inDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // inputFormat DateFormat TodayDF = new SimpleDateFormat("HH'h'mm"); //OutputFormat For today and yesterday DateFormat FullDF = new SimpleDateFormat("dd MMM - HH'h'mm"); //Outputformat long Date inDate = inDF.parse("2014-06-05 17:50:50"); //calendar for inputday Calendar inCal = new GregorianCalendar(); inCal.setTime(inDate); //startOfToday Calendar cStartOfDate = new GregorianCalendar(); cStartOfDate.set(Calendar.HOUR_OF_DAY, 0); cStartOfDate.set(Calendar.MINUTE, 0); cStartOfDate.set(Calendar.SECOND, 0); cStartOfDate.set(Calendar.MILLISECOND, 0); //endOfToday Calendar cEndOfDate = new GregorianCalendar(); cEndOfDate.set(Calendar.HOUR_OF_DAY, 23); cEndOfDate.set(Calendar.MINUTE, 59); cEndOfDate.set(Calendar.SECOND, 59); //startOfYesterday Calendar cStartOfYesterday = new GregorianCalendar(); cStartOfYesterday.set(Calendar.HOUR_OF_DAY, 0); cStartOfYesterday.set(Calendar.MINUTE, 0); cStartOfYesterday.set(Calendar.SECOND, 0); cStartOfYesterday.set(Calendar.MILLISECOND, 0); //endOfYesterday Calendar cEndOfYesterday = new GregorianCalendar(); cEndOfYesterday.set(Calendar.HOUR_OF_DAY, 23); cEndOfYesterday.set(Calendar.MINUTE, 59); cEndOfYesterday.set(Calendar.SECOND, 59); if (cStartOfDate.before(inCal) &amp;&amp; cEndOfDate.after(inCal)){ System.out.println("Today "+TodayDF.format(inDate)); } else if (cStartOfYesterday.before(inCal) &amp;&amp; cEndOfYesterday.after(inCal)){ System.out.println("Yesterday"+TodayDF.format(inDate)); } else { System.out.println(FullDF.format(inDate)); }
has comment: http://stackoverflow.com/comment/37095676
answers question: http://stackoverflow.com/q/24056453
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37097926
accepted answer of: http://stackoverflow.com/q/24056453
type: Answer
has comment: http://stackoverflow.com/comment/37097654

http://stackoverflow.com/comment/36884312
has text: Sorry but I find it hard to understand your question. Can you please give specific example of what you're trying to achieve
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23945037
type: Comment

http://stackoverflow.com/q/23963122
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: network-programming
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36921573
tagged with: ssl
favorite count: 0
has title: Issue in executing SSL TLS client server Java programs
has answer: http://stackoverflow.com/a/30467055
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/98776185
tagged with: sockets
has body: I have just started studying SSL TLS in Java and written the simple client and server programs. I run the server program first, followed by the client program. On execution, the client program gives the following exception stack trace :- Exception in thread "main" javax.net.ssl.SSLHandshakeException: no cipher suites in common at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ServerHandshaker.chooseCipherSuite(Unknown Source) at sun.security.ssl.ServerHandshaker.clientHello(Unknown Source) at sun.security.ssl.ServerHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.process_record(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source) at sun.security.ssl.AppInputStream.read(Unknown Source) at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) at sun.nio.cs.StreamDecoder.implRead(Unknown Source) at sun.nio.cs.StreamDecoder.read(Unknown Source) at java.io.InputStreamReader.read(Unknown Source) at java.io.BufferedReader.fill(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at SSLServer.main(SSLServer.java:19) Please let me know the solution to this problem. The server and client programs are as follows :- import java.io.BufferedReader; import java.io.InputStreamReader; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSocket; public class SSLServer { private static final int PORT = 8080; public static void main(String[] args) throws Exception { SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFacto…

http://stackoverflow.com/q/24037248
downvote count: 0
has answer: http://stackoverflow.com/a/24038081
has title: Alignment in Vaadin
favorite count: 0
has answer: http://stackoverflow.com/a/40329975
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24038081
answer count: 3
possible better answer: http://stackoverflow.com/a/24038021
has answer: http://stackoverflow.com/a/24038021
tagged with: java
tagged with: vaadin
type: AnsweredQuestion
score: 2
has body: I have the following piece of code that I wrote in Vaadin. The problem is that the alignment does not work. I set it to bottom_center, but the components are all stuck to the top (top_center) of my web browser. Can anyone help me out with this? Thanks! VerticalLayout layout = new VerticalLayout(); VerticalLayout layout1 = new VerticalLayout(); Panel panel = new Panel(); panel.setWidth("500px"); panel.setHeight("300px"); Button button = new Button("Enter"); Button login = new Button("Login"); layout1.addComponent(textfield); layout1.addComponent(button); layout1.addComponent(login); layout.addComponent(panel); layout.setComponentAlignment(panel, Alignment.BOTTOM_CENTER); layout1.setComponentAlignment(textfield, Alignment.BOTTOM_CENTER); layout1.setComponentAlignment(login, Alignment.BOTTOM_CENTER); layout1.setComponentAlignment(button, Alignment.BOTTOM_CENTER);

http://stackoverflow.com/q/24024385
tagged with: amazon-elastic-beanstalk
favorite count: 0
has title: Access Tomcat root application under different path (on AWS/Elastic Beanstalk)
has body: We are deploying a webapp (.war file) from a legacy system where we have full control over our Tomcat instances to Amazon's Elastic Beanstalk instances. On our own systems, we access the web app as a path (e.g. http://server-name/my-app if we deploy my-app.war), but Elastic Beanstalk renames our war-file to ROOT.war and hence makes the web app available under http://server-name, which breaks our existing applications. As per the AWS documentation, we have added a config file under WEB-INF/.ebextensions that copies the following custom context.xml-file to /etc/tomcat7/Catalina/localhost/ROOT.xml: <?xml version='1.0' encoding='utf-8'?> WEB-INF/web.xml We have tried different versions of this file, e.g. omitting docBase, specifying docBase="ROOT", using the aliases parameter etc., providing the full path to the ROOT directory etc., but none has made our WAR-file accessible under the /my-app path. Finally, we also tried putting this -definition under the <Host /> section in server.xml, but to no avail. Any suggestions? Update: when adding the following to server.xml under the <Host/>-definition, I'm able to access my-app under the correct path, but it seems that Tomcat on EB is deploying my application twice now:
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24491601
accepted answer: http://stackoverflow.com/a/24491601
type: Question
has comment: http://stackoverflow.com/comment/73571485
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/60221375
has answer: http://stackoverflow.com/a/38601417
answer count: 2
upvote count: 7
tagged with: amazon-ec2
possible better answer: http://stackoverflow.com/a/38601417
tagged with: amazon-web-services
tagged with: tomcat

http://stackoverflow.com/comment/36993374
type: Comment
has text: It's strange, have you tried moving the file to another (simplier) path? like the home directory? (or at least one without spaces in its name?)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24002896

http://stackoverflow.com/comment/36961947
comment on: http://stackoverflow.com/a/23986725
score: 0
type: AnswerComment
has text: Too much Python. Thanks, fixed :)
type: Comment

http://stackoverflow.com/q/23960060
tagged with: java
tagged with: unit-testing
type: Question
has title: How to create a sort of abstract super test class in JUnit 4?
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/23960260
answer count: 1
tagged with: junit
downvote count: 0
has body: Consider the following concrete scenario: Someone has created a lot of tests that fully test the functionality to which a class implementing Collection&lt;E&gt; must adhere. How is it then possibly to use that test class (in some way) to test concrete implementations of Collection&lt;E&gt;? By example: public class CollectionTest { //lots of tests here } public class ACollection&lt;E&gt; implements Collection&lt;E&gt; { //implementation and custom methods } public class BCollection&lt;E&gt; implements Collection&lt;E&gt; { //implementation and other custom methods } How should I then write the test classes such that least code duplication occurs? public class ACollectionTest { //tests for Collection&lt;E&gt;, preferably not duplicated //tests for custom methods } public class BCollectionTest { //tests for Collection&lt;E&gt;, preferably not duplicated //tests for other custom methods } In other words, is it possible to "extend CollectionTest", but have its tests run on an instance of ACollectionTest or BCollectionTest (or more)? Note that the methods are still accessible once you use ACollection&lt;E&gt; as Collection&lt;E&gt; for example.
favorite count: 0
has comment: http://stackoverflow.com/comment/36912552
accepted answer: http://stackoverflow.com/a/23960260
linked to: http://stackoverflow.com/q/6724401
type: AnsweredQuestion

http://stackoverflow.com/q/24025097
tagged with: minecraft
has answer: http://stackoverflow.com/a/58776522
answer count: 5
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/37034574
has answer: http://stackoverflow.com/a/29948875
favorite count: 0
upvote count: 8
type: Question
downvote count: 2
has answer: http://stackoverflow.com/a/24067417
has answer: http://stackoverflow.com/a/27074247
has answer: http://stackoverflow.com/a/27556727
tagged with: java
tagged with: eclipse
has title: Where are the source files for forge?
has body: When I try to open Block.class, or any other classes from the same package as Block.class, eclipse will say: "the source attachment does not contain the source for the Block.class. You can change the source attachment by clicking Change Attached Source below:" What did I do wrong? Where's the source code then? Also, when I type "extends Block", and hover my cursor over the word "Block" this appears: net.minecraft.init.Blocks Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
tagged with: minecraft-forge

http://stackoverflow.com/a/24008774
has comment: http://stackoverflow.com/comment/37008124
has comment: http://stackoverflow.com/comment/37004088
has comment: http://stackoverflow.com/comment/37007751
has comment: http://stackoverflow.com/comment/37004465
has comment: http://stackoverflow.com/comment/37008898
has comment: http://stackoverflow.com/comment/37006901
accepted answer of: http://stackoverflow.com/q/24008081
downvote count: 0
has comment: http://stackoverflow.com/comment/37006187
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24008081
upvote count: 2
has comment: http://stackoverflow.com/comment/37003874
has comment: http://stackoverflow.com/comment/37005428
type: Answer
has body: AdapterViewFlipper would be the best way to go since, in a ViewFlipper you need to pre define the views. Inside onCreate : ArrayList&lt;String&gt; urls; //Fetch and set urls to this ArrayList; AdapterViewFlipper flipper = (AdapterViewFlipper) findViewById(R.id.flipper); flipper.setAdapter(new FlipperAdapter(urls)); FlipperAdapter.java For loading image from urls, I'd suggest the use of the Universal Image Loader library : https://github.com/nostra13/Android-Universal-Image-Loader public class FlipperAdapter extends BaseAdapter { ArrayList&lt;String&gt; urls; public FlipperAdapter(ArrayList&lt;String&gt; urls) { this.urls = urls; } @Override public int getCount() { // TODO Auto-generated method stub return urls.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return urls.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = (LinearLayout) LayoutInflater.inflate( R.layout.viewLayout, parent, false); } ImageView image = (ImageView) convertView.findViewById(R.id.image); imageLoader.displayImage(urls.get(position), image, null); return convertView; } } Edit 1 : viewLayout.xml (This will contain the layout of the items you want to display inside the adapterViewFlipper) &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;/RelativeLayout&gt;
has comment: http://stackoverflow.com/comment/37007832
has comment: http://stackoverflow.com/comment/37008253
score: 2

http://stackoverflow.com/comment/37030421
type: QuestionComment
comment on: http://stackoverflow.com/q/24022780
score: 0
has text: It's been running for a week and has over 4 million documents, what is the criteria for a merge being performed?
type: Comment

http://stackoverflow.com/q/23956734
tagged with: calendar
type: Question
possible better answer: http://stackoverflow.com/a/23956779
has answer: http://stackoverflow.com/a/23956779
has body: I have the following line STATUS | webapp | 2014/05/26 15:03:13 | Starting the service... Now I shall have to extract hour minute and second from the line.. I came up with this code.. BufferedReader bin = new BufferedReader(new FileReader(wrapperFile)); s = bin.readLine(); final Scanner sc = new Scanner(s); final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); while (sc.hasNextLine()) { final String line = sc.nextLine(); final Date date = dateFormat.parse(line); final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); System.out.print(calendar.get(Calendar.HOUR)); System.out.print(calendar.get(Calendar.MINUTE)); System.out.print(calendar.get(Calendar.SECOND)); } But parser exception was thrown.. Is there any workaround to this problem..??
tagged with: date
has answer: http://stackoverflow.com/a/23956774
upvote count: 2
answer count: 3
has title: Regular Expression to extract hour minute second from a line
tagged with: parsing
favorite count: 0
tagged with: regex
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23956916
accepted answer: http://stackoverflow.com/a/23956916

http://stackoverflow.com/a/24105464
score: 1
has body: Another option is to use Unicode characters depicting playing cards. That way you could just use a string to store the character representing the card, and display it, as long as you use a font that supports it.
upvote count: 1
answers question: http://stackoverflow.com/q/24099720
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37009480
type: QuestionComment
has text: It is. Nevertheless where your values come from `Month = 03 AND Month = 02` is contradictory. The query you posted is just not representing what you're intended to query. Your intention was to query `Month = 02 OR Month = 03` which is the same as `Month in (02, 03)`.
comment on: http://stackoverflow.com/q/24011386
score: 0
type: Comment

http://stackoverflow.com/comment/36915400
has text: /mnt/edocs/DEV/SCAN/DONE should work. Did you check if this location actually exists?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23961676
score: 1

http://stackoverflow.com/q/23941947
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36878313
has answer: http://stackoverflow.com/a/23942712
has comment: http://stackoverflow.com/comment/36878301
tagged with: repaint
type: UnansweredQuestion
has title: java double buffer doesn't erase
tagged with: paint
tagged with: java
tagged with: doublebuffered
type: Question
has comment: http://stackoverflow.com/comment/36878280
has body: I am doing a project with double buffering. When I paint, it simply paints on top of the old layers, but I need to erase them. Repaint() didn't work, but I'm guessing something equally as simple is the answer. Any ideas? Added code, and now it disappears, but it erases the background color. public void paint(Graphics g) { super.paint(buffer); for(Projectile p: projectiles) drawRectImage(buffer, p.image, p.getRectangle()); }

http://stackoverflow.com/comment/37181032
score: 0
comment on: http://stackoverflow.com/q/24103532
type: Comment
type: QuestionComment
has text: Please clarify. I have no idea what you are asking for.

http://stackoverflow.com/a/24096010
has body: Take a look at this Question on SubQueries in JPA 2.0. Looks to me like you're missing the Path, which maps the main query to the sub query?
answers question: http://stackoverflow.com/q/24095083
score: 0
type: Answer

http://stackoverflow.com/q/23963903
has title: INSTALL_FAILED_MISSING_SHARED_LIBRARY and UNEXPECTED TOP-LEVEL EXCEPTION
accepted answer: http://stackoverflow.com/a/23964003
tagged with: compilation
has body: So I'm working on an android app that implements the Caldroid library. At first when I tried to build the app I got a DexException. I fixed that by deleting the android-support-v4.jar file from Syncc/app/build/exploded-aar/Syncc/caldroid/unspecified/libs 'Syncc' is the name of the app and 'app' is the module. I'm not quite sure what that means (If someone could clarify that I'd be very grateful) but it's the way AndroidStudio makes it. So after removing that file when I try to build the app it works but installing it to my device doesn't. The terminal says the following: Waiting for device. Target device: samsung-gt_n7100-4d005d114bf9604f Uploading file local path: C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\apk\app-debug-unaligned.apk remote path: /data/local/tmp/com.nttkjwmp.syncc.app Installing com.nttkjwmp.syncc.app DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.nttkjwmp.syncc.app" pkg: /data/local/tmp/com.nttkjwmp.syncc.app Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] Here is the terminal output when I put the file back in: Error:Execution failed for task ':app:dexDebug'. &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\Nicolas\AppData\Local\Android\android-studio\sdk\build-tools\android-4.4.2\dx.bat --dex --output C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\dex\debug C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\classes\debug C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\dependency-cache\debug C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\pre-dexed\debug\android-support-v4-dcbacb5a563a38baf2818d3992287104d67e74f2.jar C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\pre-dexed\debug\classes-1d8979f21bebf58bb6900d1b0d10af9c29510f44.jar C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\pre-dexed\debug\classes-848439748d02ee11d97f22ad9f7789545209e0f1.jar C:\Users\Nicolas\AndroidStudioProjects\Syncc\app\build\pre-dexed\debug\date4j-b11e34e16255b8734f64d…
has comment: http://stackoverflow.com/comment/36920062
has comment: http://stackoverflow.com/comment/36919918
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36919856
favorite count: 0
tagged with: exception
tagged with: android
has answer: http://stackoverflow.com/a/23964003
tagged with: android-studio
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/24073079
has comment: http://stackoverflow.com/comment/37123358
has comment: http://stackoverflow.com/comment/37124159
score: 0
answers question: http://stackoverflow.com/q/24072914
has comment: http://stackoverflow.com/comment/37123332
type: Answer
has comment: http://stackoverflow.com/comment/37123725
has comment: http://stackoverflow.com/comment/37123686
has comment: http://stackoverflow.com/comment/37136351
has comment: http://stackoverflow.com/comment/37123529
has comment: http://stackoverflow.com/comment/37122930
has comment: http://stackoverflow.com/comment/37124150
has body: I think I see your problem. You are parsing the fields, but not saving them. One thing you can do is save the fields once you have them. Store them in a HashMap, where the key is the name of the field. Then use your HashMap to retrieve the fields and call the constructor: // for each token in the string HashMap&lt;String,String&gt; hm = new HashMap&lt;String,String&gt;(); //NEW while ((j = lineOfText.indexOf(delimiter, (index = ++j))) != -1) { hm.put(courseField[k], lineOfText.substring(index, j)); //NEW System.out.println(courseField[k] + ": " + lineOfText.substring(index, j)); counter++; k++; } // extract the last token if (index &gt; 0) { System.out.println("Year: " + lineOfText.substring(index)); hm.put("Year", lineOfText.substring(index)); //NEW ++courseNumber; } //translate level string to a character char lvl; String sLevel = hm.get("Level"); if (sLevel.equals("IB")) lvl = '7'; else if (sLevel.equals("Special Education")) lvl = '8'; else if (sLevel.equals("Academic")) lvl = '8'; else if (sLevel.equals("English Language Learners")) lvl = '1'; else lvl = ' '; /* unknown level */ //create the Course object Course c = new Course(hm.get("Name"), hm.get("Code"), lvl , Integer.parseInt(hm.get("Year")) );
has comment: http://stackoverflow.com/comment/37124154
has comment: http://stackoverflow.com/comment/37155137
has comment: http://stackoverflow.com/comment/37155483
has comment: http://stackoverflow.com/comment/37155941
has comment: http://stackoverflow.com/comment/37122893

http://stackoverflow.com/q/23991119
tagged with: arraylist
has answer: http://stackoverflow.com/a/23991506
answer count: 5
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2279030
has answer: http://stackoverflow.com/a/23991190
linked to: http://stackoverflow.com/q/9852831
has comment: http://stackoverflow.com/comment/36969799
has comment: http://stackoverflow.com/comment/36969949
has answer: http://stackoverflow.com/a/23991396
downvote count: 2
linked to: http://stackoverflow.com/q/383947
has answer: http://stackoverflow.com/a/23991402
upvote count: 23
type: Question
has answer: http://stackoverflow.com/a/23991303
has comment: http://stackoverflow.com/comment/36969886
score: 21
tagged with: java
linked to: http://stackoverflow.com/q/2279030
has title: What is difference between List<String> list = new ArrayList<String>() and ArrayList<String> list = new ArrayList<String>()?
has body: Hi I have not a clear idea between, List&lt;String&gt; list = new ArrayList&lt;String&gt;(); and ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
favorite count: 0

http://stackoverflow.com/q/23973284
type: AnsweredQuestion
tagged with: jgit
tagged with: java
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23980192
has comment: http://stackoverflow.com/comment/36945581
has body: I am trying to use Java list all the files that are present in a git repository by the number of commits. For this, I am using the JGit library. String filename = "/a/b/c.java"; String localPath = localPath; Repository localRepo = new FileRepository(localPath + "/.git"); Git git = new Git(localRepo); ObjectId head = localRepo.resolve(Constants.HEAD); Iterable&lt;RevCommit&gt; logs = git.log().add(head).addPath(filename).call(); for (RevCommit revCommit : logs) { count++; } However, I am getting count as 0 always. When I use a file that is existing in the repo home directory I am getting the correct answer: String filename = "d.java"; String localPath = localPath; Repository localRepo = new FileRepository(localPath + "/.git"); Git git = new Git(localRepo); ObjectId head = localRepo.resolve(Constants.HEAD); Iterable&lt;RevCommit&gt; logs = git.log().add(head).addPath(filename).call(); for (RevCommit revCommit : logs) { count++; } However, I am not getting the right answer even if I change to the directory which contains c.java, I am still not getting the right answer: String filename = "c.java"; String localPath = localPath; Repository localRepo = new FileRepository(localPath + "/.git"); Git git = new Git(localRepo); ObjectId head = localRepo.resolve(Constants.HEAD); System.setProperty("user.dir", localPath + "a/b"; Iterable&lt;RevCommit&gt; logs = git.log().add(head).addPath(filename).call(); for (RevCommit revCommit : logs) { count++; } Can someone please help me understand what I have done wrong?
possible better answer: http://stackoverflow.com/a/23976997
accepted answer: http://stackoverflow.com/a/23980192
has answer: http://stackoverflow.com/a/23976997
has title: Using JGit to count the number of commits on a file

http://stackoverflow.com/comment/37167620
score: 0
comment on: http://stackoverflow.com/q/24096925
has text: Someone is doing homework i guess :D
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23988075
downvote count: 0
tagged with: openejb
favorite count: 0
has comment: http://stackoverflow.com/comment/36964523
has comment: http://stackoverflow.com/comment/36976093
type: AnsweredQuestion
has body: I have spent literally two days on the problem and I'm no closer to solving it. I hope that one of the experts out there can help. Here's the problem. I'm Using TomEE 1.6.0.2 (OpenEJB 4.6.0.2) and trying to do a simple TypedQyery that returns a single result and I am getting the strangest return value. It's not the bean object that I expect--it's a java.lang.Class!! Here's the code fragment: public static Account getAccount(String type, String key, EntityManager em) { try { TypedQuery<Account> query = em.createNamedQuery("Account.getByTypeAndKey", Account.class) .setParameter("type", type) .setParameter("key", key) .setMaxResults(1); Account account = query.getSingleResult(); // This statement throws an exception } catch (Exception e) { System.out.println(e.getMessage()); // "java.lang.Class cannot be cast to beans.Account" } try { TypedQuery<Account> query = em.createNamedQuery("Account.getByTypeAndKey", Account.class) .setParameter("type", type) .setParameter("key", key) .setMaxResults(1); Object object = query.getSingleResult(); // This works System.out.printf("object is '%s'\n", object.toString()); // "object is 'class beans.Account'" Account account = new Account(); System.out.printf("account is '%s'\n", account.toString()); // "account is 'Account{id=0, type='null, etc... }'" return account; } catch (Exception e) { System.out.println(e.getMessage()); // Never gets here } } Here's a fragment of the Account class: @Entity @Table(name="Account") @NamedQueries({ @NamedQuery(name = "Account.getByTypeAndKey", query = "SELECT Account FROM Account rec WHERE rec.key = :key AND rec.type = :type"), }) public class Account implements Serializable { private int id; private String type; // The usual stuff ... } And here is persistence.xml: <?xml version="1.0" encoding="UTF-8"?> org.apache.openjpa.persistence.PersistenceProviderImpl PAY_AccountDSJta PAY_AccountDSNonJta beans.Account <property name="openjpa.DynamicEnhancementAgent" value="true"/> <property name="openjpa.Runti…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23988193
upvote count: 1
accepted answer: http://stackoverflow.com/a/23988193
type: Question
tagged with: apache-tomee
has title: TypedQuery<T>.getSingleResult returns object of type Class instead of type T
answer count: 1

http://stackoverflow.com/q/24006928
answer count: 1
has answer: http://stackoverflow.com/a/24006962
favorite count: 0
type: UnansweredQuestion
tagged with: jbutton
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/37000188
has body: I am making a game on Java and i am doing a character selection menu. Within that menu i have the characters and if the user clicks on certain character a JOptionPane.showMessageDialog appears shows the stats of the character. So my question is if the person clicks "ok" which is automatically created when using the function how to i get that to select the character? JButton chuck = new JButton(new ImageIcon("8bitChuckNorris.jpg"));//this part of program runs this if user picks lizard chuck.setSize(210,175); //sets size of button chuck.setLocation(300,317); //sets location of button chuck.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { JOptionPane.showMessageDialog(null, "\t\tSTATS\nAttack\ndefence\nspecial"); } });
downvote count: 0
score: 1
tagged with: java
has title: how to use options from showMessageDialog to do things?
has comment: http://stackoverflow.com/comment/37000025
type: Question
has comment: http://stackoverflow.com/comment/36999903
has comment: http://stackoverflow.com/comment/36999915
has comment: http://stackoverflow.com/comment/37000313
has comment: http://stackoverflow.com/comment/37000405
upvote count: 1

http://stackoverflow.com/q/24077556
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37131509
has title: Unable to construct this JSON object
tagged with: java
has comment: http://stackoverflow.com/comment/37131092
has body: I have the following Database structure mysql&gt; select * from categories limit 30; +-------------+-------------+-----------------+-------+------+------+------+------+------+------+------+ | category_id | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10 | +-------------+-------------+-----------------+-------+------+------+------+------+------+------+------+ | 1 | Popcorn | Regular Pack | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 1 | Popcorn | Regular Pack | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 1 | Popcorn | Regular Pack | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 2 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 2 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 2 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 3 | Popcorn | Jumbo | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 3 | Popcorn | Jumbo | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 4 | Popcorn | Tub | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 4 | Popcorn | Tub | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 5 | Popcorn | Combo Cool Bite | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 6 | Popcorn | Combo Relish | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 7 | Soft Drinks | Fountain | Apple | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 8 | Soft Drinks | Fountain | Orange | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 8 | Soft Drinks | Fountain | Orange | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 9 | Soft Drinks | Fountain | Lemon | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 9 | Soft Drinks | Fountain | Lemon | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 10 | Soft Drinks | Fountain | Clear | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 10 | Soft Drinks | Fountain | Clear | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 11 | Soft Drinks | …
downvote count: 1
has comment: http://stackoverflow.com/comment/37131055
type: Question
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24078108

http://stackoverflow.com/comment/102638323
comment on: http://stackoverflow.com/a/23979964
has text: ImageIO should be avoided for saving.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37108339
has text: shorter? i think this one's still better than my previous if/else and far more readable
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24065108

http://stackoverflow.com/q/23954300
tagged with: parcelable
score: 0
has title: Error passing parcelable object using intent
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23954369
accepted answer: http://stackoverflow.com/a/23954369
tagged with: android-intent
has body: I have written the following class that implements parcelable. package com.example.allinone; import android.accounts.Account; import android.os.Parcel; import android.os.Parcelable; public class WebSiteObject implements Parcelable { public String webSiteName; public String webSiteURL; public WebSiteObject(String webSiteName, String webSiteURL) throws Exception { this.setWebSiteName(webSiteName); this.setWebSiteURL(webSiteURL); } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel out, int arg1) { // TODO Auto-generated method stub out.writeString(webSiteName); out.writeString(webSiteURL); } public static final Parcelable.Creator&lt;Account&gt; CREATOR = new Parcelable.Creator&lt;Account&gt;() { public Account createFromParcel(Parcel in) { return new Account(in); } public Account[] newArray(int size) { return new Account[size]; } }; public String getWebSiteName() { return webSiteName; } public String getWebSiteURL() { return webSiteURL; } public void setWebSiteName(String webSiteName) { this.webSiteName = webSiteName; } public void setWebSiteURL(String webSiteURL) { this.webSiteURL = webSiteURL; } } Then I used the following code to pass an object of this class from one activity to another Intent webActivityLauncher = new Intent(MainActivity.this, WebActivity.class); webActivityLauncher.putExtra("selectedWebObject", aWebSiteObject); startActivity(webActivityLauncher); And the following code to access it in the second activity WebSiteObject aWebSiteObject = (WebSiteObject)getIntent().getParcelableExtra("selectedWebObject"); But it is not working. I am getting the following error in logcat. 05-30 17:36:12.450: E/AndroidRuntime(1140): FATAL EXCEPTION: main 05-30 17:36:12.450: E/AndroidRuntime(1140): Process: com.example.allinone, PID: 1140 05-30 17:36:12.450: E/AndroidRuntime(1140): java.lang.ClassCastException: android.accounts.Account cannot be cast to com.example.allinone.WebSiteObject 05…
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/36908678
score: 0
has text: Why don't you like the String representation of ints, that JSON libraries do?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23958113

http://stackoverflow.com/q/23960429
accepted answer: http://stackoverflow.com/a/23962276
tagged with: geometry
has title: Circle-circle intersection code gives wrong coordinates
type: AnsweredQuestion
tagged with: java
has body: I know there are tons of examples to do this. But I need to understand what I'm doing. Could you please tell me the error in this code? Point[] intersections(Circle c) { Point p0 = new Point(center); Point p1 = new Point(c.center); double d, x, y; d = p0.distance(p1); if(radius + c.radius &lt; d || Math.abs(radius - c.radius) &gt; d) return null; x = (d*d - c.radius*c.radius + radius*radius)/(2*d); y = Math.sqrt(radius*radius - x*x); if(Double.isNaN(y)) return null; double y0 = y; double y1 = -1*y; Point i0 = new Point(x,y0,0); Point i1 = new Point(x,y1,0); i0 = i0.add(p0); i1 = i1.add(p1); return new Point[]{i0, i1}; } I have 2 circles c0 and c1. When I write c0.intersections(c1), the output is: 5.162277660168379 14.32455532033676 0.0 8.162277660168378 2.675444679663241 0.0 And if I switch the order: c1.intersections(c0), the output is: 5.0 15.32455532033676 0.0 2.0 1.675444679663241 0.0
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23962276

http://stackoverflow.com/comment/37018783
has text: if you have a simple template and speed performance isnt crucial, you can implement a single-scale template matching easily. Just compute the absolute difference of pixels to the template over the whole template for each anchor position. best found template is the one with the smallest absolute difference. template is detected if the smallest absolute difference is smaller than some threshold.
comment on: http://stackoverflow.com/q/23998603
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37154489
type: Comment
has text: -- Barn 2 (before consolidate) -- [0]: Trigger, 1340lbs. [1]: null [2]: Silver, 1210lbs. [3]: null [4]: null [5]: Patches, 1350lbs. [6]: Duke, 1410lbs. -- Barn 2 (after consolidate) -- [0]: Trigger, 1340lbs. [1]: Silver, 1210lbs. [2]: Patches, 1350lbs. [3]: Duke, 1410lbs. [4]: null [5]: null [6]: null
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24089703

http://stackoverflow.com/q/24093383
has body: from my reading of the book Hibernate in action, I think the data type in mysql should be VARBINARY for custom data type in Hibernate. For example, my custom data type class: public class CustomType implements Serializable { // blah blah } and in my Entity class, I use the CustomType value as a property: @Entity public class EntityName { @Type(type = "persistence.CustomType") CustomType myData; } However, when I try save an instance of my entity class, I got an error message telling me that I should use tinyblob type for myData property. I wonder what exactly data type in MySQL I should use for custom data type in hibernate. thanks
score: 1
has comment: http://stackoverflow.com/comment/37161181
favorite count: 0
tagged with: mapping
type: UnansweredQuestion
upvote count: 1
has title: What MySQL data type should I use for custom data type in hibernate?
answer count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37161164
tagged with: entity

http://stackoverflow.com/comment/37034389
score: 0
type: Comment
has text: damn how did i miss it ..thank u for ur quick response
type: AnswerComment
comment on: http://stackoverflow.com/a/24025240

http://stackoverflow.com/q/24018021
accepted answer: http://stackoverflow.com/a/24018816
favorite count: 0
has title: Canceling postDelayed with button (onClick)
tagged with: android
has answer: http://stackoverflow.com/a/24018816
has body: help me for the coding. I am not good at coding java and xml, so help. Intro activity shows for 1500ms, and after that, main activity shows. I want to add skip button in intro activity. When the skip button is clicked, I want to skip to main activity. This is my code: MainActivity.java package com.bedrock.schedule; import android.R.menu; import android.R.anim; import android.R.layout; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; public class MainActivity extends Activity { private BackPressCloseHandler backPressCloseHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Start Transition Animation this.overridePendingTransition(R.anim.startenter, R.anim.startexit); setContentView(R.layout.activity_main); //Image Animation ImageView image = (ImageView)findViewById(R.id.Logo); Animation animation=AnimationUtils.loadAnimation(this, R.anim.logoenter); image.startAnimation(animation); //Image Homepage Link image.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(Uri.parse("http://young-dong.ms.kr")); startActivity(intent); } }); //Exit Toast backPressCloseHandler = new BackPressCloseHandler(this); } //Button Activity Link public void ClassMain(View view) { Intent intent = new Intent(MainActivity.this, ClassMain.class); startActivity(intent); } @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; } //Exit Toast @Override public void onBackPressed() { //super.onBackPressed(); backPressCloseHandler.onB…
type: AnsweredQuestion
upvote count: 0
tagged with: postdelayed
tagged with: onclick
tagged with: java
tagged with: eclipse
type: Question
score: -1
downvote count: 1
answer count: 1

http://stackoverflow.com/comment/37331322
comment on: http://stackoverflow.com/q/24098977
has text: Rendering 125 models imho shouldn't be a huge problem, even not on a Tablet... The culling is not verry hard to implement, camera has methods. I used `isSphereInFrustum` and used a sphereradius a bit bigger than my blocks size. by doing this i was able to cull out a huge amount of blocks. Are you using any `Shader`, which could be expensive?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24001312
has title: Play authenticate plugin - providers
upvote count: 3
favorite count: 0
type: UnansweredQuestion
tagged with: playframework-2.0
score: 3
answer count: 0
downvote count: 0
tagged with: java
tagged with: authentication
type: Question
has body: I'm using Play authenticate plugin but I have no foggiest idea how to provide custom authentication with login &amp; password. I.e. before I've started using the plugin I'd built up the whole authentication module and I would like to incorporate it into the plugin. There's neither any documentation nor tutorial on this subject and I don't really understand how the sample code works: https://github.com/joscha/play-authenticate/tree/master/samples/java/play-authenticate-usage/app/providers My goal is just to check if provided login &amp; password are matching one of entries in database, using previously written methods. Please, help me.

translucentdecor
tags question: http://stackoverflow.com/q/24078565
tag name: translucentdecor
type: Tag

sql
tags question: http://stackoverflow.com/q/24033945
tags question: http://stackoverflow.com/q/24055723
tags question: http://stackoverflow.com/q/24012560
tags question: http://stackoverflow.com/q/23961205
tags question: http://stackoverflow.com/q/23985902
tags question: http://stackoverflow.com/q/23977848
tags question: http://stackoverflow.com/q/24006357
tags question: http://stackoverflow.com/q/23974017
tags question: http://stackoverflow.com/q/24064562
tags question: http://stackoverflow.com/q/24034004
tags question: http://stackoverflow.com/q/23951696
tags question: http://stackoverflow.com/q/23981526
tags question: http://stackoverflow.com/q/23945908
tags question: http://stackoverflow.com/q/23993428
tags question: http://stackoverflow.com/q/24092079
tags question: http://stackoverflow.com/q/24086386
tags question: http://stackoverflow.com/q/24091946
tags question: http://stackoverflow.com/q/23947155
tags question: http://stackoverflow.com/q/24051423
tags question: http://stackoverflow.com/q/23952145
tags question: http://stackoverflow.com/q/24038504
tags question: http://stackoverflow.com/q/24026747
tags question: http://stackoverflow.com/q/24002870
tags question: http://stackoverflow.com/q/24082862
tags question: http://stackoverflow.com/q/24013855
tags question: http://stackoverflow.com/q/24018198
tags question: http://stackoverflow.com/q/24016458
tags question: http://stackoverflow.com/q/24053831
tags question: http://stackoverflow.com/q/23964972
tags question: http://stackoverflow.com/q/24010152
tags question: http://stackoverflow.com/q/24095662
tags question: http://stackoverflow.com/q/23943845
tag name: sql
tags question: http://stackoverflow.com/q/24053749
type: Tag
tags question: http://stackoverflow.com/q/23953905
tags question: http://stackoverflow.com/q/24023655
tags question: http://stackoverflow.com/q/24058186
tags question: http://stackoverflow.com/q/24037673
tags question: http://stackoverflow.com/q/24052273
tags question: http://stackoverflow.com/q/23947860
tags question: http://stackoverflow.com/q/24032536
tags question: http://stackoverflow.com/q/24096725
tags question: http://stackoverflow.com/q/23997301
tags question: http://stackoverflow.com/q/24055944
tags question: http://stackoverflow.com/q/24087391
tags question: http://stackoverflow.com/q/24059883
tags question: http://stackoverflow.com/q/24035128
tags question: http://stackoverflow.com/q/24069823
tags question: http://stackoverflow.com/q/24090935
tags question: http://stackoverflow.com/q/24078784
tags question: http://stackoverflow.com/q/23949890
tags question: http://stackoverflow.com/q/23985859
tags question: http://stackoverflow.com/q/24079221
tags question: http://stackoverflow.com/q/23948428
tags question: http://stackoverflow.com/q/24103556
tags question: http://stackoverflow.com/q/23979841
tags question: http://stackoverflow.com/q/24091307
tags question: http://stackoverflow.com/q/24056607
tags question: http://stackoverflow.com/q/24099899
tags question: http://stackoverflow.com/q/23999851
tags question: http://stackoverflow.com/q/23994265
tags question: http://stackoverflow.com/q/23995646
tags question: http://stackoverflow.com/q/24019854
tags question: http://stackoverflow.com/q/24039423
tags question: http://stackoverflow.com/q/24080057
tags question: http://stackoverflow.com/q/24066604
tags question: http://stackoverflow.com/q/23982301
tags question: http://stackoverflow.com/q/23986348
tags question: http://stackoverflow.com/q/23985604
tags question: http://stackoverflow.com/q/24103462
tags question: http://stackoverflow.com/q/24095083
tags question: http://stackoverflow.com/q/24098247
tags question: http://stackoverflow.com/q/24027096
tags question: http://stackoverflow.com/q/24073852

http://stackoverflow.com/q/24099778
accepted answer: http://stackoverflow.com/a/24099811
score: 7
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24099811
possible better answer: http://stackoverflow.com/a/24099854
upvote count: 7
has title: Why does processing try-catch without any exception thrown not slow down the program at all?
has answer: http://stackoverflow.com/a/24099854
has body: Today I realized something that appeared weird to me: I noticed that when I just do try { doSomething(); } catch (Exception e) { } it isn't slower at all than if I just do doSomething(); So I ran a test and wrote down some quick code to prove what I saw, the code basically just loops over a function called doSomething() lots of times, one time without and one time with try-catch surrounding it. So here's the code to it if you want to test it yourself: public class Main { private static final long LOOPS = 1000000L; public static final void main(String[] args) { System.out.println("Loop without try catch: "+loopWithoutTryCatch(LOOPS)); System.out.println("Loop with try catch: "+loopWithTryCatch(LOOPS)); } public static long loopWithoutTryCatch(long loops) { long startTime = System.currentTimeMillis(); for (long i = 0L; i &lt; loops; i++) { doSomething(); } return System.currentTimeMillis()-startTime; } public static long loopWithTryCatch(long loops) { long startTime = System.currentTimeMillis(); for (long i = 0L; i &lt; loops; i++) { try { doSomething(); } catch (Exception e) { } } return System.currentTimeMillis()-startTime; } public static void doSomething() { for (int i = 0; i &lt; 250; i++) { if (i % 3 == 0) { i++; } } } } And I received the following output: Loop without try catch: 375 Loop with try catch: 373 I was surprised so I tested it again and again, but I always got similar results, both ways it runs pretty much in the same time. And now my question is: Why? I dont really understand it, as far as I know try-catch writes the resources before usage in some kind of table to later - if any exception is thrown - be able to clean it up and reference to the values it had before the exception occured. This should take at least some time, shouldn't it? I thought it is maybe because I the random example I choose doesnt represent it properly, and in that specific case in which I tested it it doesnt slow down anything, but that seemed very unlikely to me. Then I thou…
favorite count: 0
has comment: http://stackoverflow.com/comment/37172892
has comment: http://stackoverflow.com/comment/37173894
type: AnsweredQuestion
downvote count: 0
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/37172837

http://stackoverflow.com/comment/36923995
type: QuestionComment
comment on: http://stackoverflow.com/q/23966177
has text: A JPanel is focusable by default, KeyListener will only respond to key strokes when the component they are registered to is focusable and has focus. Consider using the [key bindings API](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) instead
score: 0
type: Comment

http://stackoverflow.com/a/24003807
has comment: http://stackoverflow.com/comment/36994505
has comment: http://stackoverflow.com/comment/36994458
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36994959
has comment: http://stackoverflow.com/comment/36994549
has body: The environment variable to use is classpath. Also, setting the classpath beyond your application's lifecycle isn't recommended especially when there are multiple apps running with different versions of the same library. Just specify the library location in the -classpath option to the java and javac commands. Or atleast set it in a batch/shell script file that will set the variable, open the application and unset implicitly upon termination.
accepted answer of: http://stackoverflow.com/q/24003719
answers question: http://stackoverflow.com/q/24003719
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36994689
has comment: http://stackoverflow.com/comment/36994519
has comment: http://stackoverflow.com/comment/36994756
upvote count: 2

http://stackoverflow.com/q/24013420
downvote count: 0
linked to: http://stackoverflow.com/q/4413310
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/37012043
has answer: http://stackoverflow.com/a/31876425
has answer: http://stackoverflow.com/a/34619874
has comment: http://stackoverflow.com/comment/37012538
type: Question
has answer: http://stackoverflow.com/a/24013518
has answer: http://stackoverflow.com/a/24016313
tagged with: modal-dialog
tagged with: jdialog
has title: Modal JDialog without blocking execution
upvote count: 10
has comment: http://stackoverflow.com/comment/37011809
has body: Is there a way how to use a dialog in Swing which prohibits any gui activity under it but at the same time DOES NOT stop execution on the thread where it was set to visible?
favorite count: 0
answer count: 5
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/59010200

http://stackoverflow.com/a/24099449
type: AcceptedAnswer
downvote count: 0
score: 7
has body: LayoutInflater has two relevant overloads of inflate: public View inflate (int resource, ViewGroup root, boolean attachToRoot) public View inflate (int resource, ViewGroup root) The second parameter is the view you want to refer as the root of the view you're inflating. If attachToRoot is true, it will become the inflated view's parent view. If not, it'll just help create the correct layout. If you use the second overload, attachToRoot is assumed to be true and if you supply the (optional) root, it'll be automatically attached as a parent view to the inflated view.
type: Answer
answers question: http://stackoverflow.com/q/24099396
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24099396

http://stackoverflow.com/q/23975133
score: 0
has comment: http://stackoverflow.com/comment/36945125
has title: Creating Json from XAgent
has body: I'm trying to create some Json from an XPages "XAgent" using Java. There's a particular format I'm trying to it and it uses an Integer as a key and I keep getting some errors that I don't understand. Here's an example error: Caused by: java.lang.ClassCastException: java.lang.Integer incompatible with java.lang.String at com.ibm.commons.util.io.json.JsonGenerator$Generator.outObject(JsonGenerator.java:202) at com.ibm.commons.util.io.json.JsonGenerator$Generator.outLiteral(JsonGenerator.java:163) at com.ibm.commons.util.io.json.JsonGenerator$Generator.outLiteral(JsonGenerator.java:142) at com.ibm.commons.util.io.json.JsonGenerator$Generator.toJson(JsonGenerator.java:138) at com.ibm.commons.util.io.json.JsonGenerator.toJson(JsonGenerator.java:64) at com.ibm.commons.util.io.json.JsonGenerator.toJson(JsonGenerator.java:49) I'm trying to create JSon output like this: [ { // minimum 0:{src:'item_one_format_one.ext', type: 'video/...'} }, { // one content, multiple formats 0:{src:'item_two_format_one.ext', type: 'video/...'}, 1:{src:'item_two_format_two.ext', type: 'video/...'} }, { // one content, multiple formats, item specific config 0:{src:'item_three_format_one.ext', type: 'video/...'}, 1:{src:'item_three_format_two.ext', type: 'video/...'}, 3:{src:'item_three_format_three.ext', type: 'video/...'}, 4:{src:'item_three_format_four.ext', type: 'video/...'}, config: { option1: value1, option2: value2 } ] Not it is multiple "objects" and the last one seems to be a combination of Integer and String for the key value. Here is some code I tried and got working kinda of: public String testList() throws JsonException, IOException { Integer count = 0; Map&lt;String, Object&gt; containerMap = new TreeMap&lt;String, Object&gt;(); System.out.println("A"); TreeMap&lt;String, String&gt; stringMap = new TreeMap&lt;String, String&gt;(); System.out.println("B"); stringMap.put("One", "Value1"); stringMap.put("Two", "Value2"); System.out.println("C"); containerMap.put("1", "One"); count++;…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23977687
has comment: http://stackoverflow.com/comment/36941123
tagged with: projekktor
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2
tagged with: xpages
has answer: http://stackoverflow.com/a/23975801
has comment: http://stackoverflow.com/comment/36953772

http://stackoverflow.com/comment/36921583
type: QuestionComment
has text: Then where in a web application would be the best place to read the properties file and store it?
score: 0
comment on: http://stackoverflow.com/q/23964792
type: Comment

http://stackoverflow.com/a/23991784
upvote count: 1
has body: You need something like this: &lt;context:component-scan base-package="com.foo.bar" /&gt; &lt;context:property-placeholder location="file:c:/test/${env.app.type}.properties" /&gt; &lt;bean id="service" class="com.foo.bar.ExampleService"&gt; &lt;property name="foo" value="${foo}" /&gt; &lt;/bean&gt; package com.foo.bar; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @Configuration @PropertySource("file:c:/test/env.properties") public class SpringConfig{ } And "foo" value comes from app1.properties file. Basically, one file is being loaded with @PropertySource, the other with the regular property placeholder.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23989687
score: 1

http://stackoverflow.com/a/25620390
upvote count: 1
has body: One more variant, just for the fun of it. It does not transform String to the List of Longs in one go. 18 ms in console. def findMax(startTime:Long, maxStretch:List[Long], currentStretch:List[Long], longLine:String, currentProd:Long):(List[Long], Long, Long) = longLine match { case "" =&gt; (maxStretch, maxStretch.product, System.currentTimeMillis - startTime) case _ =&gt; { val nextElement = longLine(0) val lastElement = currentStretch(0) val nextStretch = currentStretch.tail ++ List(nextElement.toLong-'0'.toLong) val nextProd = nextStretch.product val (nextMaxStretch, nextMaxProd) = if(nextProd&gt;currentProd) {(nextStretch, nextProd)} else (maxStretch, currentProd) findMax(startTime,nextMaxStretch, nextStretch, longLine.substring(1),nextMaxProd) } } val strContent = &lt;long string&gt;.replaceAll(" ","") val start = strContent.take(13).map(_.toLong-'0'.toLong).toList scala&gt; findMax(System.currentTimeMillis, start, start, strContent.drop(13), start.product) res47: (List[Long], Long, Long) = (List(5, 5, 7, 6, 6, 8, 9, 6, 6, 4, 8, 9, 5),23514624000,18)
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23965737

http://stackoverflow.com/comment/40996341
comment on: http://stackoverflow.com/a/25054965
score: 0
has text: No, its only with IntelliJ, eclipse and netbeans works like a charm. Already tried to match the options without success. Thank you anyway!
type: Comment
type: AnswerComment

jdbc
tags question: http://stackoverflow.com/q/24034004
tags question: http://stackoverflow.com/q/24070399
tags question: http://stackoverflow.com/q/23973362
tags question: http://stackoverflow.com/q/24099383
tags question: http://stackoverflow.com/q/23946253
tags question: http://stackoverflow.com/q/24037705
tags question: http://stackoverflow.com/q/23991289
tags question: http://stackoverflow.com/q/23986873
tags question: http://stackoverflow.com/q/24023179
tags question: http://stackoverflow.com/q/23952145
tags question: http://stackoverflow.com/q/24082862
tags question: http://stackoverflow.com/q/24036464
tags question: http://stackoverflow.com/q/24016458
tags question: http://stackoverflow.com/q/24099904
tags question: http://stackoverflow.com/q/24053831
tags question: http://stackoverflow.com/q/23964972
tags question: http://stackoverflow.com/q/23961030
tags question: http://stackoverflow.com/q/23970135
tags question: http://stackoverflow.com/q/24046862
type: Tag
tags question: http://stackoverflow.com/q/24069407
tags question: http://stackoverflow.com/q/23953060
tags question: http://stackoverflow.com/q/24042889
tags question: http://stackoverflow.com/q/24082600
tags question: http://stackoverflow.com/q/24087223
tags question: http://stackoverflow.com/q/24037673
tags question: http://stackoverflow.com/q/24061733
tags question: http://stackoverflow.com/q/23993821
tags question: http://stackoverflow.com/q/24040101
tags question: http://stackoverflow.com/q/24032536
tags question: http://stackoverflow.com/q/24087391
tags question: http://stackoverflow.com/q/24059883
tags question: http://stackoverflow.com/q/23943424
tags question: http://stackoverflow.com/q/24037984
tags question: http://stackoverflow.com/q/23982908
tags question: http://stackoverflow.com/q/24055763
tags question: http://stackoverflow.com/q/24060782
tags question: http://stackoverflow.com/q/24066305
tags question: http://stackoverflow.com/q/24005558
tags question: http://stackoverflow.com/q/23957390
tags question: http://stackoverflow.com/q/24011258
tags question: http://stackoverflow.com/q/24034926
tags question: http://stackoverflow.com/q/24081941
tags question: http://stackoverflow.com/q/24085414
tags question: http://stackoverflow.com/q/23955391
tags question: http://stackoverflow.com/q/24033203
tags question: http://stackoverflow.com/q/24056607
tags question: http://stackoverflow.com/q/24099899
tags question: http://stackoverflow.com/q/23995646
tags question: http://stackoverflow.com/q/23949396
tags question: http://stackoverflow.com/q/24075478
tags question: http://stackoverflow.com/q/24045431
tags question: http://stackoverflow.com/q/23969255
tags question: http://stackoverflow.com/q/23982301
tags question: http://stackoverflow.com/q/24041904
tags question: http://stackoverflow.com/q/23985604
tags question: http://stackoverflow.com/q/24067663
tags question: http://stackoverflow.com/q/24070111
tags question: http://stackoverflow.com/q/24014434
tags question: http://stackoverflow.com/q/24045527
tag name: jdbc
tags question: http://stackoverflow.com/q/24055380
tags question: http://stackoverflow.com/q/23953396
tags question: http://stackoverflow.com/q/24098247
tags question: http://stackoverflow.com/q/23969635
tags question: http://stackoverflow.com/q/23953534
tags question: http://stackoverflow.com/q/24012560
tags question: http://stackoverflow.com/q/24030118
tags question: http://stackoverflow.com/q/23985902
tags question: http://stackoverflow.com/q/23977848
tags question: http://stackoverflow.com/q/23993845
tags question: http://stackoverflow.com/q/24015198

http://stackoverflow.com/a/24020220
has body: I changed your approach a little bit, so it is more object-oriented. I hope this example makes clear, what you have to do. To get an basic understanding, google keywords like "encapsulation" or "object-orientation". There are many tutorials out there. public class Grid { private JFrame frame = new JFrame(); private JButton[][] grid; // Has to be a field of the object. static would make it to an field of the class public Grid (int w, int l) { frame.setLayout(new GridLayout(w, l)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); createGrid (w, l); } private void createGrid (int w, int l) { // Your above implementation } public void stepInSimulation () { // Your algorithm, you want to implement } public JButton[][] getGrid () { return grid; } public static void main (String[] args) { Grid grid = new Grid(2,2); grid.getGrid ()[0][1]; // Access a value grid.stepInSimulation (); // Do a step, call it in while loop, to do multiple steps } } I hope this helps.
type: Answer
accepted answer of: http://stackoverflow.com/q/24019169
answers question: http://stackoverflow.com/q/24019169
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/24035214
has comment: http://stackoverflow.com/comment/37052568
tagged with: unit-testing
type: Question
has body: Following is the code I am trying to unit test public final class ClassToBeTested { public static void function(String arg) { ProcessBuilder pb = new ProcessBuilder(arg); //Using pb here } } I want to mock the constructor invocation (new File(arg)), here I tried using Power Mock : @PrepareForTest({ClassToBeTested.class}) public class TestClass { @Test public void functionTest() throws Exception { String str = "abc"; ProcessBuilder mockProcessBuilder = PowerMock.createMock(ProcessBuilder.class); PowerMock.expectNew(ProcessBuilder.class, str).andReturn(mockProcessBuilder); PowerMock.replay(mockProcessBuilder, ProcessBuilder.class); ClassToBeTested.function(abc); } } This doesn't seem to work. As new ProcessBuilder(arg) is not returning the mocked object.
tagged with: java
has comment: http://stackoverflow.com/comment/37052454
has comment: http://stackoverflow.com/comment/37052536
has title: Mocking a constructor inside a static method
has answer: http://stackoverflow.com/a/24035771
accepted answer: http://stackoverflow.com/a/24035771
answer count: 1
has comment: http://stackoverflow.com/comment/37052508
score: 0
tagged with: processbuilder
tagged with: powermock
has comment: http://stackoverflow.com/comment/37052794
has comment: http://stackoverflow.com/comment/37053211
has comment: http://stackoverflow.com/comment/37052751
type: AnsweredQuestion

http://stackoverflow.com/q/24040941
has comment: http://stackoverflow.com/comment/37063489
favorite count: 0
linked to: http://stackoverflow.com/q/1770010
accepted answer: http://stackoverflow.com/a/24041169
has comment: http://stackoverflow.com/comment/37063937
has comment: http://stackoverflow.com/comment/37063607
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37063355
upvote count: 2
duplicate of: http://stackoverflow.com/q/266825
tagged with: java
downvote count: 3
has body: I'm recording the duration of how long something takes in Java. To do that, I'm running: long startTime = System.nanoTime(); ... long duration = System.nanoTime() - startTime; Now, I would like to take the duration and print it out in a format of mm:ss.SSS. How do I do that in Java?
type: Question
has title: Format Java's Nanotime
has comment: http://stackoverflow.com/comment/37064777
tagged with: format
score: -1
has answer: http://stackoverflow.com/a/24041169
has comment: http://stackoverflow.com/comment/37063827
has comment: http://stackoverflow.com/comment/37063288
has comment: http://stackoverflow.com/comment/37064132
linked to: http://stackoverflow.com/q/266825
has comment: http://stackoverflow.com/comment/37063959
has comment: http://stackoverflow.com/comment/37063349
answer count: 1

http://stackoverflow.com/comment/37134656
type: AnswerComment
comment on: http://stackoverflow.com/a/24079149
has text: I mean, is it all fine If I just specify the path of the jdk version 2 in the JAVA_HOME variable?
type: Comment
score: 0

http://stackoverflow.com/a/24067648
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24065817
downvote count: 0
has body: thank you all for the replies. Finally, I've figured it out. Below is my configuration in my HibernateUtil class. Because I'm using Hibernate 4.3.5, I've replaced the deprecated methods with the latest ones. Also I moved my hibernate.cfg.xml to src/main/java/resources. static { try { Configuration configuration = new Configuration().configure("/resources/hibernate.cfg.xml"); StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()); sessionFactory = configuration.buildSessionFactory(builder.build()); } catch (HibernateException ex) { System.err.println("Initial sessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } }
type: Answer

http://stackoverflow.com/a/24026819
score: 4
has comment: http://stackoverflow.com/comment/37037837
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/37037434
has body: Three main reasons... Top level containers aren't double buffered, which cause flickering when the frame is repainted, yes, you can implement you're own double buffering, but... Painting inside a frame does not take into consideration the frames borders, meaning that it's possible to paint under them. Frame borders are also platform/look and feel specific, meaning that there sizes change In the case of Swing windows, there are components that already exist on the window, meaning that they paint over (or be painted over), in most cases, both (because of the optimised painting engine in Swing), making it difficult to produce a reasonable result For point #2, frame decorations are painted WITHIN the "window" bounds, not outside them Take a look at... How to get the EXACT middle of a screen, even when re-sized Java AWT drawString() does not display on window How can I set in the midst? for more details Make the time to read through Painting in AWT and Swing and Performing Custom Painting for more details
downvote count: 0
answers question: http://stackoverflow.com/q/24026743
accepted answer of: http://stackoverflow.com/q/24026743
has comment: http://stackoverflow.com/comment/37037750
type: AcceptedAnswer

http://stackoverflow.com/comment/36912664
type: AnswerComment
comment on: http://stackoverflow.com/a/23960260
type: Comment
has text: I don't see why they couldn't be used. But this is too vague. My advice would be: stop trying to guess or predict what will happen, what you can and can't do. Try doing it, and you'll see what happens.
score: 2

http://stackoverflow.com/a/23951030
answers question: http://stackoverflow.com/q/23950979
score: 1
upvote count: 1
has body: Use Thread.sleep(10*1000); //sleep 10 seconds.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36988871
comment on: http://stackoverflow.com/q/23995683
score: 0
has text: @GilbertLeBlanc This question also gives some details of the same situation: http://stackoverflow.com/questions/8647565/package-and-visibility
type: Comment
type: QuestionComment

web-services
tags question: http://stackoverflow.com/q/24038981
type: Tag
tags question: http://stackoverflow.com/q/24054200
tags question: http://stackoverflow.com/q/23942913
tags question: http://stackoverflow.com/q/24015912
tags question: http://stackoverflow.com/q/23952879
tags question: http://stackoverflow.com/q/24034244
tags question: http://stackoverflow.com/q/23950134
tags question: http://stackoverflow.com/q/24041700
tags question: http://stackoverflow.com/q/24078142
tags question: http://stackoverflow.com/q/24010838
tags question: http://stackoverflow.com/q/23947646
tags question: http://stackoverflow.com/q/24029081
tags question: http://stackoverflow.com/q/24034563
tags question: http://stackoverflow.com/q/23997723
tags question: http://stackoverflow.com/q/24058371
tags question: http://stackoverflow.com/q/24058867
tags question: http://stackoverflow.com/q/23967861
tags question: http://stackoverflow.com/q/23968791
tags question: http://stackoverflow.com/q/24022070
tags question: http://stackoverflow.com/q/24015670
tags question: http://stackoverflow.com/q/24085495
tags question: http://stackoverflow.com/q/24061550
tags question: http://stackoverflow.com/q/24064349
tags question: http://stackoverflow.com/q/24032319
tags question: http://stackoverflow.com/q/24009403
tags question: http://stackoverflow.com/q/24008218
tags question: http://stackoverflow.com/q/23977766
tags question: http://stackoverflow.com/q/24009733
tags question: http://stackoverflow.com/q/23950559
tags question: http://stackoverflow.com/q/24042555
tags question: http://stackoverflow.com/q/24036471
tags question: http://stackoverflow.com/q/24053393
tags question: http://stackoverflow.com/q/24013076
tags question: http://stackoverflow.com/q/24036719
tags question: http://stackoverflow.com/q/23976470
tags question: http://stackoverflow.com/q/23988523
tags question: http://stackoverflow.com/q/24085791
tags question: http://stackoverflow.com/q/23942745
tags question: http://stackoverflow.com/q/24040781
tags question: http://stackoverflow.com/q/23954310
tags question: http://stackoverflow.com/q/24077703
tags question: http://stackoverflow.com/q/23968784
tags question: http://stackoverflow.com/q/24010801
tag name: web-services
tags question: http://stackoverflow.com/q/24009377
tags question: http://stackoverflow.com/q/24087079
tags question: http://stackoverflow.com/q/23991376
tags question: http://stackoverflow.com/q/23976960
tags question: http://stackoverflow.com/q/24030190
tags question: http://stackoverflow.com/q/24026792
tags question: http://stackoverflow.com/q/24064263
tags question: http://stackoverflow.com/q/24033464
tags question: http://stackoverflow.com/q/24030335
tags question: http://stackoverflow.com/q/24090327
tags question: http://stackoverflow.com/q/24060483
tags question: http://stackoverflow.com/q/24015265

http://stackoverflow.com/q/24051426
possible better answer: http://stackoverflow.com/a/24052803
tagged with: dataoutputstream
accepted answer: http://stackoverflow.com/a/24103145
type: Question
score: 3
has answer: http://stackoverflow.com/a/24103145
tagged with: post
upvote count: 3
answer count: 2
has title: Send Multiple POST Requests Through a DataOutputStream in Java
has body: I am trying to use a for loop to send multiple POST requests through a DataOutputStream and then close it. At the moment, only the first index of the "trades" array list is sent to the website. Any other indexes are ignored and I'm assuming they are not being sent. I wonder if I am properly flushing the stream? Thank you!!! Examples of trades values: "101841599", "101841801" Example of code value: 85e4c22 Snippet of my code: private ArrayList&lt;String&gt; trades = new ArrayList&lt;String&gt;(); private String code; String url = "http://www.dota2lounge.com/ajax/bumpTrade.php"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Accept-Language", "en-US,en;q=0.8"); con.setRequestProperty("Cookie", cookie); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); for(int i=0; i&lt;trades.size(); i++){ wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes("trade=" + trades.get(i) + "&amp;code=" + code); wr.flush(); System.out.println("again"); } wr.flush(); wr.close();
favorite count: 0
tagged with: httpurlconnection
has answer: http://stackoverflow.com/a/24052803
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/23975716
has comment: http://stackoverflow.com/comment/36941608
tagged with: java
has comment: http://stackoverflow.com/comment/36940971
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36940995
score: 0
has comment: http://stackoverflow.com/comment/36941014
has title: Sub string detection performance?
has answer: http://stackoverflow.com/a/23976567
has body: I need to match a sub string, and I wonder which one is faster when it comes to matching RegEx? if ( str.matches(".*hello.*") ) { ... } Pattern p = Pattern.compile( ".*hello.*" ); Matcher m = p.matcher( str ); if ( m.find() ) { ... } And if don't need a regEx, should I use 'contains' ? if ( str.contains("hello") ) { ... } Thanks.
possible better answer: http://stackoverflow.com/a/23975751
tagged with: regex
has comment: http://stackoverflow.com/comment/36955140
has answer: http://stackoverflow.com/a/23975751
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23976567
tagged with: performance

http://stackoverflow.com/comment/37150382
type: Comment
score: 0
has text: It's actually a variable column name (generated in createQuery) that can be used as the primary ordering column, it could be a vchar column as well.
comment on: http://stackoverflow.com/q/24087391
type: QuestionComment

http://stackoverflow.com/a/24030864
has body: i answer my question again.. Yes this method is working but make sure you remove all the punctuation,/,&amp;,#,digits ,apostrophe marks and everything except alphabets. only then the mapping will be perfect
score: 0
answers question: http://stackoverflow.com/q/24030235
type: Answer

http://stackoverflow.com/q/24032829
has comment: http://stackoverflow.com/comment/37048023
has body: My code is working fine (choosing directory) when used in the main method. However, using the same code copied into a servlet, isn't working, what should I do to get this to work with servlet? public class SelectDirectory { public static void main(String args[]) throws IOException, Exception { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("choosertitle"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { String dirFolder = "" + chooser.getSelectedFile() + ""; FunctionsOfZip zipFun = new FunctionsOfZip(); zipFun.InputReader(dirFolder); } else { System.out.println("No Selection "); } } }
tagged with: java
has comment: http://stackoverflow.com/comment/37048152
tagged with: servlets
tagged with: jfilechooser
linked to: http://stackoverflow.com/q/4502182
type: Question
answer count: 2
has title: JFileChooser not working with Servlets?
score: 0
has comment: http://stackoverflow.com/comment/37048064
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37047970
has answer: http://stackoverflow.com/a/24032892
has answer: http://stackoverflow.com/a/24042713
has comment: http://stackoverflow.com/comment/37047977

http://stackoverflow.com/q/24006990
has comment: http://stackoverflow.com/comment/37000225
type: Question
has comment: http://stackoverflow.com/comment/37002328
has comment: http://stackoverflow.com/comment/37000047
has comment: http://stackoverflow.com/comment/36999987
has answer: http://stackoverflow.com/a/24007521
downvote count: 5
answer count: 6
score: -1
has body: I have a Singleton class. When I try to access the instance of the class I get a NullPointerException. Here is my code:- Logout.java private static Logout instance; public Logout() { instance = this; } public static Logout getInstance() { return instance; } public void clearApplicationData() { File cache = getCacheDir(); File appDir = new File(cache.getParent()); if (appDir.exists()) { String[] children = appDir.list(); for (String s : children) { if (!s.equals("lib")) { deleteDir(new File(appDir, s)); Log.i("TAG", "**************** File /data/data/APP_PACKAGE/" + s + " DELETED *******************"); } } } } public static boolean deleteDir(File dir) { if (dir != null &amp;&amp; dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i &lt; children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); } Main.java Logout.getInstance.clearapplicationData(); //NullPointerException here Can anyone point out what I am doing wrong here?
has comment: http://stackoverflow.com/comment/37000015
upvote count: 4
has answer: http://stackoverflow.com/a/24007213
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24007045
tagged with: singleton
tagged with: android
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37000056
has answer: http://stackoverflow.com/a/24008132
linked to: http://stackoverflow.com/q/23964101
has answer: http://stackoverflow.com/a/24007235
has comment: http://stackoverflow.com/comment/37000033
has answer: http://stackoverflow.com/a/24028783
tagged with: java
has title: Singleton class returning NullPointerException

http://stackoverflow.com/comment/36905845
type: Comment
has text: I've tried, says I've got to wait for two days for some reason. Thanks for letting me know though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23953260

http://stackoverflow.com/comment/37229981
type: Comment
has text: MSDN mentions the `QueryFullProcessImageName` API to retrieve 32bit and the 64 bit information from a 32 bit process or use a 64bit JVM and JNA 64bit and you call CreateToolhelp32Snapshot with the flags Tlhelp32.TH32CS_SNAPPROCESS|Tlhelp32.TH32CS_SNAPPROCESS32 but I have no experience to share on that. Sorry.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24110581

android-activity
tags question: http://stackoverflow.com/q/24025199
tags question: http://stackoverflow.com/q/23984690
tags question: http://stackoverflow.com/q/23951819
tags question: http://stackoverflow.com/q/24077901
tags question: http://stackoverflow.com/q/24056149
tags question: http://stackoverflow.com/q/24071345
tags question: http://stackoverflow.com/q/24036326
tags question: http://stackoverflow.com/q/24090704
tags question: http://stackoverflow.com/q/24053957
tag name: android-activity
tags question: http://stackoverflow.com/q/23979510
tags question: http://stackoverflow.com/q/24071115
tags question: http://stackoverflow.com/q/24092052
tags question: http://stackoverflow.com/q/24027642
tags question: http://stackoverflow.com/q/24054865
tags question: http://stackoverflow.com/q/24013152
tags question: http://stackoverflow.com/q/23979046
tags question: http://stackoverflow.com/q/24082513
tags question: http://stackoverflow.com/q/24054053
tags question: http://stackoverflow.com/q/23956015
tags question: http://stackoverflow.com/q/23955636
type: Tag

http://stackoverflow.com/comment/36943655
has text: I tried with localhost as well i got same issue
type: QuestionComment
comment on: http://stackoverflow.com/q/23977013
score: 0
type: Comment

http://stackoverflow.com/comment/36877919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23941683
score: 0
has text: Do you need to handle each exception caught differently? If not, just have a single catch for parentexception.

http://stackoverflow.com/comment/36951365
comment on: http://stackoverflow.com/q/23981199
type: QuestionComment
has text: "Right"? What are you asking? Why not just test your code?
type: Comment
score: 2

http://stackoverflow.com/q/23945498
type: AnsweredQuestion
tagged with: onclick
score: 1
tagged with: java
tagged with: dom
type: Question
has body: I have a problem that I sinked two events ONMOUSEOVER and ONCLICK. My problem is that the ONMOUSEOVER get called but ONCLICK is not getting fired at all !! Here is my code sample LIElement elem = Document.get().createLIElement(); DOM.sinkEvents(elem, Event.ONCLICK | Event.ONMOUSEOVER); DOM.setEventListener(elem, new EventListener() { @Override public void onBrowserEvent(Event event) { if (Event.ONCLICK == event.getTypeInt()) { //Not reaching this code block at all !! } if (Event.ONMOUSEOVER == event.getTypeInt()) { //Everything is working fine here } } }); This code is working just fine in other part of the system, and I am generating the LIElements dynamically BUT I don't think that this is the problem. Might it be something related to attaching browser listeners or DOM rendering? Any help will be appreciated I am chasing this since two days.
upvote count: 1
linked to: http://stackoverflow.com/q/20004658
answer count: 1
downvote count: 0
has title: GWT - SinkEvent ONCLICK is not working
favorite count: 0
has answer: http://stackoverflow.com/a/23946615
accepted answer: http://stackoverflow.com/a/23946615
tagged with: gwt

http://stackoverflow.com/q/23985388
has body: I am working on a project. When I set a String I'd like the setting method to test for a null value. If there is a null value I'd like set the global variable to "purple hotdog". I get an error that says Type mismatch: cannot convert from String to boolean and I'm not sure why. Eventually I'd like to call a method that returns a value that encryptedBlock is set to instead of setting the value to "purple hotdog", but baby steps for now. Here is my code, and thanks for the help. private String encryptedBlock = null; public void setEncryptedBlock(String encryptedBlock) { if (this.encryptedBlock.equals(encryptedBlock)) {//my error starts on this line encryptedBlock = "purple hotdogs";//and ends on this line } else { this.encryptedBlock = encryptedBlock; } }
has answer: http://stackoverflow.com/a/23985407
score: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23985407
type: Question
has title: trouble setting a string value
answer count: 1
favorite count: 0
tagged with: compare

http://stackoverflow.com/comment/37142645
type: AnswerComment
score: 0
has text: That I expected. Try (1) either to change this into `public ArrayList<Cell> neighborCells;` or (2) add a `public void addNeighbor(Cell cell)` function to it. Sadly I cannot suggest a good beginner's tutorial for Java (I'm not a Java programmer), but I guess you are in need for it. (Just one note: the first option is considered to be "bad style")
type: Comment
comment on: http://stackoverflow.com/a/24078653

http://stackoverflow.com/a/23949742
has body: You can attach to the EditText a listener being notified when the text change, this is natively supported by the android framework: As an example: editText = (EditText)findViewById(R.id.your_edit_text_id); textMessage.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) { //perform checks or implement logic on what the user has entered so far here... } public void beforeTextChanged(CharSequence s, int start, int count, int after){} public void onTextChanged(CharSequence s, int start, int before, int count){} });
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36893352
answers question: http://stackoverflow.com/q/23949628
upvote count: 2
has comment: http://stackoverflow.com/comment/36895001
has comment: http://stackoverflow.com/comment/36896297
type: Answer

http://stackoverflow.com/q/24087108
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24087137
has title: I want to draw draggable JComponent on background image
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24087137
tagged with: swing
tagged with: draggable
tagged with: drag
type: Question
tagged with: components
has body: There are code that one is a Zoo, the other is animal(tiger and eagle are same code now, so i just write Tiger.java). I want to draw draggable JComponent on background image. Draggable JComponent was worked on the frame, not image. First, I click on image then draw my animal, Second, after i draw many animal, I can drag and drop my animal anywhere on image. Please teach me how to draw. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; class BgPanel extends JPanel { Image bg = new ImageIcon("c:\\back.jpg").getImage(); public void paintComponent(Graphics g) { g.drawImage(bg,0,0,getWidth(),getHeight(),this); } } public class Zoo extends JFrame implements ActionListener { Container c; JFrame frame = new JFrame(); JComboBox comBox = new JComboBox(); drawCanvas can = new drawCanvas(); saving_drawing saving=new saving_drawing(); Tiger tiger; Eagle eagle; Point point; ArrayList&lt;saving_drawing&gt; arr_saving = new ArrayList(); Zoo() { JPanel bgPanel = new BgPanel(); bgPanel.setLayout(new BorderLayout()); comBox.addItem("Tiger"); comBox.addItem("Eagle"); comBox.addActionListener(this); frame.setContentPane(bgPanel); bgPanel.add(comBox, BorderLayout.SOUTH); bgPanel.add(can, BorderLayout.CENTER); frame.setSize(500,500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Zoo"); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { if("Tiger".equals(comBox.getSelectedItem())) { saving.drawChoice=1; } else if("Eagle".equals(comBox.getSelectedItem())) { saving.drawChoice=2; } } class drawCanvas extends JComponent { public drawCanvas() { this.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { count++; if(count!=0) { saving.point=e.getPoint(); arr_saving.add(new saving_drawing(saving.drawChoice,saving.point)); repaint(); System.out.println("click"); } } public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e){…

http://stackoverflow.com/q/24054456
has title: SQL - Making tables
has comment: http://stackoverflow.com/comment/37088989
has comment: http://stackoverflow.com/comment/37088738
has answer: http://stackoverflow.com/a/24054841
score: 0
type: UnansweredQuestion
type: Question
has body: Below is my code. I'm trying to get the two results on a same table but somehow I can only get them on separate table. Is there a way somehow to get both the tables to be linked together. For example: Result1: Active Day Year\\\Day\\\ Total 2014\\\1\\\\\\\ MY and Result2: Timing Year\\\Month\\\ Total 2014\\\12\\\\\\\\\ SG to Active Day\\\\\\\\\\\\\\\\\\\\ Timing Year\\\Day\\\ Total\\\\\\\\\\Month\\\ Total 2014\\\1\\\\\\\ MY\\\\\\\\\\\\\12\\\\\\\\\ SG public static String Summary() { String strResult="", result1="", result2="" Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(DB_URL, USER, PASS); String sql; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection connection = DriverManager.getConnection(url); Statement statement = connection.createStatement(); sql = "EXECUTE GEOIP.dbo.CF_VIEW_DAILY_STAT'"+yesterdayDate()+"';"; CallableStatement cstmt = connection.prepareCall(sql); boolean hasMoreResultSets = cstmt.execute(); if (!hasMoreResultSets) { //System.out.println("The first result is not a ResultSet."); return strResult; } //First Result ResultSet rs = cstmt.getResultSet(); result1 = " " + " Active Day " + " Date Day (s) Country / Total Active Count " + " "; while (rs.next()) { result1 += " " + " " + rs.getString("StatDt") + " " + String.format("%,d", rs.getInt("ActiveDay")) + " " + rs.getString("Country") + " " + String.format("%,d", rs.getInt("ActiveCnt")) + " " +" "; } result1 += " "; rs.close(); //Second Result hasMoreResultSets = cstmt.getMoreResults(); if (!hasMoreResultSets) { //System.out.println("The first result is not a ResultSet."); return strResult; } ResultSet rs = cstmt.getResultSet(); result2 = " " + " Conversion " + " Date NRU " + " NRU_Play " + " "; while (rs.next()) { result2 += " " + " "+ rs.getString("StatDt") + " " + String.format("%,d", rs.getInt("NRU")) + " " + String.format("%,d", rs.getInt("NRU_Play")) + " "; } result2 += " "; rs.close(); cstmt.close(); connecti…
tagged with: java
tagged with: mysql
answer count: 3
has answer: http://stackoverflow.com/a/24054703
tagged with: arrays
has answer: http://stackoverflow.com/a/24057033

http://stackoverflow.com/comment/36921722
has text: You can use both `getServletContext().getResourceAsStream(...)` (if the file is in the classpath) as well as use absolute path - but I don't see any connection to that fact with a property file "should be read by a listener". A listener listens to events and runs callbacks on the occurrence of those events - it has nothing to do with loading a properties file.
score: 0
comment on: http://stackoverflow.com/q/23964792
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36968253
comment on: http://stackoverflow.com/q/23990299
type: Comment
score: 0
type: QuestionComment
has text: Log your exceptions to see the likely `NetworkOnMainThreadException`

http://stackoverflow.com/comment/37035835
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24024506
score: 0
has text: I wouldn't recommend pf 5 for production yet, since has some major changes and lots of bugs (we tried to update our app but we ended returning to pf 4), in the other hand, are you using maven?, if not you should check the las stable deploy, since even us could work with buttons and tables in pf 5 (was some other components as list and filters which seems to be broken)

http://stackoverflow.com/comment/37084618
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24050223
has text: `UnsatisfiedLinkError` clearly means that the function is not loaded. If you are certain that the shared library `libtestLib.so` is loaded at runtime, then it might be the case that the symbol is not in the library (i.e. the function has not been compiled in the library). Are you certain that you added the sources in your `Android.mk` file? You can look for `testNativeMethod` in your shared library by listing the symbols (have a look [here](http://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object)).
score: 0

http://stackoverflow.com/comment/36887049
score: 1
comment on: http://stackoverflow.com/q/23946492
type: QuestionComment
type: Comment
has text: For xls files - http://stackoverflow.com/questions/1516144/how-to-read-and-write-excel-file-in-java

http://stackoverflow.com/q/23997701
tagged with: selenium
answer count: 1
type: UnansweredQuestion
has title: Selenium Webdriver : Screenshots in Opera
has body: I tried using TakeScreenshot in java selenium webdriver to take screenshots. When I scroll by a specific amount using scrollTo(x,y) in the page , the TakeScreenshot method gives me the screenshot the first viewport and not the one that has been reached after scrolling. I want to know if the TakeScreenshot method gives the screenshot of the first viewport or the current viewport in Opera webdriver. In chrome, it takes the screenshot of the current webdriver !
type: Question
has answer: http://stackoverflow.com/a/26345089
tagged with: selenium-webdriver
score: 0
tagged with: java

http://stackoverflow.com/a/25378112
accepted answer of: http://stackoverflow.com/q/23987944
score: 10
type: AcceptedAnswer
downvote count: 0
has body: The following properties do not work on Report Level: &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt; &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt; You have to put them on Report Elements (i.e.): &lt;staticText&gt; &lt;reportElement x="0" y="100" width="100" height="20"&gt; &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt; &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt; &lt;/reportElement&gt; &lt;textElement/&gt; &lt;text&gt;&lt;![CDATA[Your Static Text]]&gt;&lt;/text&gt; &lt;/staticText&gt; Also I'd recommend you to try using net.sf.jasperreports.export.xls.column.width property, which is more useful. Reference: http://jasperreports.sourceforge.net/config.reference.html
type: Answer
answers question: http://stackoverflow.com/q/23987944
upvote count: 10

http://stackoverflow.com/q/24023634
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37031115
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/37031117
has comment: http://stackoverflow.com/comment/37031037
tagged with: type-erasure
accepted answer: http://stackoverflow.com/a/24023882
type: AnsweredQuestion
score: 3
upvote count: 3
has title: generics collections.mixin raw and generic type. Integer -> String - exception but String -> Integer works good
tagged with: java
type: Question
tagged with: casting
has body: I am confusing with two code snippets: snippet 1 List list = new ArrayList(); list.add("1"); Iterator&lt;Integer&gt; iterator = list.iterator(); System.out.println(iterator.next()); this code executes normally and outs 1 to console snippet 2 List list = new ArrayList(); list.add(1); Iterator&lt;String&gt; iterator = list.iterator(); System.out.println(iterator.next()); Result of it - RuntimeException java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String I am confusing because both these rows are wrong: Integer integer = "123"; String string = 1; It is compile error. Why does for generis behaviour is different? P.S. I am prepare for scjp exam and don't mix raw type and generics;
has comment: http://stackoverflow.com/comment/37031031
tagged with: type-conversion
has answer: http://stackoverflow.com/a/24023882
has comment: http://stackoverflow.com/comment/37031180

http://stackoverflow.com/q/23954436
has title: Project doesnt run main class
tagged with: jform-designer
score: 0
has answer: http://stackoverflow.com/a/23954499
has comment: http://stackoverflow.com/comment/36901215
answer count: 1
type: AnsweredQuestion
has body: I have a small problem with Jform-Designer, I've made a Designer class (Jform class) and i defined that as my main class. Like this: class Designer extends JFrame { public static void main(String[] args) { Designer design; design = new Designer(); design.initComponents(); } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout( "9*(default, $lcgap), default", "9*(default, $lgap), default")); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } } But the program doesnt run now, i think it is stuck in a infinite loop at this part of my code: public static void main(String[] args) { Designer design; design = new Designer(); design.initComponents(); } Can someone explain what i need to do to run the project properly. Thanks in advance
tagged with: java
has comment: http://stackoverflow.com/comment/36901138
has comment: http://stackoverflow.com/comment/36901222
type: Question
accepted answer: http://stackoverflow.com/a/23954499

http://stackoverflow.com/comment/36977900
comment on: http://stackoverflow.com/q/23995341
score: 0
has text: How is it not working?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24069407
favorite count: 0
tagged with: jdbc
upvote count: 2
type: UnansweredQuestion
tagged with: master-slave
score: 2
has answer: http://stackoverflow.com/a/24071653
has title: Call stored procedure on mysql slave using ReplicationDriver
tagged with: java
tagged with: mysql
tagged with: mysql-connector
has body: I have a Spring application that currently executes some queries utilizing stored procedures. The configuration is something like this: Datasource: &lt;bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="com.mysql.jdbc.ReplicationDriver"/&gt; &lt;property name="url" value="jdbc:mysql:replication://master,slave1,slave2/db?allowMultiQueries=true"/&gt; &lt;property name="username" value="${db.dbusername}"/&gt; &lt;property name="password" value="${db.dbpassword}"/&gt; &lt;property name="defaultReadOnly" value="true"/&gt; &lt;/bean&gt; &lt;bean id="jdbcDeviceDAO" class="dao.jdbc.JdbcDeviceDAO"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; DAO: public class JdbcDeviceDAO implements DeviceDAO { // ... public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.procGetCombinedDeviceRouting = new SimpleJdbcCall(jdbcTemplate) .withProcedureName("get_combined_device_routing"); // ... } public CombinedDeviceRouting getCombinedDeviceRouting(String deviceName, String deviceNameType) { SqlParameterSource in = createParameters(deviceName, deviceNameType); Map&lt;String, Object&gt; results = this.procGetCombinedDeviceRouting.execute(in); return extractResults(results); } Now when I call getCombinedDeviceRouting(...) it fails with the following exception: org.springframework.dao.TransientDataAccessResourceException: CallableStatementCallback; SQL [{call get_combined_device_routing()}]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed I know the connection is read-only and I need it to be that way so the queries are load-balanced between slave hosts. But the stored procedure is actually read only, it's just a lot of SELECT statements, in fact I tried adding READS SQL DATA to its d…
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/a/59796853
answers question: http://stackoverflow.com/q/24099961
has body: Let us understand this through an example: I have a class: For this getter method ie getList, I want to get returnType in my Aspect Class. I can access the returnType using @AfterReturning annotation's returning parameter. For example : Output from the method is like : Hope it clarifies.
score: 0
type: Answer

http://stackoverflow.com/a/35704504
type: Answer
score: 1
upvote count: 1
has body: What you did wrong is cameraPosition.lerp(target, 0.1f); since this applies the lerp immediately to the camera position and so the next time you call it the cameraPosition is not the same anymore and thus you are lerping between different values as the previous iteration. What you can do is storing the begin position when starting to lerp. //call once when you want to move private void move() { beginPosition = cameraPosition.cpy(); //make sure you copy so it's not a reference of cameraPosition. lerpAlpha = 0; } public update() { //.. //Calculate lerp alpha lerpAlpha += .1; //.. camera.position.set(beginposition.cpy().lerp(target, lerpAlpha), 0); //Copy again so it does not change. //.. } Whenever you get strange results using Vectors it is 99% of the time because you did not copy the Vector and applying methods directly to it since it uses a chaining pattern (it alters the given object and returns it).
downvote count: 0
answers question: http://stackoverflow.com/q/24047172

http://stackoverflow.com/q/24053307
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has title: Overriding a method which requires raw type parametrization
type: Question
has comment: http://stackoverflow.com/comment/37088424
has comment: http://stackoverflow.com/comment/37086335
tagged with: raw-types
tagged with: overriding
has body: OK here is my question: I have a abstract superclass which contains a method public double[][] extractFeatures(BufferedImage image) throws Exception. I want to override it (that is, to have my implementation of the subclass being called when I define a subclass object). The problem is that the implementation I am using needs a raw type parametrization like &lt;II extends ImageSingleBand&gt; in order to function correctly (otherwise there are errors). So now the signature becomes: public &lt;II extends ImageSingleBand&gt; double[][] extractFeatures(BufferedImage image) The problem is that Java compilers gives me a name clash noting that it has the same erasure but does not override it A fact that might help is that in the subclass extractFeatures() method when I do not use the raw type parametrization the error occur when the code declares a variable: Class&lt;II&gt; integralType = ... Changing that to Class&lt;II extends ImageSingleBand&gt; integralType = ... did not solve the problem either. I know that I can skip this problem by various ways: (a) Renaming extractFeatures() of the subclass (I can use it in my case by I would prefer a more consistent solution) (b) Moving all parts that need the raw type parametrization to another function that can be called inside the subclass extractFeatures() (that is the solution the previous code writer chose), so I am not asking for a solution that works rather to clarify the situation My question is whether there is a way to solve this without using a bypass solution like the previously mentioned or that erasure issue ties my hands.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37089434
favorite count: 0
has comment: http://stackoverflow.com/comment/37088352
has comment: http://stackoverflow.com/comment/37086336
has answer: http://stackoverflow.com/a/24053535

http://stackoverflow.com/q/24085571
has body: I understand the concept of synchronizing, but I'm now sure about why is it implemented that way, so I need a little help in here: I have 2 threads: PeriodicalThread will receive data periodically (let's say each 5 seconds) and put it in a Queue (using ArrayDeque for the moment, but I don't know if any other Queue implementation will work better) ProccessThread will constantly check on the Queue to see if it is empty. If it is not empty, it will process the data (FIFO). So, at first my implementation would be: // Both threads are inner class so they have access to Queue private Queue queue; private boolean isReadyToProccess; class PeriodicalThread extends Thread { public void run() { while(true) { if(isNewDataAvailable) { // create Data object queue.add(data); } } } } class ProcessThread extends Thread { public void run() { while(true) { if(!queue.isEmpty() &amp;&amp; isReadyToProccess) { Data data = queue.poll(); processData(data); } } } } private void processData(Data data) { // this method send data over network, and the server response callback // changes isReadyToProcess value to true. } Then when wanting to handle synchronization, I wouldn't know If I should use a lock object (and how is it implemented) or if there is already a package Queue implementation that is thread-safe (because of the add() and poll() methods) Edit: I forgot about the flag isReadyToProcess indicating next queue Data object is... well, ready to be proccessed. This flag should be synchronized also.
accepted answer: http://stackoverflow.com/a/24085611
favorite count: 0
has answer: http://stackoverflow.com/a/24085622
tagged with: multithreading
upvote count: 7
has comment: http://stackoverflow.com/comment/37145882
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/73999178
has answer: http://stackoverflow.com/a/24085699
tagged with: queue
type: Question
has title: Synchronizing queue in Java on multiple threads
has answer: http://stackoverflow.com/a/24086407
downvote count: 0
possible better answer: http://stackoverflow.com/a/24085699
answer count: 6
has answer: http://stackoverflow.com/a/24085611
has answer: http://stackoverflow.com/a/24085755
has comment: http://stackoverflow.com/comment/37148139

http://stackoverflow.com/comment/37059738
score: 0
type: AnswerComment
type: Comment
has text: That's neat. That means you just need to iterate the Fruit's array, check the collision with that single weapon, and if it's true, then remove the fruit from the list and do what else needs to be done.
comment on: http://stackoverflow.com/a/24015190

http://stackoverflow.com/comment/37078015
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24048046
type: Comment
has text: All source is on Github at the following links: https://github.com/MrLarssonJr/FlagHolder https://github.com/MrLarssonJr/Game_Engine And link to runnable jar https://drive.google.com/file/d/0B0PbQ_ldw1ClNTVnaWdXMGpyVWM/edit?usp=sharing (start with the flag local)

http://stackoverflow.com/comment/36936312
type: QuestionComment
has text: I have tried my code on eclipse,bluej and even command prompt ...still all i see is a stationary rectangle.....its really discouraging
score: 0
comment on: http://stackoverflow.com/q/23970046
type: Comment

http://stackoverflow.com/comment/37038261
comment on: http://stackoverflow.com/a/24027356
score: 1
type: AnswerComment
has text: Wow, thank you so much!! I'm literally grinning from ear to ear now that it works! Although I do have one question. How did you know you could find a jar at the Maven site? And what exactly is Maven? I've seen quite a few projects on GitHub refer to it.
type: Comment

http://stackoverflow.com/q/23991299
has comment: http://stackoverflow.com/comment/36970045
favorite count: 0
has comment: http://stackoverflow.com/comment/36971062
linked to: http://stackoverflow.com/q/25777714
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23991661
upvote count: 7
has comment: http://stackoverflow.com/comment/36970415
answer count: 4
has comment: http://stackoverflow.com/comment/36970483
tagged with: performance
has answer: http://stackoverflow.com/a/23991640
has comment: http://stackoverflow.com/comment/36970444
has comment: http://stackoverflow.com/comment/36970394
has comment: http://stackoverflow.com/comment/36970073
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/23992070
has comment: http://stackoverflow.com/comment/36970046
type: Question
has body: I have two integer array each of same size say n ( n is variable, so I can have two arrays of size say 4 or 5 or 6 etc ) and the range of values that each digit can take is in the range of 0-9. Example Integer[] one = {1,9,3,4} Integer[] two = {1,1,9,3} Now, I want to compare array one &amp; two such that 1) I can get the count of numbers of elements which are same and at the same position. 2) I can get the count of number which are same but not at the same position . The approach I have taken is For (1) Iterate through array one and for each index i check one[i] == two[i]. - simple . For (2) Iterate over both the arrays and for i != j see if the elements are same , if same mark them with -1 to avoid future conflicts. for(int i =0;i&lt;one.length;i++){ for(int j=0;j&lt;two.length;j++){ if(i != j &amp;&amp; one[i] != -1 &amp;&amp; two[j] !=-1)){ if(one[i] == two[j]){ whiteCount++ one[i] = -1; two[j] = -1; } } } } Question : Now I want to know if there is a faster way to do the same thing ? Esp. calculating the (2)nd part of the problem. This is a basic comparison method to get black and white pegs calculation for Mastermind board game . Thanks Shakti UPDATE 1: 1) Rudi's suggestion changed Integer[] to int[] 2) Used Dave Challis's solution Change in performance for 7776 X 7776 calculations OLD 46950 ms NEW 42887 ms
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/36970638
has answer: http://stackoverflow.com/a/23991606
has comment: http://stackoverflow.com/comment/36970923
has comment: http://stackoverflow.com/comment/37025742
has comment: http://stackoverflow.com/comment/36971299
has title: Is there a faster way to compare two Int arrays in Java?
has comment: http://stackoverflow.com/comment/115283878

http://stackoverflow.com/comment/37171976
type: QuestionComment
has text: Created a new blank file, typed in the xml, saved it, and no change.
comment on: http://stackoverflow.com/q/24099361
score: 0
type: Comment

http://stackoverflow.com/q/24023273
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37052099
upvote count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: android-intent
tagged with: java
has title: Android league app keeps crashing
type: Question
score: -2
tagged with: counter
has answer: http://stackoverflow.com/a/24023453
has body: Need a bit of help, creating an app that sends the results of ten team name, games won and drawn does a calculation to work out total points then is supposed to display them but after the continue button is clicked the app always crashes. heres the code any guides on whats went wrong many thanks package com.example.leaguetest; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.widget.TextView; public class Display extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display); //get the the BUNDLE inside the intent Bundle m = this.getIntent().getExtras(); String [] TeamName = m.getStringArray("TeamName"); String[] SWin = m.getStringArray("Win"); String[] SDraw = m.getStringArray("Draw"); int [] Win = new int[10]; int [] Draw = new int [10]; // Convert to from string to integer Win Win[1] = Integer.parseInt(SWin[1]); Win[2] = Integer.parseInt(SWin[2]); Win[3] = Integer.parseInt(SWin[3]); Win[4] = Integer.parseInt(SWin[4]); Win[5] = Integer.parseInt(SWin[5]); Win[6] = Integer.parseInt(SWin[6]); Win[7] = Integer.parseInt(SWin[7]); Win[9] = Integer.parseInt(SWin[8]); Win[9] = Integer.parseInt(SWin[9]); Win[10] = Integer.parseInt(SWin[10]); // Convert to from string to integer Draw Draw[1] = Integer.parseInt(SDraw[1]); Draw[2] = Integer.parseInt(SDraw[2]); Draw[3] = Integer.parseInt(SDraw[3]); Draw[4] = Integer.parseInt(SDraw[4]); Draw[5] = Integer.parseInt(SDraw[5]); Draw[6] = Integer.parseInt(SDraw[6]); Draw[7] = Integer.parseInt(SDraw[7]); Draw[8] = Integer.parseInt(SDraw[8]); Draw[9] = Integer.parseInt(SDraw[9]); Draw[10] = Integer.parseInt(SDraw[10]); //Calculation int Result1 = (Win[1]* 3)+Draw[1]; TextView Result1T=(TextView)findViewById(R.id.TextView1); Result1T.setText(TeamName[1] ); TextView Result2T=(TextView)findViewById(R.id.TextView2); Result2T.setText( Result1); } @Override public boolean onCreateOptionsMenu(Menu men…
tagged with: android

http://stackoverflow.com/q/24095626
type: Question
has title: Convert a java string to an xml that contains valid utf-8 characters
has comment: http://stackoverflow.com/comment/37165056
answer count: 1
score: 0
tagged with: utf-8
has answer: http://stackoverflow.com/a/24095676
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has body: Here is what I was doing - Take up a document(JSON) from mongodb Write this key value as an XML Send this XML to Apache Solr for indexing Here is how I was doing step #2 Given key say "key1" and value as "value1" step#2 output is "&lt;"+ key1 + "&gt;" + value1 + "&lt;/"+ key1 + "&gt;" Now when i send this XML to Solr, I was getting Stax exceptions like - Invalid UTF-8 start byte 0xb7 Invalid UTF-8 start byte 0xa0 Invalid UTF-8 start byte 0xb0 Invalid UTF-8 start byte 0x96 So here is how I am thinking to fix it - key1New = new String(key1.getBytes("UTF-8"), "UTF-8"); value1New = new String(value1.getBytes("UTF-8"), "UTF-8"); Should this work OR I should rather do this - key1New = new String(key1.getBytes("UTF-8"), "ISO-8859-1"); value1New = new String(value1.getBytes("UTF-8"), "ISO-8859-1");
tagged with: java
has comment: http://stackoverflow.com/comment/37164953

http://stackoverflow.com/a/23947538
has comment: http://stackoverflow.com/comment/36888994
upvote count: 2
type: Answer
score: 2
has body: Heap size isn't your issue. When you have one of those, you'll see an OutOfMemoryError. Usually what you do when you encounter performance issues like this is you profile, either with something like VisualVM or by hand, using System.nanoTime() to track which part of your code is the bottleneck. From there, you make sure you're using appropriate data structures, algorithms, etc., and then see where you can parallelize your code.
downvote count: 0
answers question: http://stackoverflow.com/q/23947460

http://stackoverflow.com/comment/36919720
has text: try-with can never help in your situation. The try-with is intended to be used in a situation where the identified resource must never persist outside the scope of the try block. This in no way applies to your situation
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23963829

http://stackoverflow.com/a/24004413
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24004333
type: Answer
has body: You're right and wrong in your thinking: Where you're right: Yes, uninitialized variables may be assigned a value by the compiler, but a) it is considered bad style, b) You shouldn't depend on it, c) That does not apply to local variables (as declared in a method) Where you are wrong: Local variables are not assigned a default value, only instance variables. For reference, take a look at The docs: Default Values It's not always necessary to assign a value when a field is declared. Fields that are declared but not initialized will be set to a reasonable default by the compiler. Generally speaking, this default will be zero or null, depending on the data type. Relying on such default values, however, is generally considered bad programming style. The following chart summarizes the default values for the above data types. Data Type Default Value (for fields) byte 0 short 0 int 0 long 0L float 0.0f double 0.0d char '\u0000' String (or any object) null boolean false Local variables are slightly different; the compiler never assigns a default value to an uninitialized local variable. If you cannot initialize your local variable where it is declared, make sure to assign it a value before you attempt to use it. Accessing an uninitialized local variable will result in a compile-time error.

http://stackoverflow.com/comment/36933316
score: 1
comment on: http://stackoverflow.com/q/23971365
type: QuestionComment
has text: If you're hoping to improve an existing solution then maybe you could post at http://codereview.stackexchange.com/?
type: Comment

http://stackoverflow.com/q/24070668
type: UnansweredQuestion
upvote count: 1
tagged with: properties
has title: Web Application Password Security
has comment: http://stackoverflow.com/comment/37121788
tagged with: configuration
tagged with: java
type: Question
answer count: 2
downvote count: 0
score: 1
favorite count: 0
tagged with: security
has body: My company has a Java Web Application with the database password stored in a properties file and we need to secure the password. I've googled and found the Jasypt solution, but in my mind that doesn't really solve the problem because that requires another password to feed to the application and I don't know how to secure that password. The main suggestion for Jasypt is to feed the password in as an environment variable, which means that in the best case scenario I would be starting the application like: ./myApp -D password=myPasswordDontHackPlz which isn't secure because you can see the password when you do ps -ef | grep myApp We also can't feed the password in when it needs it (via a the web or something) because it essentially decides when it needs the password, and it needs it pretty often. Is there any solution to this or am I asking for some magical solution that doesn't exist? I don't like Jasypt because it seems to me to essentially just be obfuscation, and I'm not after obfuscation i'm looking for true security here.
has answer: http://stackoverflow.com/a/24071354
has answer: http://stackoverflow.com/a/24071606

http://stackoverflow.com/comment/63619882
score: 0
comment on: http://stackoverflow.com/q/24011527
type: QuestionComment
type: Comment
has text: Having the exact same problem as OP, I'd really like to know how to solve this one.

http://stackoverflow.com/a/24004789
downvote count: 0
answers question: http://stackoverflow.com/q/24004762
has comment: http://stackoverflow.com/comment/36996176
has comment: http://stackoverflow.com/comment/36996301
has comment: http://stackoverflow.com/comment/36996210
upvote count: 3
has body: You state: It seems that my code works as soon as I remove g.dispose(); So then remove it. You should never never dispose of a Graphics object given to you by the JVM. The first thing you should do is get the g.dispose() call out of your paintComponent(...) method. If you copy the Graphics object and paint with the copy, or if you paint with a Graphics object obtained from a BufferedImage, then yes, dispose of them to save on resources, but if you dispose of the JVM's Graphics object you risk painting problems down stream when the JVM tries to continue using that Graphics object to paint other components.
has comment: http://stackoverflow.com/comment/36996731
has comment: http://stackoverflow.com/comment/36996234
has comment: http://stackoverflow.com/comment/36996183
type: Answer
score: 3

http://stackoverflow.com/comment/37084892
has text: Well you would have to send the length on ahead, and then write a loop that receives until you get that length, incrementing the offset parameter and decrementing the length parameter as you go.
type: AnswerComment
comment on: http://stackoverflow.com/a/24048713
score: 0
type: Comment

http://stackoverflow.com/a/24030985
type: Answer
answers question: http://stackoverflow.com/q/24030892
score: 6
upvote count: 6
has body: You should use Patterns.WEB_URL.matcher(youTubeURl).matches() It will return True if URL is valid and false if URL is invalid.
downvote count: 0

http://stackoverflow.com/a/24881813
answers question: http://stackoverflow.com/q/23981036
type: Answer
has body: I think you need to start from the point of looking at modeling your data to use atomic operations. What you are describing is an insert data if not present. You could do this with an upsert and looking from your logic if the country exists you don't want to change anything (as you just return out of the method). So you can just use the $setOnInsert operator - so that you only save the values of your countryObj if it doesn't already exist. The last hurdle is the name matching - as you are testing for equivalence against lowercased versions of the names - you could use a regular expression in your query but that would do a full scan of your documents in the collection - so another alternative is to store the lowercased name to match against. An example that queries and inserts if not present using shell syntax is below: db.collection.update( {lname: countryName.toLowerCase()}, { $setOnInsert: { name: countryName, states: [{name: "Victoria"}] } }, { upsert: true } ) Of course if you wanted to update any information if the country does exist you can also use the $set operator to update even if the country exists.
score: 0

http://stackoverflow.com/q/23946358
has answer: http://stackoverflow.com/a/23946400
tagged with: swing
has body: I am adding a Canvas to my JFrame - or rather, an object that inherits from Canvas - and then I wish to get that Canvas object from the JFrame, cast it to that object that inherits from Canvas, and call a method. However, when I add my Canvas to the JFrame and check the length of my getComponents array, it remains the same. Where is my canvas being added, and where can I access it? System.out.println(getComponents().length()); add(new OuterSpace()); System.out.println(getComponents().length()); //This length doesn't change after I add the Canvas for some odd reason [EDIT] There is a certain method that I cannot call until the Canvas has been added to a JFrame, so that is why I wish to achieve this.
tagged with: java
type: Question
has title: Access Canvas From JFrame
tagged with: canvas
score: 0
answer count: 1
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/a/23966339
has comment: http://stackoverflow.com/comment/36924362
score: 4
answers question: http://stackoverflow.com/q/23966228
has comment: http://stackoverflow.com/comment/36924743
has comment: http://stackoverflow.com/comment/36924297
type: Answer
upvote count: 4
has body: Here ya go: class Example { static class Node { final String name; final int indent; Collection&lt;Node&gt; children = new LinkedList&lt;&gt; (); Node (final String name) { this.name = name; this.indent = Integer.valueOf (name.substring (1)); } Collection&lt;Node&gt; getChildren () { return Collections.unmodifiableCollection (this.children); } void addChild (final Node child) { this.children.add (child); } @Override public String toString () { final StringBuilder sb = new StringBuilder (); for (int i = 0; i &lt; this.indent; i++) sb.append (" "); sb.append (this.name).append ('\n'); for (final Node node : this.children) sb.append (node.toString ()); return sb.toString (); } } List&lt;Node&gt; contents = new LinkedList&lt;&gt; (); ArrayList&lt;Node&gt; stack = new ArrayList&lt;&gt; (); public void add (final String[] headers) { for (final String h : headers) { final int n = Integer.valueOf (h.substring (1)); final Node node = new Node (h); while (this.stack.size () &gt; n - 1) this.stack.remove (this.stack.size () - 1); if (n == 1) { this.contents.add (node); this.stack.add (node); } else { this.stack.get (n - 2).addChild (node); if (this.stack.size () &lt; n) { assert (this.stack.size () == n - 1); this.stack.add (node); } } } this.stack.clear (); } @Override public String toString () { final StringBuilder sb = new StringBuilder (); for (final Node node : this.contents) sb.append (node.toString ()); return sb.toString (); } } To use: final Example ex = new Example (); ex.add (new String[] {"H1", "H1", "H2", "H3", "H3", "H2", "H2", "H3", "H4", "H2", "H2", "H2", "H1", "H2", "H2", "H3", "H4", "H4", "H2"}); System.out.println (ex);
downvote count: 0
has comment: http://stackoverflow.com/comment/36924260
has comment: http://stackoverflow.com/comment/36924320

http://stackoverflow.com/comment/36992238
comment on: http://stackoverflow.com/q/24002429
type: Comment
type: QuestionComment
score: 2
has text: When working on algorithm, you should first write the algorithm in a piece of paper and then test it and measure its results. Only after designing the algorithm at its best, implement it.

http://stackoverflow.com/q/24013661
has answer: http://stackoverflow.com/a/24021859
score: 0
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37012636
type: Question
has comment: http://stackoverflow.com/comment/37012782
has comment: http://stackoverflow.com/comment/37012646
tagged with: arrays
has comment: http://stackoverflow.com/comment/37012332
has comment: http://stackoverflow.com/comment/37016634
has title: Creating multiple Object[][] arrays in bean or instantiating bean multiple times
has comment: http://stackoverflow.com/comment/37012527
accepted answer: http://stackoverflow.com/a/24021859
answer count: 1
tagged with: javabeans
favorite count: 0
has body: I have multiple functions in model which returns Object[][] arrays . I need to use a bean but don't know which strategy to apply .All these arrays are returning different data. Should I do it a way like this? public class VoiceMessagesBean { Object[][] inbox_messages; Object[][] accepted_messages; Object[][] rejected_messages; Object[][] response_yes; Object[][] response_no; Object[][] feedback_messages; Object[][] processed_messages; Object[][] saved_messages; public Object[][] getInbox_Messages() { return inbox_messages; } public void setInbox_Messages(Object[][] inbox_messages) { this.inbox_messages=inbox_messages; } public Object[][] getAccepted_Messages() { return accepted_messages; } public void setAccepted_Messages(Object[][] accepted_messages) { this.accepted_messages=accepted_messages; } public Object[][] getRejected_Messages() { return rejected_messages; } public void setRejected_Messages(Object[][] rejected_messages) { this.rejected_messages=rejected_messages; } public Object[][] getResponse_Yes() { return response_yes; } public void setResponse_Yes(Object[][] response_yes) { this.response_yes=response_yes; } public Object[][] getResponse_No() { return response_no; } public void setResponse_No(Object[][] response_no) { this.response_no=response_no; } public Object[][] getFeedback_Messages() { return feedback_messages; } public void setFeedback_Messages(Object[][] feedback_messages) { this.feedback_messages=feedback_messages; } public Object[][] getProcessed_Messages() { return processed_messages; } public void setProcessed_Messages(Object[][] processed_messages) { this.processed_messages=processed_messages; } public Object[][] getSaved_Messages() { return saved_messages; } public void setSaved_Messages(Object[][] saved_messages) { this.saved_messages=saved_messages; } } Or should I make multiple instances of a bean in the controller and make a single Object Array in the bean as shown below and use a single object[][] array every time a function is called.…
has comment: http://stackoverflow.com/comment/37012387
has comment: http://stackoverflow.com/comment/37012413
upvote count: 2
has comment: http://stackoverflow.com/comment/37012742
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37012500

http://stackoverflow.com/q/23949929
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36893301
has body: I have the following Utility class and method: public class KSoapUtility { public static KSoapObjectParseable parseObject (SoapObject soapObject, Class clazz) { KSoapObjectParseable obj = null; try { obj = (KSoapObjectParseable)clazz.newInstance(); } catch (Exception e) { e.printStackTrace(); } if (obj != null) { String[] propertyNames = obj.getPropertyNames(); for (String propertyName: propertyNames) { obj.setProperty(propertyName, soapObject.getPropertyAsString(propertyName)); } } return obj; } } I then call this method as follows: Instruction instruction = (Instruction)KSoapUtility.parseObject(instructionSoapObject, Instruction.class); Note that my "Instruction" class implements an interface called "KSoapObjectParseable". It works fine, but in my Utility class Eclipse warns: Class is a raw type. References to generic type Class should be parameterized Correctly so, however, if I parameterize the method argument as follows: Class&lt;KSoapObjectParseable&gt; clazz Then the following call wont compile: Instruction instruction = (Instruction)KSoapUtility.parseObject(instructionSoapObject, Instruction.class); giving the error: The method parseObject(SoapObject, Class&lt;KSoapObjectParseable&gt;) in the type KSoapUtility is not applicable for the arguments (SoapObject, Class&lt;Instruction&gt;) So my question is, how do you parameterize my method argument and still be able to call it by passing in "MyClass,class" that implements KSoapObjectParseable ?
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/23950005
upvote count: 2
has title: How do I parameterize my Class parameter in this case?
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/36893448
accepted answer: http://stackoverflow.com/a/23950005
type: Question
has comment: http://stackoverflow.com/comment/36893496
has comment: http://stackoverflow.com/comment/36894144

http://stackoverflow.com/comment/37165709
type: Comment
has text: What I want is to leave the java code in the servlet class. I can do print in jsp, but parsing should be done within AddServlet class. If I could somehow pass the attributes to jsp via eg. "${result} it would be great, but "out.print" is also ok...
comment on: http://stackoverflow.com/a/24095757
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37069470
comment on: http://stackoverflow.com/a/24043671
score: 0
type: AnswerComment
type: Comment
has text: If you add the new certificate to the default cacerts you would not require the vm argument, but I highly recommend against that strategy. If you add that certificate to your base cacerts, then all java applications running on your machine will trust that new certificate. Which might not be too harmful, but it just isn't super secure. Also, when you update your version of java you will have to remember to reinstall that certificate again. But then again, when you update your version of java, you should re-copy the cacerts and re-import the certificat anyways.

http://stackoverflow.com/q/24062077
type: Question
has comment: http://stackoverflow.com/comment/37150599
linked to: http://stackoverflow.com/q/3759590
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/37117850
favorite count: 0
has comment: http://stackoverflow.com/comment/37102456
has comment: http://stackoverflow.com/comment/37120153
upvote count: 4
has body: I found ways to set UUID in java,ios but can't find a way to setUUID in GWT api (com.pubnub.gwt.api.client.Pubnub)
tagged with: gwt
score: 2
type: AnsweredQuestion
tagged with: pubnub
has answer: http://stackoverflow.com/a/24293696
tagged with: java
accepted answer: http://stackoverflow.com/a/24293696
has comment: http://stackoverflow.com/comment/37127248
has title: How to set UUID in PubNub GWT api?

http://stackoverflow.com/comment/37024061
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23981128
has text: but why defaultservlet is pointed from tomcat/conf/web.xml ? This the web.xml that is directing what to do. So my question is, ideally this web.xml has to be in ROOT/WEB-INF folder.
type: AnswerComment

http://stackoverflow.com/comment/36934524
comment on: http://stackoverflow.com/a/23967567
type: Comment
has text: where is Catalina.Servlets.Defaultservlet class located? Which jar file or directory?
score: 0
type: AnswerComment

http://stackoverflow.com/a/57083446
has body: Here is a general function to get the nth DAY_OF_WEEK of a given month. You can use it to get the first Monday of any given month. import java.util.Calendar; public class NthDayOfWeekOfMonth { public static void main(String[] args) { // get first Monday of July 2019 Calendar cal = getNthDayOfWeekOfMonth(2019,Calendar.JULY,1,Calendar.MONDAY); System.out.println(cal.getTime()); // get first Monday of August 2019 cal = getNthDayOfWeekOfMonth(2019,Calendar.AUGUST,1,Calendar.MONDAY); System.out.println(cal.getTime()); // get third Friday of September 2019 cal = getNthDayOfWeekOfMonth(2019,Calendar.SEPTEMBER,3,Calendar.FRIDAY); System.out.println(cal.getTime()); } public static Calendar getNthDayOfWeekOfMonth(int year, int month, int n, int dayOfWeek) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE,0); cal.set(Calendar.SECOND,0); cal.set(Calendar.YEAR,year); cal.set(Calendar.MONTH,month); cal.set(Calendar.DAY_OF_MONTH,1); int dayDiff = dayOfWeek-cal.get(Calendar.DAY_OF_WEEK); if (dayDiff&lt;0) { dayDiff+=7; } dayDiff+=7*(n-1); cal.add(Calendar.DATE, dayDiff); return cal; } } Output: Mon Jul 01 00:00:00 EDT 2019 Mon Aug 05 00:00:00 EDT 2019 Fri Sep 20 00:00:00 EDT 2019
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23971439
upvote count: 1

http://stackoverflow.com/q/24055653
accepted answer: http://stackoverflow.com/a/24055806
type: Question
has body: I am working to send SMS using java program. The AT command is supping as a string. But the string format should be like AT+CMGS="+33146290800"<CR>Please call me soon.<ctrl-Z>. I have to create string with the Carriage Return and CTRL-Z character. If I add 0x0D and 0x1A with the string. output: AT+CMGS="+33146290800"13Please call me soon.26 How can I achieve the task? Can anyone help me to find a way out.
upvote count: 4
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37090960
has comment: http://stackoverflow.com/comment/60263388
has comment: http://stackoverflow.com/comment/37090711
has answer: http://stackoverflow.com/a/24055806
has comment: http://stackoverflow.com/comment/37091825
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37091719
has title: Adding Carriage Return <CR> and CTRL-Z to a String in java
tagged with: java
has comment: http://stackoverflow.com/comment/37091167
downvote count: 2

http://stackoverflow.com/comment/36927221
has text: @BoristheSpider from my reading he wants to capture the digits, since he has parenthesis around the `\\d`...
type: AnswerComment
comment on: http://stackoverflow.com/a/23968034
type: Comment
score: 0

http://stackoverflow.com/comment/37095223
has text: is it better than my current way?
comment on: http://stackoverflow.com/a/24058219
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36919595
score: 1
type: Comment
type: QuestionComment
has text: Are you saying you aren't allowed to use `org.junit.Assert.assertTrue` anymore?
comment on: http://stackoverflow.com/q/23963155

http://stackoverflow.com/a/26485438
has body: After upgrading to yosemite, java 6 jdk is no longer available, remember that jdk 6 for mac osx is a 32-bit application, older eclipse releases needs a 32-bit jvm in order to run properly, a 32-bit application cannot run with a 64-bit jvm like java 7 or 8, so you need to install jdk 6 to run those java applications that needs a 32 bit virtual machine. As already posted here you can download jdk 6 from http://support.apple.com/kb/DL1572?viewlocale=en_US&amp;locale=en_US
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24023956

http://stackoverflow.com/comment/36885102
comment on: http://stackoverflow.com/a/23945194
type: AnswerComment
has text: Who cares? It's a type or block marker of some kind provided by ObjectOutputStream, and it is filtered out when you read by ObjectInputStream. It's not the source of the problem. The source of the problem is assuming that read() fills the buffer. It isn't specified to do that; it didn't do that; and the program failed as a result.
type: Comment
score: 0

http://stackoverflow.com/comment/36943700
comment on: http://stackoverflow.com/a/23977011
has text: I have only one copy of class in the folder and I recompiled the java code which modifies the class..I don't understand how could the server still gets the previous class?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23951020
has comment: http://stackoverflow.com/comment/36895291
has answer: http://stackoverflow.com/a/23951292
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76653175
tagged with: java
possible better answer: http://stackoverflow.com/a/23951292
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23951114
downvote count: 0
tagged with: swap
tagged with: string
score: 4
has body: I am aware of overflow, performance drops, etc but I need to swap two String values without any temporary variable. I know what cons are and found some effective methods but cannot understand one of them. String a = "abc"; String b = "def"; b = a + (a = b).substring(0, 0); System.out.printf("A: %s, B: %s", a, b); Output shows it clear values are swapped. When I look at this seems something related with priority operations but I cannot figure it out in my mind. Please, could someone explain to me what happens?
has answer: http://stackoverflow.com/a/45962716
has comment: http://stackoverflow.com/comment/36896924
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/23951114
has comment: http://stackoverflow.com/comment/36900555
has title: Swap String values without temporary variable

http://stackoverflow.com/q/24085942
tagged with: extract
has answer: http://stackoverflow.com/a/24086848
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37146649
has body: I have been trying to good java to extract a few zip files in my program and place them in their correct directories. I have been looking off of this for reference : http://javabeginnerstutorial.com/code-base/how-to-extract-zip-file-with-subdirectories/ My current code looks like String ziplocation = "/home/user/folder/"; String zipfile = "libraries.zip"; String liblocation = "/home/user/folder"; ZipEntry zipentry; if (!zipentry.isDirectory()) { File fileFile = new File(liblocation + "/" + zipentry.getName()); InputStream inputstream = zipfile.getInputStream(zipentry); String str = new java.util.Scanner(inputstream).useDelimiter("/A").next(); BufferedWriter bw = new BufferedWriter(new FileWriter(fileFile)); bw.append(str); bw.close(); } Everything seems to be correctly adapted from that above reference but when I compile it gives me : Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method getInputStream(ZipEntry) is undefined for the type String at Main.main(Main.java:53) EDIT: I have now changed it to String ziplocation = "/home/user/folder/zipfile.zip"; String liblocation = "/home/user/folder/"; File file = new File(ziplocation); ZipFile zipfile = new ZipFile(file); InputStream inputStream = new BufferedReader(new FileReader(zipfile)); ZipEntry zipentry; if (!zipentry.isDirectory()) { File fileFile = new File(liblocation + "/" + zipentry.getName()); InputStream inputstream = zipfile.getInputStream(zipentry); String str = new java.util.Scanner(inputstream).useDelimiter("/A").next(); BufferedWriter bw = new BufferedWriter(new FileWriter(fileFile)); bw.append(str); bw.close(); } But now the compiler is responding with: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Type mismatch: cannot convert from BufferedReader to InputStream The constructor FileReader(ZipFile) is undefined at Main.main(Main.java:48)
tagged with: subdirectory
has title: Problems extracting Zip in Java
score: 0
has answer: http://stackoverflow.com/a/24087521
has comment: http://stackoverflow.com/comment/37146769
tagged with: http://stackoverflow.com/tag/zip

http://stackoverflow.com/q/23951145
downvote count: 1
has answer: http://stackoverflow.com/a/39996233
favorite count: 0
has comment: http://stackoverflow.com/comment/36895362
has body: I am facing exception Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object while running the code below. I checked online for help. Some sites say that I need to register my dll. I tried registering using regsvr32.exe. But I am unable to register successfully. Getting below popup. The module "jacob-1.18-M2-x64.dll" was loaded but the entry-point DllRegisterServer was not found.Make sure that "jacob-1.18-M2-x64.dll" is a valid DLL or OCX file and then try again.
type: UnansweredQuestion
tagged with: jacob
tagged with: imacros
has comment: http://stackoverflow.com/comment/36896125
tagged with: java
type: Question
has title: Jacob: com.jacob.com.ComFailException: Can't co-create object
upvote count: 1
has answer: http://stackoverflow.com/a/23953192
score: 0
has answer: http://stackoverflow.com/a/59153417
answer count: 3

http://stackoverflow.com/comment/140252746
score: 1
type: AnswerComment
has text: This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/36779515)
type: Comment
comment on: http://stackoverflow.com/a/79524418

http://stackoverflow.com/q/24093746
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/24094087
has body: I have a problem about uploading images from android to a server, the problem is about the android version, my application can run on android version 2.3 but can not run on version > 2.3. these is my code function TambahLokasi() { $base = $_REQUEST["gambar"]; if (isset($base)){ $suffix = createRandomID(); $image_name = "img_".$suffix."_".date("Y-m-d-H-m-s").".jpg"; $binary = base64_decode($base); header("Content-Type: bitmap; charset=utf-8"); $file = fopen("gambar/" . $image_name, "wb"); fwrite($file, $binary); fclose($file); $username = $_POST['USERNAME']; $loc_name = $_POST['LOCATION_NAME']; $category = $_POST['CATEGORY']; $address = $_POST['ADDRESS']; $city = $_POST['CITY']; $descript = $_POST['DESCRIPTION']; $own = $_POST['OWNER']; $lat = $_POST['lat']; $lng = $_POST['lng']; $query = "insert into location (USERNAME,LOCATION_NAME,CATEGORY,ADDRESS,CITY,DESCRIPTION,OWNER,lat,lng,gambar)values ('$username', '$loc_name', '$category', '$address','$city','$descript','$own','$lat','$lng','$image_name')"; //$query = "insert into pasien values ('','n', 'n', 'n', 'n','bar','','','n','n','n')"; $hasil = mysql_query($query); if($hasil) { $respon["success"] = "1"; $respon["pesan"] = "Data berhasil diinput"; echo json_encode($respon); } else { $respon["success"] = "0"; $respon["pesan"] = "Data gagal diinput. Mohon cek kembali."; echo json_encode($respon); die($image_name); } }else { die("No POST"); } } function createRandomID() { $chars = "abcdefghijkmnopqrstuvwxyz0123456789?"; //srand((double) microtime() * 1000000); $i = 0; $pass = ""; while ($i &lt;= 5) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } and this is java code package com.adi.lib; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import o…
score: -4
linked to: http://stackoverflow.com/q/9963691
tagged with: php
has comment: http://stackoverflow.com/comment/37161796
type: AnsweredQuestion
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24094087
type: Question
downvote count: 4
upvote count: 0
answer count: 1
has title: How to upload image Android to Server using PHP mysql
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/37159891
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24066426
type: AnswerComment
has text: I solved the previous error with procedure mentioned [here](http://stackoverflow.com/q/13509113/1505348) and [here](http://stackoverflow.com/q/2169294/1505348).

http://stackoverflow.com/a/23963366
answers question: http://stackoverflow.com/q/23963159
type: Answer
score: 1
has body: Use the read method with an array of bytes. It returns the number of bytes read from the array which isnt always the same length as your array so its important you store that number. InputStream input = new FileInputStream("c:\\data\\input-file.txt"); int numRead; byte [] bytes = new byte[512]; while((numRead = input.read(bytes)) != -1){ String bytesAsString = new String(bytes, 0, numRead); }
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/37051843
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24034817
has text: my main activity is a SlidingFragmentActivity in that i'm calling a fragment tab and in side that i'm calling this map fragment
score: 0

http://stackoverflow.com/q/24061803
has body: I have several namespaces and I'd like to copy data from one namespace to another with objectify. This question is to some extend similar to How to copy datastore entities between namespaces. I'd like to implement this feature with objectify if possible.
has comment: http://stackoverflow.com/comment/37106207
tagged with: google-cloud-datastore
has comment: http://stackoverflow.com/comment/37103565
has comment: http://stackoverflow.com/comment/37153471
has comment: http://stackoverflow.com/comment/37105334
tagged with: objectify
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/37128674
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37115648
type: Question
has comment: http://stackoverflow.com/comment/37128593
has title: Copy datastore entries between namespaces with objectify
linked to: http://stackoverflow.com/q/4211605
score: 0

http://stackoverflow.com/comment/37175123
type: QuestionComment
comment on: http://stackoverflow.com/q/24092097
has text: No, I'd like for add to be parsed and then eq such that I can store all `add`s as a single opcode and have a separate field which specifies the condition code (`eq`)
score: 1
type: Comment

http://stackoverflow.com/q/24076098
has comment: http://stackoverflow.com/comment/37128417
has comment: http://stackoverflow.com/comment/37128543
has comment: http://stackoverflow.com/comment/37128351
type: AnsweredQuestion
downvote count: 2
possible better answer: http://stackoverflow.com/a/24076251
has comment: http://stackoverflow.com/comment/37128322
upvote count: 1
has comment: http://stackoverflow.com/comment/37128435
has answer: http://stackoverflow.com/a/24076251
has comment: http://stackoverflow.com/comment/37128378
type: Question
has comment: http://stackoverflow.com/comment/37128286
tagged with: java
has comment: http://stackoverflow.com/comment/37128308
score: -1
answer count: 6
has answer: http://stackoverflow.com/a/24076310
has title: java hello world compliation error
has answer: http://stackoverflow.com/a/24076262
has answer: http://stackoverflow.com/a/24076300
has comment: http://stackoverflow.com/comment/37128400
has comment: http://stackoverflow.com/comment/37128354
has answer: http://stackoverflow.com/a/24076256
favorite count: 0
has answer: http://stackoverflow.com/a/24076292
has body: Under eclipse, Java 7 I cannot get the following to work: import java.io.Console; package com.company; public class main { public static void main(String[] args) { System.out.println("Hello, World"); } } It's surprising, I've been toying around with java for a while, going back to the hello world I'd skipped I never thought it would be my hardest task yet. I get: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at main.main(main.java:10) EDIT: So I've gotten it to run like so: import Fibonacci; public class main { private Fibonacci f; public static void main(String[] args) { // System.out.println("Hello, World") f= new Fibonacci(); System.out.println(Fibonacci.compute(f), 5); } } how do I print fibonacci's fifth element.
has comment: http://stackoverflow.com/comment/37128382
accepted answer: http://stackoverflow.com/a/24076310

http://stackoverflow.com/comment/37007745
type: Comment
comment on: http://stackoverflow.com/a/24009697
type: AnswerComment
has text: `org.eclipse.core.resources.path` matches the result of `IResource.getFullPath()` which will be something like '/project/folder/file'
score: 0

http://stackoverflow.com/comment/37063410
has text: *Is it possible using PDFBox to change the tag value* - most likely it is because PDFBox allows a low-level access to the PDF objects. That been said, though, remember that if there is an associated **FontDescriptor**. the **FontName** entry therein must likewise be adapted.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24040161

http://stackoverflow.com/q/23962438
has comment: http://stackoverflow.com/comment/36917198
type: Question
tagged with: jakarta-ee
has body: I have no idea what is the problem and how to solve this. I have Articles and Images which are mapped many to many. @Entity @Table(name="Article") public class Article { @Id @GeneratedValue private int articleId; private String createDate; private int state; @ManyToMany(cascade = CascadeType.ALL, mappedBy="articles") private Set&lt;Image&gt; images = new HashSet&lt;Image&gt;(); //setters and getters } And @Entity @Table(name="Image") public class Image { @Id @GeneratedValue private int imageId; private String imagePath; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "ArticleImage", joinColumns = { @JoinColumn(name = "articleId") }, inverseJoinColumns = { @JoinColumn(name = "imageId") }) private Set&lt;Article&gt; articles = new HashSet&lt;Article&gt;(); //setters and getters } These are my 2 tables mapped. I also have a table in database: ArticleImage with articleId and imageId. In my controller when I create my article object and image object I can save them without problem but if I try to set the image in article I get an error: org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into ArticleImage (articleId, imageId) values (?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update Caused by: java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`appdatabase`.`articleimage`, CONSTRAINT `fk_ArticleImage_Article1` FOREIGN KEY (`articleId`) REFERENCES `article` (`articleId`) ON DELETE NO ACTION ON UPDATE NO ACTION) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`appdatabase`.`articleimage`, CONSTRAINT `fk_ArticleImage_Article1` FOREIGN KEY (`articleId`) REFERENCES `article` (`arti…
score: 1
accepted answer: http://stackoverflow.com/a/23963079
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36917236
has comment: http://stackoverflow.com/comment/36916998
has title: Hibernate many to many Cannot add or update a child row: a foreign key constraint fails
upvote count: 1
has comment: http://stackoverflow.com/comment/36917223
has answer: http://stackoverflow.com/a/23963079
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36917059
has comment: http://stackoverflow.com/comment/36917071
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36917494

http://stackoverflow.com/q/23970199
has comment: http://stackoverflow.com/comment/36931434
has comment: http://stackoverflow.com/comment/36931395
has comment: http://stackoverflow.com/comment/36931532
has comment: http://stackoverflow.com/comment/36931111
has comment: http://stackoverflow.com/comment/36931556
answer count: 1
has comment: http://stackoverflow.com/comment/36931153
has comment: http://stackoverflow.com/comment/36931431
has comment: http://stackoverflow.com/comment/37513099
score: 0
has comment: http://stackoverflow.com/comment/36931488
has comment: http://stackoverflow.com/comment/36931375
tagged with: android
has comment: http://stackoverflow.com/comment/36931432
has comment: http://stackoverflow.com/comment/36931339
has comment: http://stackoverflow.com/comment/36931565
has comment: http://stackoverflow.com/comment/36931044
has title: Android Runtime Error in App
has comment: http://stackoverflow.com/comment/36931453
has comment: http://stackoverflow.com/comment/36931290
has comment: http://stackoverflow.com/comment/36931200
has comment: http://stackoverflow.com/comment/36931277
has comment: http://stackoverflow.com/comment/36931426
has comment: http://stackoverflow.com/comment/36931313
type: AnsweredQuestion
has body: So i am trying to fetch live cricket score,but i am getting the following error in my startup file. Can someone help me please 05-31 08:35:56.833: D/AndroidRuntime(1089): Shutting down VM 05-31 08:35:56.833: W/dalvikvm(1089): threadid=1: thread exiting with uncaught exception (group=0x414c4700) 05-31 08:35:56.843: E/AndroidRuntime(1089): FATAL EXCEPTION: main 05-31 08:35:56.843: E/AndroidRuntime(1089): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cricketscores/com.example.cricketscores.Launching}: java.lang.NullPointerException 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.app.ActivityThread.access$600(ActivityThread.java:141) 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.os.Handler.dispatchMessage(Handler.java:99) 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.os.Looper.loop(Looper.java:137) 05-31 08:35:56.843: E/AndroidRuntime(1089): at android.app.ActivityThread.main(ActivityThread.java:5103) 05-31 08:35:56.843: E/AndroidRuntime(1089): at java.lang.reflect.Method.invokeNative(Native Method) 05-31 08:35:56.843: E/AndroidRuntime(1089): at java.lang.reflect.Method.invoke(Method.java:525) 05-31 08:35:56.843: E/AndroidRuntime(1089): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 05-31 08:35:56.843: E/AndroidRuntime(1089): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 05-31 08:35:56.843: E/AndroidRuntime(1089): at dalvik.system.NativeStart.main(Native Method) 05-31 08:35:56.843: E/AndroidRuntime(1089): Caused by: java.lang.NullPointerException 05-31 08:35:56.843: E/AndroidRuntime(1089): at com.example.cri…
has comment: http://stackoverflow.com/comment/36931033
tagged with: java
has answer: http://stackoverflow.com/a/23970470
accepted answer: http://stackoverflow.com/a/23970470
has comment: http://stackoverflow.com/comment/36931505
has comment: http://stackoverflow.com/comment/36931039
type: Question
has comment: http://stackoverflow.com/comment/36931234
has comment: http://stackoverflow.com/comment/36931147

project
tags question: http://stackoverflow.com/q/24033863
type: Tag
tags question: http://stackoverflow.com/q/24102020
tag name: project

http://stackoverflow.com/a/23975900
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36959172
has body: Try this: /user/Gauravgandhi/Documents/workspace/Applico/Website for file system path and just pass pom.xml under Root Pom text box and define goals for the same. I am hoping you configure JDK and Maven at jenkins level under configure jenkins link. Please let me know if it works or not.
answers question: http://stackoverflow.com/q/23975272
has comment: http://stackoverflow.com/comment/36959052

http://stackoverflow.com/a/23999450
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23999326
answers question: http://stackoverflow.com/q/23999326
type: AcceptedAnswer
downvote count: 0
has body: You can use CDI in jUnit test. Check this: http://jglue.org/cdi-unit/
has comment: http://stackoverflow.com/comment/37005644

http://stackoverflow.com/q/23989271
has comment: http://stackoverflow.com/comment/36982908
has comment: http://stackoverflow.com/comment/36983468
answer count: 1
downvote count: 1
tagged with: reflection
tagged with: java
has title: Change the value of the fields of an object, that are int, with java Reflection
has comment: http://stackoverflow.com/comment/36966761
has comment: http://stackoverflow.com/comment/36991589
has comment: http://stackoverflow.com/comment/36991723
has comment: http://stackoverflow.com/comment/36982079
has answer: http://stackoverflow.com/a/23989759
upvote count: 0
has comment: http://stackoverflow.com/comment/36991881
has body: I have a table with 3 fields, name = varchar, number1 = int, number2 = int Below I can modify a single field at a time. How could I change all fields of type int for a single time? public static void change(Object t) throws IllegalArgumentException, IllegalAccessException { Class c = t.getClass(); Field f = t.getDeclaredFields()[0]; f.set(o, "name2"); int a = f.getModifiers(); System.out.println(Modifier.isVolatile(a)); Field f2 = t.getDeclaredFields()[1]; f2.setInt(t, 10); int a2 = f2.getModifiers(); System.out.println(Modifier.isVolatile(a2)); } The step that I like to follow is to check whether the field is int, and then assign the value 10 fixed them all. Whit java reflect. to get the second and third field automatically, I try this public static void sta(Object t) throws IllegalArgumentException, IllegalAccessException { Class&lt;?&gt; c = t.getClass(); for (Field f : t.getDeclaredFields()) { if (f.getType() == int.class) { f.setAccessible(true); f.set(t, 10); } } test.java public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException { Object t = new Object("Name1", 777, 777); teste2.sta(t); System.out.println(t.number1); }} Object.java public class Object { String name; int number1; int number2; public Object(String name, int number1, int number2){ this.name=name; this.numeber1=number1; this.number2=number2 ; } public String getName(){ return name; } public int getNumber1(){ return number1; } public int getNumber2(){ return number2; } } the error is Exception in thread "main" java.lang.IllegalArgumentException: Can not set java.lang.String field Object.name to java.lang.Integer at un.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.U…
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36992010
has comment: http://stackoverflow.com/comment/36983158
has comment: http://stackoverflow.com/comment/36982435
accepted answer: http://stackoverflow.com/a/23989759
favorite count: 0
score: -1

http://stackoverflow.com/q/24022891
answer count: 2
tagged with: macos
has comment: http://stackoverflow.com/comment/37034075
type: UnansweredQuestion
has title: Why am I getting a file not found error in java using OSX, but not Windows?
has comment: http://stackoverflow.com/comment/37029905
tagged with: java
has comment: http://stackoverflow.com/comment/37029996
has answer: http://stackoverflow.com/a/24046249
has body: I'm a java n00b, so please excuse any ignorance. I'm trying to run a TestNG test in IntelliJ on OSX, but when I do, I get the following file not found error: File: src/test/resources/manager/MemberTest/testCreating.csv not found. However, when my colleagues run this on their Windows machines, the test completes and they do not get the same error. One such colleague's file was located at D:\trunk_QA\src\test\resources\manager\MemberTest\testCreating.csv Mine is located at /Users/username/QA Materials/Automation/Framework/trunk_QA/src/test/resources/manager/MemberTest/testCreating.csv The dataSourcePath seems to be correctly laid out as a relative path: private static String dataSourcePath = "src/test/resources/"; And when run with that dataSourcePath, I get the error. If I update it to use my local absolute path: private static String dataSourcePath = "/Users/username/QA Materials/Automation/Framework/trunk_QA/src/test/resources/"; The test then passes. However, I can't check this in because outside of being a poor practice to use absolute links, it will break the test on my coworkers' machines. What am I doing wrong? Do I need to define a system variable such as CLASSPATH?
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/24023228
has comment: http://stackoverflow.com/comment/37029663
score: 0

http://stackoverflow.com/comment/114840689
has text: This answer underlooks the capabilities of sublime text.
comment on: http://stackoverflow.com/a/24085315
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36906606
type: Comment
comment on: http://stackoverflow.com/a/23955942
score: 0
has text: Thank a lot. This Code is Solved My Problem. and with thank others
type: AnswerComment

http://stackoverflow.com/q/24025199
tagged with: android
tagged with: android-activity
answer count: 4
has answer: http://stackoverflow.com/a/24027018
has answer: http://stackoverflow.com/a/24025289
type: UnansweredQuestion
tagged with: audio
tagged with: java
has body: How can I play sound from a class that DOES NOT extend activity? I've been searching for a while and in every tutorial or answers from stackoverflow I've seen that sounds are always implemented in an activity class. But in this case I have a class thas has the logic of my game, in which I have a gameUpdate() function; and in that function I want to make a specific sound play if something happens (for example a collision). How can I possibly access the activity that is currently running, from this class? Is there any way to do that? Thanks.
has title: How to play android sounds NOT in activity class
linked to: http://stackoverflow.com/q/9656853
has comment: http://stackoverflow.com/comment/37034423
type: Question
has answer: http://stackoverflow.com/a/24026965
has comment: http://stackoverflow.com/comment/37034755
score: 0
has answer: http://stackoverflow.com/a/24025320

http://stackoverflow.com/comment/37141720
type: Comment
has text: @Boann It works, but I am disappointed that there is not more elegant way.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24083215

http://stackoverflow.com/q/24048668
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37078833
has body: I am writing an IRC Client. The socket connection to the IRC Server is handled via a service. I have managed to stabilize all the UI elements of the Activities in question during the orientation change, but somehow the socket that is maintained by the service is being closed during the change. Here is what I believe to be the relevant code. Please let me know if you need to see more. //This is the Service in question public class ConnectionService extends Service{ private BlockingQueue&lt;String&gt; MessageQueue; public final IBinder myBind = new ConnectionBinder(); public class ConnectionBinder extends Binder { ConnectionService getService() { return ConnectionService.this; } } private Socket socket; private BufferedWriter writer; private BufferedReader reader; private IRCServer server; private WifiManager.WifiLock wLock; private Thread readThread = new Thread(new Runnable() { @Override public void run() { try { String line; while ((line = reader.readLine( )) != null) { if (line.toUpperCase().startsWith("PING ")) { SendMessage("PONG " + line.substring(5)); } else queueMessage(line); } } catch (Exception e) {} } }); @Override public int onStartCommand(Intent intent, int flags, int startId) { if(MessageQueue == null) MessageQueue = new LinkedBlockingQueue&lt;String&gt;(); return Service.START_STICKY; } @Override public IBinder onBind(Intent arg0) { return myBind; } @Override public boolean stopService(Intent name) { try { socket.close(); wLock.release(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return super.stopService(name); } @Override public void onDestroy() {//I put this here so I had a breakpoint in place to make sure this wasn't firing instead of stopService try { socket.close(); wLock.release(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } super.onDestroy(); } public void SendMessage(String message) { try { writer.write(message + "\r\n"); writer.flush(); } catch (IOException e) {…
tagged with: android
answer count: 1
has title: Service Socket Disconnect on Background->Foreground switch
tagged with: service
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24049666
tagged with: sockets
has comment: http://stackoverflow.com/comment/37250910
upvote count: 1
has comment: http://stackoverflow.com/comment/37228458
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37078781

http://stackoverflow.com/comment/37026582
type: QuestionComment
has text: @Rasmase - Roger that. Did you try cleaning your project and rebuilding it? Code and XML all look fine
score: 0
comment on: http://stackoverflow.com/q/24021126
type: Comment

http://stackoverflow.com/q/24022303
has answer: http://stackoverflow.com/a/24191133
type: UnansweredQuestion
has body: I was trying to use MuPDF library to open pdf files in my application. I've followed the steps to integrate Mupdf with my project, and it works on my app to display file structure and let me choose pdf files. But when I click a pdf file, it opens a blank screen. It doesn't throw any errors. The MuPDF app I downloaded from the Play market works fine and can render the pdf file normally. I followed steps in this thread: Integrate MuPDF Reader in an app i put this part in my activity class file in the hope it would transfer data to the screen: To open pdf with pre-fix file: Uri uri = Uri.parse("path to pdf file"); Intent intent = new Intent(context, MuPDFActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(uri); context.startActivity(intent); Any suggestions on what might went wrong or missing? Any input will be largely appreciated. UPDATE: i found out that, as the comment mentioned, mupdf was not started by any class. so i changed my code to trigger that class in the choosePDFActivity.java: @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); mPositions.put(mDirectory.getAbsolutePath(), getListView().getFirstVisiblePosition()); if (position &lt; (mParent == null ? 0 : 1)) { mDirectory = mParent; mHandler.post(mUpdateFiles); return; } position -= (mParent == null ? 0 : 1); if (position &lt; mDirs.length) { mDirectory = mDirs[position]; mHandler.post(mUpdateFiles); return; } position -= mDirs.length; Uri uri = Uri.parse(mFiles[position].getAbsolutePath()); Intent intent = new Intent(this,MuPDFActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(uri); startActivity(intent); } Now it opens Mupdf but got some errors: 06-12 10:31:51.875: W/dalvikvm(6551): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Ltys/app/test/MuPDFCore; now when i click a pdf file it pops up an error messange. This is getting somewhere. Please help!
has comment: http://stackoverflow.com/comment/37069534
upvote count: 1
linked to: http://stackoverflow.com/q/8500530
tagged with: mupdf
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37076724
type: Question
has title: MuPDF renders empty pdf file in Android app
has comment: http://stackoverflow.com/comment/37343433
tagged with: layout
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37334698
linked to: http://stackoverflow.com/q/24183472
tagged with: android
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/37068505
favorite count: 0

http://stackoverflow.com/comment/36948857
has text: ok, So annotation is out of the question. Since I'm using 3rd party framework(light-admin) for adding and removing object's to table, I would like another option for generating keys for those objects with my own strategy.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23978371
score: 0

http://stackoverflow.com/q/23959367
tagged with: java
tagged with: javafx
has title: Passing a parameter to JavaFx
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23959853
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23959569
has answer: http://stackoverflow.com/a/23959569
has body: I am trying to build a simple image viewer with JavaFx which would work similar to this: Viewer viewer = new Viewer("path/to/file.jpg"); I've tried something along the lines of the code below, but it does not work. public class Viewer extends Application { private String filePath; public Viewer(String filePath) { this.filePath = filePath; } @Override public void start(Stage stage) { // load the image Image image = new Image("file:" + this.filePath); // simple displays ImageView the image as is ImageView iv1 = new ImageView(); iv1.setImage(image); Group root = new Group(); Scene scene = new Scene(root); HBox box = new HBox(); box.getChildren().add(iv1); root.getChildren().add(box); stage.setTitle(this.filePath); stage.setWidth(415); stage.setHeight(200); stage.setScene(scene); stage.sizeToScene(); stage.show(); } } Is there a standard way of passing parameters to a JavaFx application?
accepted answer: http://stackoverflow.com/a/23959853
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36911011
score: 1

http://stackoverflow.com/q/23978767
has body: I have a JTable with some data and the columns are as follows: Market - String Currency - String Volume - Double High - Double Low - Double I have a text field for each and when you click a button it should filter the table. I have it working with the Market and Currency Strings using: RowFilter.regexFilter(txtMarket.getText(), 0); RowFilter.regexFilter(txtCurrency.getText(), 1); I want to use something similar to filter a greater than or less than for volume, high and low. Is this possible or should I try something else? Sorry this is my first time asking a question I apologize for any missing information or formatting issues.
answer count: 2
has answer: http://stackoverflow.com/a/23998959
has comment: http://stackoverflow.com/comment/36948334
tagged with: rowfilter
has comment: http://stackoverflow.com/comment/36946708
type: Question
tagged with: double
tagged with: swing
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/45145625
has comment: http://stackoverflow.com/comment/36947097
linked to: http://stackoverflow.com/q/17854854
has title: Can I use RowFilter with a JTable to filter greater than or less than a column with type double?
type: UnansweredQuestion
tagged with: jtable

http://stackoverflow.com/q/23961629
upvote count: 1
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/23961912
answer count: 1
favorite count: 0
has body: Why does the light weight java game library use a lot of static references. I have been starting to learn LWJGL and i seem that LWGJL wants a lot of your variable and stuff to be static. I there a way around that and if not, what is the benefit of using a lot of static.
tagged with: static
has title: Light Weight Java Game Librayry, lots of static
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23961912
tagged with: java
tagged with: lwjgl
downvote count: 2

http://stackoverflow.com/comment/37135394
has text: is it a must to have a method with return type void , make a global variable and store the returning value in it , not advisable though
score: 0
comment on: http://stackoverflow.com/q/24079961
type: Comment
type: QuestionComment

initial-context
tags question: http://stackoverflow.com/q/24080004
tag name: initial-context
type: Tag

http://stackoverflow.com/comment/36978296
comment on: http://stackoverflow.com/q/23995566
type: QuestionComment
type: Comment
score: 1
has text: You could change the alignment of the buttons and labels to right and left respectively, that would bring them closer. Also, I suggest your use a different instance of `GridBagConstraints` for each component.

http://stackoverflow.com/q/24090390
has answer: http://stackoverflow.com/a/24090607
tagged with: variables
favorite count: 0
has answer: http://stackoverflow.com/a/24090570
tagged with: char
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37158695
has comment: http://stackoverflow.com/comment/37158712
answer count: 4
has body: Okay, so I have a text file that is essentially a course description. Physics Applied SPH4C 2014 Description: Physics = course name Applied = course level SPH4C = course code 2014 = academic year So, I have already tokenized this info so that each field is on a separate line like: Physics Applied SPH4C 2014 Now, I want to convert each line into a different type since my Course class accepts different types. Like this: public Course(String name, String code, char level, int academicYear) How do I convert the string level that I get from the text file into a char private void convertLevel(String courseLevel) { level = DEFAULT_LEVEL; if(level == "IB") level = "7"; if(level == "Academic")level = "1"; if(level == "Applied") level = "1"; if(level == "ELL") level = "9"; if(level == "Special Education") level = "8"; } // end of method convertLevel(String courseLevel) this is what I have, but it basically just changes the string, which wont allow me to enter it as a level since the course only accepts a char as a level, or am I wrong. Also, I need help with the academic level as well Also, how would I assign each line to a variable Here is the hashtable //This allows you to define your list with string keys instead of //using a bunch of ifs. Hashtable&lt;String, char&gt; CourseLevels = new Hashtable&lt;String, char&gt;() { put("IB", '7'), put("Academic", '1'), put("Applied", '1'), put("ELL", '9'), put("Special Education", '8') }; but the compiler is telling me that a return type is required at the first put statement, any ways yo solve this Here is the edited version private char convertLevel(String courseLevel) { //This allows you to define your list with string keys instead of //using a bunch of ifs. Hashtable&lt;String, Object&gt; courseLevels = new Hashtable&lt;String, Object&gt;(); { courseLevels.put("IB", '7'); courseLevels.put("Academic", '1'); courseLevels.put("Applied", '1'); courseLevels.put("ELL", '9'); courseLevels.put("Special Education", '8'); }; //Determine if…
score: -1
has answer: http://stackoverflow.com/a/24090592
has answer: http://stackoverflow.com/a/24090657
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37158693
downvote count: 1
linked to: http://stackoverflow.com/q/2429228
has title: How to convert text into the fields of an object
tagged with: java
has comment: http://stackoverflow.com/comment/37158649
type: Question
has comment: http://stackoverflow.com/comment/37155617
upvote count: 0

http://stackoverflow.com/q/23992691
tagged with: scala-java-interop
tagged with: scala
has comment: http://stackoverflow.com/comment/36972827
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23992800
answer count: 1
score: 0
tagged with: android
has body: I am using Scala in Android, and I want to convert scala.collection.mutable.ArrayBuffer to Java.util.List. But it do not work out, can some help me out? code: package com.ssj.DoubanPipi.activity.fragment import android.app.Fragment import android.view.{View, LayoutInflater, ViewGroup} import android.os.Bundle import com.ssj.DoubanPipi.R import android.widget.{ListView, SimpleAdapter} import scala.collection.mutable.ArrayBuffer import scala.collection.JavaConversions._ /** * Created by shenshijun on 14-5-31. */ class MainFragment extends Fragment { override def onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle) = { val rootView = inflater.inflate(R.layout.main_fragment, container, false) val listView = (rootView findViewById R.id.fragment_list).asInstanceOf[ListView] val adapter = new SimpleAdapter(getActivity, MainFragment.menu_list, R.layout.main_fragment_list, Array("text", "image"), Array(R.id.action, R.id.action_image)) listView setAdapter adapter rootView } def onSign(view: View) { } } object MainFragment { val menu_list_text = Array(R.string.login, R.string.exit) val menu_list_image = Array(R.drawable.douban, R.drawable.exit) val menu_list = new ArrayBuffer[Map[String, Any]]() val len = menu_list_image.length for (index &lt;- 0 until len) { val map = Map("text" -&gt; menu_list_text(index), "image" -&gt; menu_list_image(index)) menu_list += map } } and the error message is the following: type mismatch; found : scala.collection.mutable.ArrayBuffer[scala.collection.immutable.Map[String,Any]] required: java.util.List[_ &lt;: java.util.Map[String, _]] val adapter = new SimpleAdapter(getActivity, MainFragment.menu_list, ^
accepted answer: http://stackoverflow.com/a/23992800
has title: Why does JavaConversions._ do not take place for Buffer when java List is expected?

http://stackoverflow.com/a/24020708
downvote count: 0
has comment: http://stackoverflow.com/comment/37025642
has comment: http://stackoverflow.com/comment/37026159
upvote count: 2
has comment: http://stackoverflow.com/comment/37039406
answers question: http://stackoverflow.com/q/24020332
has body: I would suggest that you go back to the basics of how computers work. Visually the stack would look like this; ---------------- Application ---------------- Operating System ---------------- Hardware ---------------- At the bottom of the stack you have the hardware. This can be of any architecture - x86, ARM, PowerPC ... etc. Above this you have the Operating System which handles the interaction between the user-facing application and the underlying hardware. And on top, you have the application. Now, assume that you have to support an application to run on multiple pieces of hardware. For every platform (OS+hardware combo) you would need to maintain different application source code. Something like this; ---------------------- || ---------------------- Application (x86) || Application (ARM) ---------------------- || ---------------------- Operating System (x86) || Operating System (ARM) ---------------------- || ---------------------- Hardware (x86) || Hardware (ARM) ---------------------- || ---------------------- Which, depending on the complexity of your application, becomes a maintenance nightmare. The Java Runtime Environment (JRE) promises a "code once, run anywhere" philosophy. Simply put, they add another layer to the stack like this; --------------------------------------------------------- Application (Java) --------------------------------------------------------- JRE (x86) || JRE (ARM) ---------------------- || ---------------------- Operating System (x86) || Operating System (ARM) ---------------------- || ---------------------- Hardware (x86) || Hardware (ARM) ---------------------- || ---------------------- Doing things this way means that you won't need to worry about what kind of hardware your application will run on. Makes things a LOT easier to maintain. And I like to think that my ASCII art answered your question?
has comment: http://stackoverflow.com/comment/37025719
type: Answer
score: 2

http://stackoverflow.com/comment/37004305
score: 0
type: Comment
type: QuestionComment
has text: @ Dhrubajyoti Gogoi .. As far as i know i have added but can you point me error location .. it would be really help full for me as i am struggling since last one day to figuring out this error but till now no success :(
comment on: http://stackoverflow.com/q/23991722

http://stackoverflow.com/a/24053889
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24053749
downvote count: 0
upvote count: 2
has body: The code new SimpleDateFormat("dd-MM-yyyy").parse(jTextFieldDate.getText())) returns a java.util.Date not a java.sql.Date You can construct a java.sql.Date using a long tm which you can from java.util.Date.getTime ()

http://stackoverflow.com/q/24070211
score: 1
has title: android - list of elements compose from text+image+radio button
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/24070514
tagged with: list
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/24070514
has body: I use simple_list_item_1 to show list in my app. I want to change the list so each element in list will have an image + radio button in addition to his text which taken from Const.practisesList. This is the code now : ListAdapter listAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, Const.practisesList); final ListView tests_list = (ListView)findViewById(R.id.tests_list); tests_list.setAdapter(listAdapter); tests_list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { switch(position){ case Const.TEST_TYPE1_MATH: p = practiseCreator(1) break; case Const.TEST_TYPE4_INSTRUCTIONS: p = practiseCreator(4) break; } } }); What is the way to do it? thanks
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24095436
has comment: http://stackoverflow.com/comment/37171828
has comment: http://stackoverflow.com/comment/37173430
has comment: http://stackoverflow.com/comment/37173915
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37173649
has comment: http://stackoverflow.com/comment/37172245
score: 1
answers question: http://stackoverflow.com/q/24095322
has comment: http://stackoverflow.com/comment/37169017
has body: When you use Swing you should make your long running tasks in a separate thread. Here is the tutorial: http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html
downvote count: 0

http://stackoverflow.com/q/23996352
has body: I'm having trouble with case-insensitive pattern in Java. According to online tools and to my understanding, the string: "1-800 flowers.com, CO." Should matches the regex pattern: "(\s|^)((?i)\Q1-800 FLOWERS.COM, CO.\E)(\s|$)" But, when building this pattern in Java, it doesn't match... I think the problem has to do with case sensitivity, because the following string does match (I only changed ".com" to ".COM"): "1-800 flowers.COM, CO." This is how I've built it in Java: String phraseToReplace="1-800 flowers.com, CO."; Pattern pattern = Pattern.compile("(\\s|^)((?i)" + Pattern.quote(phraseToReplace) + ")(\\s|$)", Pattern.MULTILINE); I tried with and without the Pattern.MULTILINE (I thought maybe it translated the dot as a NEW LINE...) and also tried to build it with Pattern.CASE_INSENSITIVE. It doesn't match... Can you recognize what I'm doing wrong / advice how can I make it work?
has comment: http://stackoverflow.com/comment/36980447
has comment: http://stackoverflow.com/comment/36980267
has comment: http://stackoverflow.com/comment/36981006
has title: Java Case insensitive when including a dot
upvote count: 1
has comment: http://stackoverflow.com/comment/36981113
answer count: 1
has answer: http://stackoverflow.com/a/23997003
has comment: http://stackoverflow.com/comment/36980437
has comment: http://stackoverflow.com/comment/36980788
has comment: http://stackoverflow.com/comment/36979960
tagged with: java
has comment: http://stackoverflow.com/comment/43183497
has comment: http://stackoverflow.com/comment/36980698
has comment: http://stackoverflow.com/comment/36981144
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36979962
accepted answer: http://stackoverflow.com/a/23997003
favorite count: 0
has comment: http://stackoverflow.com/comment/36980143
type: Question
has comment: http://stackoverflow.com/comment/36980187
has comment: http://stackoverflow.com/comment/36981237
tagged with: regex
score: 1
has comment: http://stackoverflow.com/comment/36980088
has comment: http://stackoverflow.com/comment/36981264

http://stackoverflow.com/a/23961169
type: Answer
has body: The error is telling you that you need a constructor method in your GrupoAplicacao class which accepts a string. @Entity @Table(name = "GRUPO_APLICACAO") public class GrupoAplicacao implements Serializable, Entidade { .... GrupoAplicacao(String stringJSON){ setters; } }
upvote count: 12
score: 12
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23961000
downvote count: 0
answers question: http://stackoverflow.com/q/23961000

http://stackoverflow.com/a/76575082
has body: If you are getting this issue in Spring boot when you have received a request from postman/web and you are trying to spawn a new thread (may be by using CompletableFuture) to get a response. Then you might be trying to get something within the spawned thread which is related to the original request like the sessionId. Instead, you should get them (sessionId and other parameters) in main thread and pass the sessionId and other parameters which is associated to the original request method argument which you'll call in the CompletableFuture. I have shared a screenshot of the same where I am extracting the sessionId from original request and passing it through to the someMethodCall() as a parameter.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24025924
downvote count: 0
type: Answer

selenium
tags question: http://stackoverflow.com/q/24003199
tags question: http://stackoverflow.com/q/23995244
tags question: http://stackoverflow.com/q/23949547
tags question: http://stackoverflow.com/q/24052454
tags question: http://stackoverflow.com/q/24056419
tags question: http://stackoverflow.com/q/23949972
tags question: http://stackoverflow.com/q/24001728
tags question: http://stackoverflow.com/q/23994321
tags question: http://stackoverflow.com/q/23975272
tags question: http://stackoverflow.com/q/23958414
tags question: http://stackoverflow.com/q/24087084
tags question: http://stackoverflow.com/q/24092257
tags question: http://stackoverflow.com/q/23941763
tags question: http://stackoverflow.com/q/24026830
tags question: http://stackoverflow.com/q/23948337
tags question: http://stackoverflow.com/q/24067577
tags question: http://stackoverflow.com/q/24058030
tag name: selenium
tags question: http://stackoverflow.com/q/24032776
tags question: http://stackoverflow.com/q/23996168
tags question: http://stackoverflow.com/q/24075808
tags question: http://stackoverflow.com/q/23959890
tags question: http://stackoverflow.com/q/23997701
tags question: http://stackoverflow.com/q/23979787
tags question: http://stackoverflow.com/q/23960849
tags question: http://stackoverflow.com/q/23949687
tags question: http://stackoverflow.com/q/24041275
tags question: http://stackoverflow.com/q/23948340
tags question: http://stackoverflow.com/q/23983907
tags question: http://stackoverflow.com/q/24012541
tags question: http://stackoverflow.com/q/24013835
type: Tag
tags question: http://stackoverflow.com/q/24067212
tags question: http://stackoverflow.com/q/23980540
tags question: http://stackoverflow.com/q/24085409
tags question: http://stackoverflow.com/q/24028430

http://stackoverflow.com/a/24012337
answers question: http://stackoverflow.com/q/24011940
type: Answer
has body: looks like you need to use sticky-sessions. This must be configured in the apache
score: 0

http://stackoverflow.com/q/24051648
has answer: http://stackoverflow.com/a/24051664
has body: I have a ListView populated with dummy "locations." This works fine. Now, I am trying to add a footer to the bottom of the ListView (a progess bar). When I do this, I get a null pointer error and I'm not sure why. Any ideas? Thanks! The error happens on this line listView.addFooterView(footerView); Here is the logcat: 06-05 00:43:27.887: D/AndroidRuntime(1839): Shutting down VM 06-05 00:43:27.887: W/dalvikvm(1839): threadid=1: thread exiting with uncaught exception (group=0x419397c0) 06-05 00:43:27.887: E/AndroidRuntime(1839): FATAL EXCEPTION: main 06-05 00:43:27.887: E/AndroidRuntime(1839): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test6/com.example.test6.MainActivity}: java.lang.NullPointerException 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339) 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389) 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.app.ActivityThread.access$600(ActivityThread.java:153) 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269) 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.os.Handler.dispatchMessage(Handler.java:99) 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.os.Looper.loop(Looper.java:137) 06-05 00:43:27.887: E/AndroidRuntime(1839): at android.app.ActivityThread.main(ActivityThread.java:5289) 06-05 00:43:27.887: E/AndroidRuntime(1839): at java.lang.reflect.Method.invokeNative(Native Method) 06-05 00:43:27.887: E/AndroidRuntime(1839): at java.lang.reflect.Method.invoke(Method.java:525) 06-05 00:43:27.887: E/AndroidRuntime(1839): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 06-05 00:43:27.887: E/AndroidRuntime(1839): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 06-05 00:43:27.887: E/AndroidRuntime(1839): at dalvik.system.…
possible better answer: http://stackoverflow.com/a/24051837
accepted answer: http://stackoverflow.com/a/24051664
has answer: http://stackoverflow.com/a/24051837
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24051771
linked to: http://stackoverflow.com/q/17429205
answer count: 4
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24051713
score: -1
has title: Adding a footer to a listview
tagged with: listview

http://stackoverflow.com/q/23965202
has comment: http://stackoverflow.com/comment/36922464
downvote count: 0
has comment: http://stackoverflow.com/comment/36922454
has comment: http://stackoverflow.com/comment/36922469
has title: Concurrent Threads Reading a Socket
has comment: http://stackoverflow.com/comment/36922307
has comment: http://stackoverflow.com/comment/36922240
has comment: http://stackoverflow.com/comment/36922331
has comment: http://stackoverflow.com/comment/36922317
has comment: http://stackoverflow.com/comment/36922498
has comment: http://stackoverflow.com/comment/36922275
answer count: 1
has comment: http://stackoverflow.com/comment/36922359
has comment: http://stackoverflow.com/comment/36922412
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36922486
has body: I have a simple Server-Client socket connection. I encapsulate all my data in objects which are sent backward and forward between the sockets, sent through ObjectStreams. I have created a "HeartBeat" monitor, which runs in a separate thread, where both the server and the client, every 500ms, send a HeartBeat (empty object) backward and forward to check for connectivity, which works great. However, because of this, when I want to send other data between the server and client, it is mixed up with these HeartBeat objects. For example my Server is expecting a Login object, but instead gets an object of instance HeartBeat. My code is a simple client/server setup, so I don't think it'd be necessary to post their code, however, the HeartBeat code is as follows: private static final int HEARTBEAT_INTERVAL = 500; private void addHeartBeatMonitor(final Socket socket) { this.heartBeatTimer = new Timer(); this.heartBeatTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { try { ObjectOutputStream os = new ObjectOutputStream(socket.getOutputStream()); os.writeObject(new HeartBeat()); ObjectInputStream is = new ObjectInputStream(socket.getInputStream()); if (!(is.readObject() instanceof HeartBeat)) { throw new IOException(); } } catch (IOException e) { LOG.info("Received disconnect from " + getClientSocket().getInetAddress()); heartBeatTimer.cancel(); if (clientSocket != null) { try { clientSocket.close(); } catch (IOException e1) {} } } catch (ClassNotFoundException e) {} } }, 0, HEARTBEAT_INTERVAL); } My options seem to be to as follows: Ditch the HeartBeat functionality, although there seems to be no other reliable way to check the connection status. Find some other kind of Socket implementation which will magically fix all of this for me. Have a synchronized method which oversees all reads and writes to the socket, which discards HeartBeats and sends other objects where they're meant to be. Some kind of synchronization magic. Thanks in advance for any help…
has comment: http://stackoverflow.com/comment/36922274
score: 3
has answer: http://stackoverflow.com/a/23965656
has comment: http://stackoverflow.com/comment/36922452
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36922511
type: Question
has comment: http://stackoverflow.com/comment/36922271

http://stackoverflow.com/q/23979959
score: -3
downvote count: 3
tagged with: swing
has answer: http://stackoverflow.com/a/23980128
tagged with: jbutton
has title: saving a button for later use
linked to: http://stackoverflow.com/q/218384
tagged with: java
has comment: http://stackoverflow.com/comment/36948981
has comment: http://stackoverflow.com/comment/36949692
has comment: http://stackoverflow.com/comment/36950278
duplicate of: http://stackoverflow.com/q/218384
type: Question
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36950294
tagged with: nullpointerexception
has body: I want to save this button and change it's icon the next time someone clicks on another button, but it gives me nullpointer exception on the line that i say button2.setIcon(icon); . How can I save this button and change it's icon the next time? Or how can i access the button array in the constructor? Is it possible? package tictactoe; // import necessary classes and interfaces import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.LinkedHashSet; import java.util.Random; import java.util.Set; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class TicTacToeGame extends JFrame { /** * */ boolean lock=false; //int for_the_first_time=1; int temp1; int temp2; int selected=0; Icon ic; int row ; int col ; Icon[] array = new Icon[12]; Icon[] arrayc = new Icon[12]; int[] random_array = new int[12]; int[] arrayint = new int[12]; int[] arrayintc = new int[12]; private static final long serialVersionUID = 1L; private final static int ROWS = 3; private final static int COLUMNS = 4; private JButton button[]; private JPanel buttonsPanel; private JButton exitButton; Icon icon = new ImageIcon(getClass().getResource("scene.jpg")); public TicTacToeGame() { // set frame's title this.setTitle( "Remember Me" ); buttonsPanel = new JPanel(); // set panel's layout manager buttonsPanel.setLayout( new GridLayout( ROWS , COLUMNS , 1 , 1 ) ); // create a JButton object named exitButton exitButton = new JButton("Exit"); //register an ActionListener for exitButton exitButton.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae ) { // do a normal exit System.exit( 0 ); } } ); // add exitButton to frame this.add( exitButton , BorderLayout.SOUTH ); // create an array of JButtons button = new JButton[ ROW…
type: UnansweredQuestion

http://stackoverflow.com/q/24071076
has answer: http://stackoverflow.com/a/24072362
has body: I know that this is not a serious question (and my code is not perfect...), but I wonder why after initialization of the field, which passed as a parameter to the method, the field has a null pointer (null)? public class MainActivity extends ActionBarActivity{ private ProgressDialog prdialog; ProgressDialog prepareDialog(ProgressDialog pr){ if (pr==null){ pr=new ProgressDialog(this); } pr.setTitle(R.string.Download); pr.setCanceledOnTouchOutside(false); pr.setCancelable(false); pr.setMessage(getString(R.string.Wait_)); return pr; } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); prepareDialog(prdialog).show(); //do some operations prdialog.dismiss();//here my app is crashes because prdialog=null } }
has comment: http://stackoverflow.com/comment/37119493
has comment: http://stackoverflow.com/comment/37119602
has answer: http://stackoverflow.com/a/24071196
has comment: http://stackoverflow.com/comment/37119429
tagged with: android
accepted answer: http://stackoverflow.com/a/24071196
type: AnsweredQuestion
has title: Field of class has null after initialization in the method of class
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/40480
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24072362
tagged with: progressdialog

http://stackoverflow.com/q/24012522
favorite count: 0
accepted answer: http://stackoverflow.com/a/24012662
has title: Regular Expression - Match String Pattern
possible better answer: http://stackoverflow.com/a/24012582
has answer: http://stackoverflow.com/a/24012582
has answer: http://stackoverflow.com/a/24012662
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24012847
tagged with: java
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/37010575
has comment: http://stackoverflow.com/comment/37010100
upvote count: 1
has body: i want to print out the position of the second occurrence of zip in text, or -1 if it does not occur at least twice. public class UdaciousSecondOccurence { String text = "all zip files are zipped"; String text1 = "all zip files are compressed"; String REGEX = "zip{2}"; // atleast two occurences protected void matchPattern1(){ Pattern p = Pattern.compile(REGEX); Matcher m = p.matcher(text); while(m.find()){ System.out.println("start index p" +m.start()); System.out.println("end index p" +m.end()); // System.out.println("Found a " + m.group() + "."); } output for matchPattern1() start index p18 end index p22 But it does not print anything for pattern text1 - i have used a similar method for second pattern -
has answer: http://stackoverflow.com/a/24012628
has answer: http://stackoverflow.com/a/24012891
has answer: http://stackoverflow.com/a/24012647
has answer: http://stackoverflow.com/a/24012613
has answer: http://stackoverflow.com/a/24012655
tagged with: regex
has comment: http://stackoverflow.com/comment/37010069

http://stackoverflow.com/comment/36940706
comment on: http://stackoverflow.com/q/23975531
score: 0
type: QuestionComment
type: Comment
has text: Already seen it, it doesn't help much because it is an explanation of what I already know, I just need some basic information about maximum heights, widths, and normal button sizes.

http://stackoverflow.com/comment/40196731
type: AnswerComment
has text: @Zhora--What a nice comment, especially about the closed questions. There is a lot of shortness of temper (impatience?), it seems, at SO and your post--especially being months after this thread ended--just shows that there is ample positivity around, too. Thank you.
type: Comment
comment on: http://stackoverflow.com/a/23975553
score: 0

multithreading
tags question: http://stackoverflow.com/q/24071227
tags question: http://stackoverflow.com/q/23979032
tags question: http://stackoverflow.com/q/24028755
tags question: http://stackoverflow.com/q/23967323
tags question: http://stackoverflow.com/q/23999093
tags question: http://stackoverflow.com/q/24056149
tags question: http://stackoverflow.com/q/24023098
tags question: http://stackoverflow.com/q/23979766
tags question: http://stackoverflow.com/q/23955924
tags question: http://stackoverflow.com/q/23961411
tags question: http://stackoverflow.com/q/23959495
type: Tag
tags question: http://stackoverflow.com/q/23976985
tags question: http://stackoverflow.com/q/24076877
tags question: http://stackoverflow.com/q/23950492
tags question: http://stackoverflow.com/q/23973612
tags question: http://stackoverflow.com/q/23992385
tags question: http://stackoverflow.com/q/23994344
tags question: http://stackoverflow.com/q/23944507
tags question: http://stackoverflow.com/q/24030366
tags question: http://stackoverflow.com/q/24050228
tags question: http://stackoverflow.com/q/24063426
tags question: http://stackoverflow.com/q/23973673
tags question: http://stackoverflow.com/q/24077182
tags question: http://stackoverflow.com/q/24017378
tags question: http://stackoverflow.com/q/24012781
tags question: http://stackoverflow.com/q/23966159
tags question: http://stackoverflow.com/q/23988021
tags question: http://stackoverflow.com/q/24000242
tags question: http://stackoverflow.com/q/24095322
tags question: http://stackoverflow.com/q/23950372
tags question: http://stackoverflow.com/q/24005755
tags question: http://stackoverflow.com/q/24071987
tags question: http://stackoverflow.com/q/23956988
tags question: http://stackoverflow.com/q/24015756
tags question: http://stackoverflow.com/q/23951667
tags question: http://stackoverflow.com/q/24061497
tags question: http://stackoverflow.com/q/24104642
tags question: http://stackoverflow.com/q/23959948
tags question: http://stackoverflow.com/q/24078235
tags question: http://stackoverflow.com/q/24100970
tags question: http://stackoverflow.com/q/23986771
tags question: http://stackoverflow.com/q/24065443
tags question: http://stackoverflow.com/q/24068672
tags question: http://stackoverflow.com/q/24089968
tags question: http://stackoverflow.com/q/23942041
tags question: http://stackoverflow.com/q/23979065
tags question: http://stackoverflow.com/q/24072551
tags question: http://stackoverflow.com/q/23985661
tags question: http://stackoverflow.com/q/23990818
tags question: http://stackoverflow.com/q/23949812
tags question: http://stackoverflow.com/q/23988506
tags question: http://stackoverflow.com/q/23997048
tags question: http://stackoverflow.com/q/24054274
tags question: http://stackoverflow.com/q/23979046
tags question: http://stackoverflow.com/q/23998495
tags question: http://stackoverflow.com/q/24085571
tags question: http://stackoverflow.com/q/24082519
tags question: http://stackoverflow.com/q/23965651
tags question: http://stackoverflow.com/q/23975031
tags question: http://stackoverflow.com/q/23998472
tags question: http://stackoverflow.com/q/24097356
tags question: http://stackoverflow.com/q/24087196
tags question: http://stackoverflow.com/q/24102939
tags question: http://stackoverflow.com/q/23991746
tags question: http://stackoverflow.com/q/23955636
tags question: http://stackoverflow.com/q/23971938
tags question: http://stackoverflow.com/q/24069210
tags question: http://stackoverflow.com/q/24011334
tags question: http://stackoverflow.com/q/24040339
tags question: http://stackoverflow.com/q/24055947
tags question: http://stackoverflow.com/q/24008888
tags question: http://stackoverflow.com/q/24031857
tags question: http://stackoverflow.com/q/23971115
tags question: http://stackoverflow.com/q/23946482
tags question: http://stackoverflow.com/q/24092879
tags question: http://stackoverflow.com/q/24069090
tags question: http://stackoverflow.com/q/23998679
tags question: http://stackoverflow.com/q/24033027
tags question: http://stackoverflow.com/q/23960638

http://stackoverflow.com/comment/37172131
type: Comment
type: QuestionComment
has text: On an unrelated note - if you intend to use your database with a `Cursor` for populating a `ListView` (or other classes which extend `AdapterView`), change the name of your id column to be `_id`. Note the underscore prefix.
comment on: http://stackoverflow.com/q/24099357
score: 0

http://stackoverflow.com/comment/37048506
comment on: http://stackoverflow.com/q/24021152
has text: @RomanC, No i don't have both methods - I have either the isValid() or the getValid(). I know the getValid() will work, but i'm wondering if the isValid() will work too. I would also like to see some official documentation on which methods can be invoked and to get the data and in whch order struts2 will search for them. (for example, will get always precede is?)
score: 0
type: Comment
type: QuestionComment

blur
tags question: http://stackoverflow.com/q/24078565
tag name: blur
type: Tag

http://stackoverflow.com/comment/37167934
score: 0
type: QuestionComment
type: Comment
has text: variables are not passed; values are.
comment on: http://stackoverflow.com/q/24096952

http://stackoverflow.com/a/57670792
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/23953534
has body: Root Cause - PhysicalConnector.java in ojdbc6 public void commit(int paramInt) throws SQLException { disallowGlobalTxnMode(114); if (this.lifecycle != 1) { SQLException sQLException = DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 8); sQLException.fillInStackTrace(); throw sQLException; } . . PhysicalConnector.java in ojdbc7 public void commit(int paramInt) throws SQLException { disallowGlobalTxnMode(114); ​if (this.autoCommitSpecCompliant &amp;&amp; getAutoCommit()) { throw (SQLException)DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 273).fillInStackTrace(); } if (this.lifecycle != 1) { SQLException sQLException = DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 8); sQLException.fillInStackTrace(); throw sQLException; ​} . . We can see that in ojdbc7, there is some piece of code has been introduced. If autoCommitSpecCompliant and getAutoCommit() both are true, we will be getting exception. Two Fixes Available - set autoCommitSpecCompliant false Below JVM parameter to be set -Doracle.jdbc.autoCommitSpecCompliant=false insert below piece of code before connection.commit() connection.setAutoCommit(false);
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/139437002

http://stackoverflow.com/q/24017673
has answer: http://stackoverflow.com/a/24991266
tagged with: spring
accepted answer: http://stackoverflow.com/a/24991266
upvote count: 15
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: "Step" or "Job" Scope for Spring-Batch beans?
has comment: http://stackoverflow.com/comment/37020319
has body: I'm using Spring-Batch v3.0.0 for batch imports. There is a StepScope and a JobScope. How can I know which of them is appropriate? For example, if I define a custom ItemReader or ItemWriter that should use a specific EntityManager, it could look like this: @Bean @Scope("step") //@Scope("job") //custom scope required to inject #jobParameters public JpaItemWriter&lt;T&gt; jpaItemWriter(EntityManagerFactory emf) { JpaItemWriter&lt;T&gt; writer = new JpaItemWriter&lt;T&gt;(); writer.setEntityManagerFactory(emf); return writer; } But which scope is right here? And why? Execution with step scope works, but I feel the itemWriters should maybe be of job scope so that they are not recreated on every step. I tried switching step to job, but that throws following error: Exception in thread "main" java.lang.IllegalStateException: No Scope registered for scope 'job'
type: Question
score: 15
has comment: http://stackoverflow.com/comment/37021043
possible better answer: http://stackoverflow.com/a/24018574
has comment: http://stackoverflow.com/comment/37019828
has answer: http://stackoverflow.com/a/24018574
has comment: http://stackoverflow.com/comment/37019634
answer count: 2
linked to: http://stackoverflow.com/q/12353570
tagged with: batch-processing
favorite count: 0
tagged with: spring-batch

http://stackoverflow.com/q/23950285
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/23950350
score: 0
tagged with: spring-data-rest
tagged with: google-app-engine
has title: NullPointerException when running Spring Rest app
has body: I get this while accessing a Spring Resource from the browser 127.0.0.1:8080/ I wonder why its throwing this error: [INFO] java.lang.NullPointerException [INFO] at java.util.Arrays$ArrayList.&lt;init&gt;(Arrays.java:2842) [INFO] at java.util.Arrays.asList(Arrays.java:2828) [INFO] at org.springframework.hateoas.config.HypermediaSupportBeanDefinitionRegistrar.registerBeanDefinitions(HypermediaSupportBeanDefinitionRegistrar.java:96) [INFO] at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:340) [INFO] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:233) [INFO] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:154) [INFO] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:131) [INFO] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285) [INFO] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223) [INFO] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) [INFO] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) [INFO] at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651) [INFO] at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599) [INFO] at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665) [INFO] at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518) [INFO] at org.spring…
tagged with: spring-data
tagged with: spring
has answer: http://stackoverflow.com/a/23950350
type: AnsweredQuestion
tagged with: java

hash
tags question: http://stackoverflow.com/q/23977875
tags question: http://stackoverflow.com/q/23953885
type: Tag
tags question: http://stackoverflow.com/q/24101785
tags question: http://stackoverflow.com/q/23986012
tags question: http://stackoverflow.com/q/23959058
tag name: hash

http://stackoverflow.com/comment/36966257
comment on: http://stackoverflow.com/q/23983590
score: 0
type: Comment
type: QuestionComment
has text: Without code, or a full stack-trace, it's pretty much impossible to help. vlcj JavaFX video applications can play just fine for many hours if implemented correctly.

http://stackoverflow.com/comment/125239016
has text: Thats all well and good if you have an acyclic directed graph. But you are SOL if an object reference transitively references the enclosing entity. This is easily possible if the relationship is not parent-child. Imagine serializing one side of a many-to-many relationship where the relation is represented by a join entity. This is a very common case in JPA - where all entities are required by the spec to implement Serializable. If you also try to use SerializationProxy in this scenario you will encounter this serious deficiency in Java Serialization.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24039216

http://stackoverflow.com/comment/36916259
score: 0
has text: Do you mean that LWGJL is written that way because it is not possible to write an OO wrapper over a library that is not OO?
type: Comment
comment on: http://stackoverflow.com/a/23961912
type: AnswerComment

http://stackoverflow.com/comment/36953318
type: Comment
has text: have you the `<context:component-scan base-package="org.example"/>` in your spring context?
comment on: http://stackoverflow.com/q/23981118
score: 0
type: QuestionComment

http://stackoverflow.com/comment/47480497
has text: There doesn't seem to be a standard library class named `MethodReference`. Do you mean `MethodHandle` here?
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23991339

http://stackoverflow.com/comment/37047937
type: QuestionComment
has text: i am using redis 2.8 ,Jedis 2.4.2
comment on: http://stackoverflow.com/q/24030812
score: 0
type: Comment

http://stackoverflow.com/a/24052341
score: 1
has body: My question is, how do spring experts even debug this kind of uninformative error message? I'd argue that the error message is very informative. It states that something has tried to put your application in an illegal state. In this particular example, your context was configured in a way where some bean's class is not specified. This is typically caused by forgetting to put a class attribute in a &lt;bean&gt; declaration. Spring creates BeanDefinition objects for each bean in your context. These can be from your &lt;bean&gt; declarations or other XML elements or Java configuration elements (from @Configuration, @Component, etc.). Almost everything involved in a Spring ApplicationContext is a bean. You can be pretty sure that Spring's infrastructure beans aren't to blame for this. Spring is an established framework with tons of work put into it and testing done before every release. The immediately obvious alternative is that somewhere in your code you forgot to specify a class. Did you, for example, try to make an abstract &lt;bean&gt; but forget to add the abstract="true"? Did you register a BeanDefinitionParser and create BeanDefinitions without a class? Did you create BeanDefinitionPostProcessor and remove BeanDefinition class values? Those are the things I would start with.
has comment: http://stackoverflow.com/comment/109738349
answers question: http://stackoverflow.com/q/24051548
has comment: http://stackoverflow.com/comment/109735999
has comment: http://stackoverflow.com/comment/37098462
type: Answer
has comment: http://stackoverflow.com/comment/37111688
upvote count: 2
downvote count: 1

http://stackoverflow.com/a/23996151
has body: Java does not support tail-recursion optimization, so your last line in the lifeCycle method creates a new stack frame for every iteration. With your memory size, and the number of local variables, you have determined that you can have about 4000 stack frames. Solution: rewrite your method using a for-loop. It's a small change, you don't really need recursion for your method.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23995856

http://stackoverflow.com/q/24084265
score: 1
has body: I've been playing around with MRUnit and tried running it for a hadoop wordcount example following the tutorial for wordcount and unit testing Though not a fan, I've been using Eclipse to run the code and I keep getting an error for setMapper function import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mrunit.mapreduce.MapDriver; import org.apache.hadoop.mrunit.mapreduce.MapReduceDriver; import org.apache.hadoop.mrunit.mapreduce.ReduceDriver; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.junit.Before; import org.junit.Test; public class TestWordCount { MapReduceDriver&lt;LongWritable, Text, Text, IntWritable, Text, IntWritable&gt; mapReduceDriver; MapDriver&lt;LongWritable, Text, Text, IntWritable&gt; mapDriver; ReduceDriver&lt;Text, IntWritable, Text, IntWritable&gt; reduceDriver; @Before public void setUp() throws IOException { WordCountMapper mapper = new WordCountMapper(); mapDriver = new MapDriver&lt;LongWritable, Text, Text, IntWritable&gt;(); mapDriver.setMapper(mapper); //&lt;--Issue here WordCountReducer reducer = new WordCountReducer(); reduceDriver = new ReduceDriver&lt;Text, IntWritable, Text, IntWritable&gt;(); reduceDriver.setReducer(reducer); mapReduceDriver = new MapReduceDriver&lt;LongWritable, Text, Text, IntWritable, Text, IntWritable&gt;(); mapReduceDriver.setMapper(mapper); //&lt;--Issue here mapReduceDriver.setReducer(reducer); } Error message: java.lang.Error: Unresolved compilation problems: The method setMapper(Mapper&lt;LongWritable,Text,Text,IntWritable&gt;) in the type MapDriver&lt;LongWritable,Text,Text,IntWritable&gt; is not applicable for the arguments (WordCountMapper) The method setMapper(Mapper&lt;LongWritable,Text,Text,IntWritable&gt;) in the type MapReduceDriver&lt;LongWrita…
tagged with: java
tagged with: mrunit
has title: Conflicting API when trying to run MRUnit example
type: Question
tagged with: hadoop
answer count: 2
tagged with: junit
has answer: http://stackoverflow.com/a/24121931
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/34116300
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/36884575
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23945234
has text: I've never used a Java debugger before, actually. Would jdb be alright for this?
score: 0

http://stackoverflow.com/comment/36877424
type: Comment
has text: AH. Very nice. thank you! You have gifted me the solution and I am grateful. Thank you. :-)
score: 0
comment on: http://stackoverflow.com/q/23941414
type: QuestionComment

http://stackoverflow.com/a/24024857
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37065862
has comment: http://stackoverflow.com/comment/37059773
answers question: http://stackoverflow.com/q/24024481
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24024481
has body: I tend to tailor this to the OS I'm in and company conventions, but generally, putting the files in /opt/my-project and an init script in /etc/init.d (or similar). The init script follow's the OS's conventions, has a pid file, etc.
type: Answer

http://stackoverflow.com/q/24055763
downvote count: 0
has comment: http://stackoverflow.com/comment/37093430
score: 1
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/37129223
has comment: http://stackoverflow.com/comment/37156366
upvote count: 1
answer count: 1
tagged with: debian
has title: Using JDBC from Tomcat on Debian server
has answer: http://stackoverflow.com/a/40354134
favorite count: 0
has comment: http://stackoverflow.com/comment/37091328
has body: I have a Debian server. I'm trying to run a JSP website on it. I use MySQL and Tomcat 7.0.54. Now here is my problem: When I send the form with all the data, I get this ERROR: No connection to jdbc:mysql://localhost:3306/database?user=root&amp;password=***** In the terminal I could access to the DB. Here my code: package com.ubs.jdbc; import java.sql.Connection; import java.sql.DriverManager; public class DBConnector { private static Connection con = null; // HIER DEN CONNECT STRING ANPASSEN // private String connectString = "jdbc:mysql://localhost:3306/swissskills?user=root2&amp;password=swissskills"; /* CHANGE */ private Connection openConnection() { try { Class.forName( "com.mysql.jdbc.Driver" ); con = DriverManager.getConnection( connectString ); return con; } catch( Exception e) { System.out.println( "No connection to " + connectString ); } return null; } public static Connection getConnection() { if( con == null ) { return new DBConnector().openConnection(); } return con; } public static void closeConnection() { try { getConnection().close(); con = null; } catch( Exception e ) { System.out.println( "CLOSE CONNECTION: " + e.getMessage() ); } } } What am I doing wrong?
type: UnansweredQuestion
tagged with: jdbc
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/37092751

http://stackoverflow.com/comment/36994526
type: Comment
has text: @user3672391: why not? That comment on its own gives us almost no information. If you want help, you need to put more effort into helping us to help you...
comment on: http://stackoverflow.com/a/24003538
type: AnswerComment
score: 0

http://stackoverflow.com/q/24052862
has title: Set a selected text color using Swing
accepted answer: http://stackoverflow.com/a/24053272
has comment: http://stackoverflow.com/comment/37085674
linked to: http://stackoverflow.com/q/18243101
type: AnsweredQuestion
tagged with: java
tagged with: jtextpane
tagged with: swing
type: Question
tagged with: awt
score: 0
has answer: http://stackoverflow.com/a/24053272
answer count: 1
has body: I want to display a selected text with user selected color.My problem here is I had select some text and click on settextcolor it was applied to all the text not selected text.Please give me.. Here is my code: public class SetTextColor extends javax.swing.JFrame { int i=0; JTextPane textPane; JScrollPane scrollPane; public SetTextColor() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); Create = new javax.swing.JMenuItem(); SetTextColor = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); Create.setText("Create"); Create.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CreateActionPerformed(evt); } }); jMenu1.add(Create); SetTextColor.setText("SetTextColor"); SetTextColor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SetTextColorActionPerformed(evt); } }); jMenu1.add(SetTextColor); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) ); pack(); }// &lt;/editor-fold&gt; private void CreateActionPerformed(java.awt.event.ActionEvent evt) { final JInternalFrame internalFrame = new JInternalFrame(""); i++; internalFrame.setName("Docu…
linked to: http://stackoverflow.com/q/6068398

http://stackoverflow.com/q/24101597
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/24101952
score: 0
tagged with: saxparser
has title: How does SAX parsing method charecters() work
answer count: 1
has body: I am trying to read data from an xml file and store them in a list using the SAX parsing method. My problem is when I try to store the values of my data using the characters() method. I am creating an object where for each element I store each value and some extra information for some later use but when I try to store said value it stores spaces instead. I tried printing inside the method and while it seams to go through all my xml file it prints only a couple of the elements and not even in the right order. So can someone explain me what I am missing? XML FILE: <?xml version="1.0" encoding="UTF-8"?> sport <horse_power>222hp</horse_power> quattro</drivetrain 6_Manual luxury <horse_power>302hp</horse_power> front_wheel_drive 7_Automatic JAVA CODE : public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { lvl_cnt++; System.out.println(lvl_cnt); obj = new xml_obj(); obj.setLvl(lvl_cnt); System.out.println("LVL "+obj.getLvl()); if (lvl_cnt == 0) { obj.setValue(qName); obj.setParent("root"); System.out.println(obj.getParent()); } else { xml_obj tmp = objListofLists.get(objListofLists.size()-1); int lvl_before = tmp.getLvl(); System.out.println("AAA" + lvl_before); if (lvl_cnt > lvl_before) { obj.setParent(tmp.getValue()); } else if (lvl_cnt < lvl_before) { int j = 0; while (objListofLists.get(j).getLvl() != lvl_cnt) j++; tmp = objListofLists.get(j); obj.setParent(tmp.getParent()); } else { obj.setParent(tmp.getParent()); } System.out.println(obj.getParent()); } obj.attributes = attributes; objListofLists.add(obj); } public void endElement(String uri, String localName, String qName) throws SAXException { lvl_cnt--; } public void characters (char ch[], int start, int length) throws SAXException { String help = new String(ch, start, length); System.out.println(help); objListofLists.get(objListofLists.size()-1).setValue(help); } }
tagged with: character
accepted answer: http://stackoverflow.com/a/24101952
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/q/24026859
has comment: http://stackoverflow.com/comment/37037227
has comment: http://stackoverflow.com/comment/37037263
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37037192
answer count: 1
has comment: http://stackoverflow.com/comment/37037334
tagged with: arrays
score: -3
tagged with: binary-search
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37037315
has answer: http://stackoverflow.com/a/24026929
favorite count: 0
accepted answer: http://stackoverflow.com/a/24026929
has title: Binary Search, Array Index Out of Bounds Java
type: Question
has body: Firstly, I would like to say I am not asking for an answer more so advice so I can learn from this problem. Every time I run my code I get Array Index Out of Bounds on Line 254 of the ArrayOperations java file. if (SearchKey == tempArray[middle]) I have added as many checks as I possibly can to this code and also have commented it as much as possible for your ease. Once again I am looking for advice on this not just a direct answer if possible. The Error always seems to give me the negative version of 1/2 of my data items ex: 100,000 data items, Array Index Out of Bounds: -49,999. import javax.swing.*; // File-related imports import java.io.IOException; import java.util.Scanner; import java.io.File; public class ArrayOperations { // File Parameters String DataFilePath; String DataFileName; String KeysFilePath; String KeysFileName; int NumberOfDataItems; int NumberOfKeys; int N; int BucketHashArraySize; int NoBuckets; //Array int[] OriginalArray = new int[1000000]; int[] SortedArray = new int[1000000]; int[] HashedArray = new int[2000000]; int[] BucketHashedArray = new int[2000000]; int[] KeysArray = new int[1000000]; long SSAverageAccessTime; long SSAverageCompSuc; long SSAverageCompFailed; long SSNumberKeysSuc; long SSNumberKeysFailed ; long BSAverageAccessTime; long BSAverageCompSuc ; long BSAverageCompFailed; long BSNumberKeysSuc ; long BSNumberKeysFailed ; long HSAverageAccessTime; long HSAverageCompSuc ; long HSAverageCompFailed; long HSNumberKeysSuc ; long HSNumberKeysFailed ; public ArrayOperations() { // File Parameters DataFilePath = null; DataFileName = null; KeysFilePath = null; KeysFileName = null; NumberOfDataItems=0; NumberOfKeys =0; N =0; BucketHashArraySize = 0; NoBuckets =0; // Statistics SSAverageAccessTime = 0; SSAverageCompSuc = 0; SSAverageCompFailed = 0; SSNumberKeysSuc = 0; SSNumberKeysFailed = 0; } public void ReadDataFile() throws IOException { JFileChooser chooser = new JFileChooser(); chooser.setDialogType(JFileChooser.OPEN_DIALOG ); choos…
has comment: http://stackoverflow.com/comment/37037255

http://stackoverflow.com/comment/36896539
type: Comment
comment on: http://stackoverflow.com/q/23951571
type: QuestionComment
has text: @jsalonen yes, i want to develop in java.
score: 0

http://stackoverflow.com/q/23987373
downvote count: 0
linked to: http://stackoverflow.com/q/9932498
has title: Signing Android application using ANT
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/23987504
answer count: 2
has body: A few similar questions have been asked about this before but I haven't found an answer I can use. Basically I am trying to sign an Android app using ANT. I have undertaken all the steps necessary (i.e. creating keystore in CLI, editing project.properties file as I cannot find the ant.properites file) and then run "ant release" in CLI and I get the following error which I don't get as I have created a keystore several times now and when the prompt asks me to make my alias password the same as the keystore, i say "yeah why not" and press the enter button. BUILD FAILED /usr/local/Cellar/android-sdk/22.6.2/tools/ant/build.xml:1139: The following error occurred while executing this line: /usr/local/Cellar/android-sdk/22.6.2/tools/ant/build.xml:1151: Signing key speakandroid not found I don't need to edit my build.xml file do I? I think maybe not being able to edit the ant.properties file has something to do with it. Update: I have made the ant.properties file with the suggestions from @Nick. I also followed these steps to make another keystore in the appName/platforms/android directory: keytool -genkey -v -keystore speak.keystore -alias speakAndroid -keyalg RSA -keysize 2048 -validity 10000 As usual, I get prompted for my name and location details. Then it asks me if I want the password to be the same as the keystore (I gather this is the alias password/signing key?). I have set it to be a different password. Within my ant.properties file I have inserted the following: key.store=/Users/Coolwebs/Desktop/phonegap-projects/speakAndroid/platforms/android/speak.keystore key.alias=speakAndroid key.store.password=myPassword81 key.alias.password=speakApp Error comes up and still says that it cannot find the signing key for speakandroid alias (scratches head). I know the ant.properties file is doing its job because I have tested it be removing the passwords and seeing what ant in CLI does. The passwords are definitely right. Maybe it's because I have made "dirty" automatic debug…
tagged with: android
has answer: http://stackoverflow.com/a/25969343
tagged with: java
possible better answer: http://stackoverflow.com/a/25969343
tagged with: ant
has answer: http://stackoverflow.com/a/23987504
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/37100903
has text: @ChristopherFrancisco: No, you're sending binary data - that's fine :) When I say "text data" I mean "strings that are encoded using an encoding like UTF-8 or ISO-8859-1". The result of encryption definitely counts as binary data. Of course if your encryption lends itself to streaming, you could create an OutputStreamWriter which layered on top of your EncryptingOutputStream which itself would write to the underlying OutputStream...
type: Comment
comment on: http://stackoverflow.com/a/24061090
score: 0
type: AnswerComment

http://stackoverflow.com/comment/85601080
type: AnswerComment
has text: @Alberto what if it was the same element but updated ?
comment on: http://stackoverflow.com/a/23981032
score: 1
type: Comment

http://stackoverflow.com/comment/112195622
type: Comment
comment on: http://stackoverflow.com/a/42360792
has text: Sorry but I think this answer is not correct. Because if your input is ByteArrayInputStream you will get compile error. The correct input for this function is InputStream
score: 1
type: AnswerComment

http://stackoverflow.com/q/24042368
has body: I have a simple app with 3 edittext fields. When I type, the t|e|x|t|l|o|o|k|s|l|i|k|t|h|i|s. In my mainactivity.java, i have commented out ALL references to those fields and the problem persists. I can't seem to find anything about it and I am at a loss as I do Android very occasionally. Yes, I asked this question too, unsure what is appropriate as far as reposting. Android EditText cursor "ghosts" my activitymain.xml looks like this <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_url" android:textAppearance="?android:attr/textAppearanceLarge" /> <requestFocus /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_username" android:textAppearance="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/server_password" android:textAppearance="?android:attr/textAppearanceLarge" />
has title: Android EditText Glitches
type: Question
duplicate of: http://stackoverflow.com/q/23765181
has comment: http://stackoverflow.com/comment/37066055
downvote count: 0
linked to: http://stackoverflow.com/q/23765181
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37068451
upvote count: 1
tagged with: android-edittext
score: 1
tagged with: java

http://stackoverflow.com/comment/37176346
comment on: http://stackoverflow.com/a/23975008
type: Comment
score: 0
has text: If stat is global variable, Where does it defined?
type: AnswerComment

http://stackoverflow.com/q/24033788
upvote count: 2
type: UnansweredQuestion
tagged with: excel
type: Question
has title: Apache POI: Getting wrong number/string values reading from xlsx while xls is workfing fine
has body: i have two excel-sheets (one .xls, one .xlsx) with content "1234567891234.56" in cell A1. Now im trying to get this content into my java-app, using Apache POI like this: private String getValue(Cell myCell, int myCelltype) throws CellAccessException { try { switch (myCelltype) { case org.apache.poi.ss.usermodel.Cell.CELL_TYPE_STRING: return myCell.getStringCellValue(); ... First thing is, CellType (myCell.getCellType()) is always 1 (String), no matter how i format the cell itself. Second, when i am reading from xlsx, i got "1234567891234.5601" while reading from xls, i got "1234567891234.56" which is the result i expect. Another example is "12345678912345.6" in the files and "12345678912345.602" as result reading from xlsx. I have no idea, what's causing my problems and nobody else seems to have similar ones. I would appreciate any help you can give. Thanks in advance and greetings from germany. Ausric Edit: Thanks for comments and answer. Sadly, formatting the return value doesn't help since the problem is getting the right value from the excel sheet. While researching the unchanging CELL_TYPE i made a strange observation: As i read from the xls(!) file i got the right value as String (in this case 1.23456789123456E+20 ). Next, this String is converted into Double. String content = myCell.getStringCellValue(); System.out.println(result + "#" +result.length()); Double dresult = Double.valueOf(result); System.out.println(dresult); And the output looks like this: 1.23456789123456E+20#20 1.2345678912345601E20 So i startet thinking, i've got this error by reading from cells in xlsx which are numbers but marked as celltype STRING and by converting String into Double. Is there something wrong with Double ? Maybe we got some old Java Version here and Double was broken. I don't think it's poi's fault since it's 3.10 FINAL and should be working fine. Or is Double doing something while converting this String i just don't understand ? I am new to Java and to this job...just st…
tagged with: java
tagged with: apache
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37072947
favorite count: 0
has answer: http://stackoverflow.com/a/24035071
score: 2
tagged with: apache-poi

http://stackoverflow.com/comment/36961280
has text: Making Thread.sleep(800000) either before or after does not help. If u make it before waitFor(), does not serve the process. waitFor() is a blocking call, I think. Thread.sleep() does not help after waitFor() also.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23986211

http://stackoverflow.com/comment/42989627
comment on: http://stackoverflow.com/a/24080810
score: 0
has text: The reason `HashSet<T>` doesn't allow items to be read out isn't that it isn't useful, but rather that the creators of `HashSet<T>` failed to recognize the usefulness [e.g. immutable-object interning]. Unfortunately, while `HashMap<T,T>` is a good substitute for `HashSet<T>`, `WeakHashMap<T,T>` doesn't work as a substitute for `WeakHashSet<T>`.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/36950289
type: Comment
has text: I've been seeing the same on Chrome beta, Windows 8.1, c#, and chromedriver 2.9 and 2.10. It doesn't seem to adversely impact the running of the tests.
score: 1
comment on: http://stackoverflow.com/q/23980540
type: QuestionComment

http://stackoverflow.com/q/24000738
type: UnansweredQuestion
type: Question
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/24205280
upvote count: 7
tagged with: spring
answer count: 1
tagged with: internationalization
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/36990663
has title: How to implement i18n(Subdirectories with gTLDs) in Spring Framework?
has body: I'm working on a web application that uses Spring Framework, Spring (MVC), Spring Security, etc... The Spring documentation shows the internationalization adding a parameter in the URL, (e.g. http://myexample.com?lang=fr) But I have read this article by Google "Multi-regional and multilingual sites" which states that this practice is not recommended. So I decided to implement it this way: http://myexample.com/ -> default locale (EN) http://myexample.com/es/ -> locale es http://myexample.com/fr/ -> locale fr My question is: What is the best way to implement i18n (subdirectories with gTLDs) in Spring framework? Ideas, articles, examples are welcome.
downvote count: 0

http://stackoverflow.com/q/24087337
has answer: http://stackoverflow.com/a/24090253
answer count: 1
tagged with: multi-module
tagged with: maven-3
has title: Cobertura excludes not working in multi-module Maven 3 project
score: 0
has body: I have a multi-module Maven 3 project. We are using Cobertura as our code coverage tool, but the excludes tag is not working. We have some bad tests from a package we inherited from another team, but need to consume. The structure is as follows: <module1> .../com/aaaa/... <module2> .../com/aaaa/... <module3> .../com/aaaa/... ... <moduleN> packages with .../com/xx/... WE WANT TO EXCLUDE pacakges with .../com/aaaa/... WE WANT TO STILL INCLUDE parent-pom.xml Our parent POM is configured as such: ... <other plugins> org.codehaus.mojo cobertura-maven-plugin 2.6 true coverageReports **/com/xx/**/* /configuration> org.codehaus.mojo cobertura-maven-plugin 2.6 true coverageReports I've tried a lot of various configurations, including: Excluding the test/com/xx files as well Adding the exclusion pattern to ignore Setting exclude in the reporting AND build section Multiple permutations of the exclude file pattern, including being more implicit Any thoughts? I've had some other build engineers look at my various POM configurations and it always seems valid, but we never get accurate reports.
accepted answer: http://stackoverflow.com/a/24090253
type: Question
type: AnsweredQuestion
tagged with: maven-cobertura-plugin
tagged with: java

http://stackoverflow.com/comment/36983207
type: Comment
type: QuestionComment
has text: What I ended up doing (if anyone finds this oddly specific bug) was after Isaac commented that it could be the AV, I decided to "keep retrying" which has worked on every build so far-- by adding a retry task around the offending code. I set it to about 30 retries, and it hasn't failed since. Overall, without Isaac's help I wouldn't have thought of the solution (I've never written a Build script before).
score: 2
comment on: http://stackoverflow.com/q/23954875

http://stackoverflow.com/comment/36907597
type: Comment
comment on: http://stackoverflow.com/a/23957253
type: AnswerComment
has text: If you sort in natural order the upper case get precedence. So partly this will satisfy your requirement because "Apple" comes before "apple". But then any lower-case letter will come after upper-case ones. Say "Apple" comes before "hello". This is wrong. So first we need a case-insensitive sorting. That is why that `toUpperCase`. However if both are same then we could just sort it via the default compare Java gives. So first if check for case-insensitive equality and sort in default method.
score: 0

http://stackoverflow.com/comment/37126371
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24074868
has text: @user3704229 - you web application is going to service this resource up to the client in a similar way that it serves up html pages or css etc.

http://stackoverflow.com/comment/37129880
score: 1
comment on: http://stackoverflow.com/q/24076819
type: Comment
type: QuestionComment
has text: If this is your actual code (and not a simplified version) you can tweak your query to `select distinct T1 from categories`.

http://stackoverflow.com/q/24034906
has title: Need my program to know where I left off
has body: So I'm trying to make clip card application. In other words, I'm making an application that counts how many coffees a customer purchases, and for every 10:th purchase the customer gets awarded a free one. I'm pretty much done with the loop, but I'm having difficulties with figuring out how to make my program remember where I left off. For example, lets say I have bought my 7th coffee and am leaving so I want to close the application; is there a way for the program to remember where to continue next time it is being run? Here's what I have so far: import java.util.Scanner; public class FelixNeww { public static void main(String [] args) { Scanner key; String entry; int count = 0; String password = "knusan01"; while(true) { System.out.println("Enter password: "); key = new Scanner(System.in); entry = key.nextLine(); if(entry.compareTo(password) == 0){ count++; System.out.println("You're one step closer to a free coffe! You have so far bought " + count + " coffe(s)"); } if(count == 10 &amp;&amp; count != 0){ System.out.println("YOU'VE GOT A FREE COFFE!"); count = 0; } if(entry.compareTo(password) != 0){ System.out.println("Wrong password! Try again.\n"); } } } } Thanks
tagged with: continue
has comment: http://stackoverflow.com/comment/37051874
score: 0
accepted answer: http://stackoverflow.com/a/24035247
linked to: http://stackoverflow.com/q/4564276
type: AnsweredQuestion
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/37052097
tagged with: memory
has comment: http://stackoverflow.com/comment/37051825
has comment: http://stackoverflow.com/comment/37052179
type: Question
has answer: http://stackoverflow.com/a/24035247
has comment: http://stackoverflow.com/comment/37052401
answer count: 1
has comment: http://stackoverflow.com/comment/37052077

http://stackoverflow.com/a/24256687
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/24038293
upvote count: 2
type: Answer
has body: In flume-env.sh add this: FLUME_CLASSPATH="/path/to/your/jar:/path/to/another/jar"

http://stackoverflow.com/q/24027959
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/37039584
tagged with: android
has comment: http://stackoverflow.com/comment/37039609
has comment: http://stackoverflow.com/comment/37039509
has answer: http://stackoverflow.com/a/24028362
has title: java.lang.NullPointerException with SeekBar and MediaPlayer
type: AnsweredQuestion
tagged with: java
tagged with: seekbar
type: Question
tagged with: android-mediaplayer
has body: I'm new in Android and I'm trying to run a seekbar while playing audio. I'm getting the error "Unable to start activity ComponentInfo: java.lang.NullPointerException" when I try to set the range of the progress bar with "setMax". This is my code: public class PlayerActivity extends Activity { private MediaPlayer mPlayer; private SeekBar mSeekBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } initVariables(); } public void initVariables(){ mPlayer = new MediaPlayer(); mPlayer = MediaPlayer.create(this, R.raw.raunchy); mPlayer.setOnCompletionListener(onCompletion); mSeekBar = (SeekBar) findViewById(R.id.seekBar1); mSeekBar.setMax(mPlayer.getDuration()); } private MediaPlayer.OnCompletionListener onCompletion = new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mPlayer) { mPlayer.release(); Log.d("FINAL", "CORRECTO"); } }; public void playOrPause(View v) { if (!mPlayer.isPlaying()) { mPlayer.start(); } else { mPlayer.pause(); } mHandler.postDelayed(mRunnable, 100); } private Handler mHandler = new Handler(); private Runnable mRunnable = new Runnable() { @Override public void run() { mSeekBar.setMax(mPlayer.getDuration()); if(mPlayer.isPlaying()){ int mCurrentPosition = mPlayer.getCurrentPosition() / 1000; mSeekBar.setProgress(mCurrentPosition); } mHandler.postDelayed(this, 1000); } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest…
answer count: 1
accepted answer: http://stackoverflow.com/a/24028362

http://stackoverflow.com/comment/37105711
type: QuestionComment
score: 1
has text: For strings in Java, you have to escape your literal backslashes with a backslash.
comment on: http://stackoverflow.com/q/24063818
type: Comment

http://stackoverflow.com/comment/37028562
comment on: http://stackoverflow.com/q/24022295
score: 0
type: Comment
type: QuestionComment
has text: the bean class posted at the top

http://stackoverflow.com/comment/36944109
type: Comment
comment on: http://stackoverflow.com/q/23977013
score: 1
type: QuestionComment
has text: Issue is that i did not added "Contact Email" in Settings->Basic

http://stackoverflow.com/a/24009697
has comment: http://stackoverflow.com/comment/37008081
has comment: http://stackoverflow.com/comment/37007848
score: 0
accepted answer of: http://stackoverflow.com/q/24008525
has comment: http://stackoverflow.com/comment/37007582
type: Answer
answers question: http://stackoverflow.com/q/24008525
has body: activeEditorInput is not a list so you can't use iterate. The editor input will be a class implementing IEditorInput not your object. Use something like: &lt;with variable="activeEditorInput"&gt; &lt;adapt type="org.eclipse.core.resources.IFile"&gt; &lt;test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.jdt.core.javaSource" /&gt; &lt;/adapt&gt; &lt;/with&gt; The adapt element uses the adapter manager to get the file from the editor input. The test is using the 'content type id' for the file - I have used the Java source file id here, you will have to define a content type id for your file type.
has comment: http://stackoverflow.com/comment/37007941
has comment: http://stackoverflow.com/comment/37010393
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37007745

http://stackoverflow.com/q/24007778
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37006848
has comment: http://stackoverflow.com/comment/37008682
has body: I am using an EJB which is running in JBOSS in a TOMCAT client. I have added the required jar files to run the EJB in the client application. But I am getting a marshallException (java.rmi.MarshalException). Client Program can call the webservice and it returns a proxy. But the Marshaling / Demarshaling performs is not understanding by me. What should I do to run the JBOSS EJB service in a Tomcat Client. I am not allowed to use OpenEJB or Apache TOMEE. I have to use Apache Tomcat 6.0.39. I am getting Caused by:java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is: java.io.OptionalDataException at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306) at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143) at org.jboss.remoting.Client.invoke(Client.java:525) at org.jboss.remoting.Client.invoke(Client.java:488) at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:184) at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68) at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101) at com.sun.proxy.$Proxy34.create(Unknown Source) .....
tagged with: java
tagged with: jboss
type: Question
tagged with: ejb
tagged with: tomcat
score: 0
has title: Run JBOSS EJB in Tomcat Client
answer count: 0

http://stackoverflow.com/q/23974773
tagged with: java
type: Question
downvote count: 0
has title: How can I work around this JRE bug in getNetworkPrefixLength()?
has body: There appears to be a known bug in the JRE implementation: http://bugs.java.com/view_bug.do?bug_id=6707289 https://bugs.openjdk.java.net/browse/JDK-7107883 But how can I fix it without updating the JRE/JDK? I need to get broadcast address, and use getBroadcast() for this, but it returns 0.0.0.0 (because getNetworkPrefixLength() returns -1, although the real network mask is 24).
upvote count: 1
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 1

http://stackoverflow.com/q/24046386
downvote count: 0
has body: Why does Throwable.class.getClassLoader() return null? Is there some hidden knowledge?
has answer: http://stackoverflow.com/a/24046411
accepted answer: http://stackoverflow.com/a/24046411
answer count: 1
favorite count: 0
has title: Why does Throwable.class.getClassLoader() return null?
tagged with: classloader
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/24014831
linked to: http://stackoverflow.com/q/21727101
has comment: http://stackoverflow.com/comment/37014701
has body: The area of the circle is defined as A = π . R2, having π as 3.14159. Calculate the area using the formula given in the problem description. Input: Read the variable R (double precision), that is the radius of the circle. Output: Print the variable A, rounded to four decimal digits. Sample Input : 2 Sample Output: A=12.5664 i have tried this , import java.util.Scanner; public class Area { public static void main(String a[]) { Double R,A; Scanner in=new Scanner(System.in); R=in.nextDouble(); A=3.14159*R*R; System.out.println("A="+(Math.round(A*1000.0)/10000.0)); } }
has title: How to round to 4 decial point in java?
has comment: http://stackoverflow.com/comment/37014542
has comment: http://stackoverflow.com/comment/37014466
duplicate of: http://stackoverflow.com/q/21727101
tagged with: java
linked to: http://stackoverflow.com/q/15352229
has answer: http://stackoverflow.com/a/24014872
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24014928
linked to: http://stackoverflow.com/q/153724
has comment: http://stackoverflow.com/comment/37014757
type: UnansweredQuestion

http://stackoverflow.com/a/24000292
has comment: http://stackoverflow.com/comment/36987673
type: Answer
has comment: http://stackoverflow.com/comment/36989707
has comment: http://stackoverflow.com/comment/36991418
has comment: http://stackoverflow.com/comment/36987759
score: 0
has comment: http://stackoverflow.com/comment/36991458
has comment: http://stackoverflow.com/comment/36987897
accepted answer of: http://stackoverflow.com/q/23999334
has comment: http://stackoverflow.com/comment/36987637
type: AcceptedAnswer
has body: To do this you need a class that extends AsyncTask. In this class in the method doInBackground you need to do all the "heavy" stuff. In your case populate your ListView. In case you want to show your progress you can call the publishProgress method at the end of each iteration. Finally in the method onPostExecute you can inform the user that the process finished. Here's a simple example public class ExampleAsync extends AsyncTask &lt;Void, Integer, Void&gt; { private ProgressDialog progressBar; //to show a little modal with a progress Bar private Context context; //needed to create the progress bar public ExampleAsync(Context context){ this.context = context; } //this is called BEFORE you start doing anything @Override protected void onPreExecute(){ progressBar = new ProgressDialog(context); progressBar.setCancelable(false); progressBar.setMessage("I am starting to look for stuff"); progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressBar.setIndeterminate(true); progressBar.show(); } //every time you call publishProgress this method is executed, in this case receives an Integer @Override protected void onProgressUpdate(Integer ... option){ progressBar.setMessage("I have found :" + option[0]); } @Override protected void onPostExecute(Void unused){ progressBar.dismiss(); //hides the progress bar //do whatever you want now } //in here is where you execute your php script or whatever "heavy" stuff you need @Override protected Void doInBackground(Void... unused) { for (int i = 0; i &lt; someLimit; i++){ //do something publishProgress(i); //to show the progress } } } And in your main activity: //code new ExampleAsync(this).execute(); Obviously this is a simple example. You can do lots of stuff in the onProgressUpdate method, and it's this method that you need to update the progress bar. Hope it helps
answers question: http://stackoverflow.com/q/23999334

http://stackoverflow.com/comment/37006153
score: 0
has text: can you please post your code where you create your fragments?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24009971

http://stackoverflow.com/q/24025530
has comment: http://stackoverflow.com/comment/37034792
duplicate of: http://stackoverflow.com/q/3481828
has title: Remove part of a string after a specific pattern in JAVA
upvote count: 0
has answer: http://stackoverflow.com/a/24025585
has body: i have this string: http://www.website.com/path/photo.jpg?resize=600%2C400 and i want to remove the part after the file type. With other words i want to get http://www.website.com/path/photo.jpg the file type that can exist are .jpg, .png, .gif any idea how can i implement this?
tagged with: string
favorite count: 0
type: Question
score: -1
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24027415
downvote count: 1
has comment: http://stackoverflow.com/comment/37034878
tagged with: photo
linked to: http://stackoverflow.com/q/3481828
has comment: http://stackoverflow.com/comment/37034922
type: UnansweredQuestion
tagged with: comparison

http://stackoverflow.com/comment/36946743
has text: as an added corollary your own protobuf serialization format has reference tracking, so there's obviously demand ...
comment on: http://stackoverflow.com/a/23978265
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23989930
answer count: 1
tagged with: elasticsearch
favorite count: 0
accepted answer: http://stackoverflow.com/a/24014053
has title: Elasticsearch 1.3. - Call custom REST endpoint from Java
has body: I am currently building an elasticsearch plugin which exposes a REST endpoint ( starting from this post ) I can call my endpoint with curl like this : curl -X POST 'http://my-es:9200/lt-dev_terminology_v1/english/_terminology?pretty=-d '{ "segment": "database", "analyzer": "en_analyzer" } My question is how can I call the same endpoint from java, using a transport client ? Could you point me to some tutorial ?
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/24014053
tagged with: rest

http://stackoverflow.com/a/24096225
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37166819
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24096061
has comment: http://stackoverflow.com/comment/37167117
accepted answer of: http://stackoverflow.com/q/24096061
has comment: http://stackoverflow.com/comment/37167131
type: AcceptedAnswer
has body: You should separate three concerns of your code: Your actual turn structure, where turns can end and new turns can begin, the game's user interface, where he can press the button, and the game's timing logic. In your turn structure class, you would have a startNextTurn method that cancels a possible pending timer and starts a new one. In your user interface class, you would call that method - don't do the timer logic in the user interface, let the turn structure do it. Instead of using a Timer directly, encapsulate it into a class that provides two methods: cancelTimer and startTimer; the timer going off would call startNextTurn. Depending on your needs, you could even combine them into a restartTimer method. When designing these units of abstractions, think of these issues: What kind of data and logic belongs together? What does an operation have to do to be complete? For example, starting a new turn is only complete when the timer is started, so it needs to be encapsulated by a method, and the two events (user input and timer) that trigger a new turn will both reuse the same logic.
has comment: http://stackoverflow.com/comment/37166910

http://stackoverflow.com/comment/36956855
type: Comment
has text: I would say that you use that function so much that this level of tuning is needed/desirable, maybe you would be better off dropping lambdas and implementing the function directly, which gives more room for other optimizations.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23983832

http://stackoverflow.com/q/24030061
downvote count: 0
has title: Java Eclipse-GEF Editor: Add mouse listener on elements
tagged with: eclipse-gef
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37044328
upvote count: 1
has comment: http://stackoverflow.com/comment/37044360
linked to: http://stackoverflow.com/q/7132321
score: 1
tagged with: java
has body: I have taken over an eclispe project with a GEF Editor where various items can be created into the editor. My task is to do soemthing if a double click occures on one of those items. I have no knowledge about GEF in any way. How do I register a listener on an item put into the GEF editor? I'm trying to make my way through the source code but I get lost to easy. Do I need a policy for that?
has comment: http://stackoverflow.com/comment/37046600
type: Question
duplicate of: http://stackoverflow.com/q/7132321

http://stackoverflow.com/q/23989012
has title: Get unix timestamp value from only year in android
tagged with: java
has answer: http://stackoverflow.com/a/53464576
has answer: http://stackoverflow.com/a/23989079
type: Question
upvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/53462796
has comment: http://stackoverflow.com/comment/36965978
has comment: http://stackoverflow.com/comment/36966197
favorite count: 0
has comment: http://stackoverflow.com/comment/36966071
tagged with: android
has comment: http://stackoverflow.com/comment/36966147
tagged with: unix
score: 2
downvote count: 0
type: UnansweredQuestion
has body: How to get Unix timestamp value only for particular year. I have a situation where in server side for DOB i store only year. So in android i take Age value and then subtract current year with the age and send that year to server. To send that year i need to convert to Unix timestamp because in server side it stores in Unix timestamp format. Somebody please help what can be done. I saw some links which uses getTime() and divide it by 1000. But that would be whole year with date and month.

http://stackoverflow.com/comment/75101242
has text: I like the suggestion of wrapping the reader. One problem I can see is the reader interface returns a single item so if the OP reads one `NewsletterSubscriber` with the inner read and needs the outer reader to return multiple `Account`s, he can't just return them all. He'll have to manage the backlog and return them one at a time. Or am I missing something?
comment on: http://stackoverflow.com/a/24005253
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37003648
has text: @JqueryLearner why null? it's already filled with nextentry if you read the code carefully
type: QuestionComment
comment on: http://stackoverflow.com/q/24008831
type: Comment
score: 0

http://stackoverflow.com/comment/37139408
has text: Yup, that was somewhat incidental - but it sounds like you still need more diagnostics. Are you *sure* the problem is on `floattwo` rather than `floatone`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24080077
score: 0

http://stackoverflow.com/comment/36981477
type: QuestionComment
has text: sorry the onLightClicked is just a button with a light bulb on it which brings up the lights activity(2nd xml)
comment on: http://stackoverflow.com/q/23996958
score: 0
type: Comment

http://stackoverflow.com/q/24072753
has answer: http://stackoverflow.com/a/64996828
upvote count: 24
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24072942
tagged with: java
type: Question
answer count: 2
downvote count: 0
favorite count: 0
tagged with: retrofit
has answer: http://stackoverflow.com/a/24072942
score: 24
has title: Declaring a retrofit REST endpoint with constant query value
possible better answer: http://stackoverflow.com/a/64996828
has body: So I want to get the metadata of a youtube video (say this one: https://www.youtube.com/watch?v=qlTA3rnpgzU). I'm going to encode it and wrap it in another url like so: http://www.youtube.com/oembed?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqlTA3rnpgzU&amp;format=json My interface definition will look like this: public interface YoutubeApi { @GET ("oembed") YoutubeMetaData metaData (@Query (QUERY_VIDEO_URL) final String url, @Query(QUERY_FORMAT) final String alwaysJson); } That's all fine and dandy, but I don't ever want to specify any format other than JSON here (format=json is a fixed part of this url). Is there a way to specify this in my interface declaration and reduce my interface to: public interface YoutubeApi { @GET ("oembed") @Magic ("format=json") YoutubeMetaData metaData (@Query (QUERY_VIDEO_URL) final String url); } Thanks.

http://stackoverflow.com/q/23987588
has comment: http://stackoverflow.com/comment/37012505
type: UnansweredQuestion
tagged with: wicket
has comment: http://stackoverflow.com/comment/37012392
tagged with: openwebbeans
has comment: http://stackoverflow.com/comment/37018266
upvote count: 4
has comment: http://stackoverflow.com/comment/37011023
has title: Deploying Wicket CDI on TomEE with OWB
tagged with: java
has answer: http://stackoverflow.com/a/24144550
has comment: http://stackoverflow.com/comment/36974321
has body: I’m facing a problem when trying do deploy on TomEE (using OWB). I’m getting the following exception: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [org.apache.wicket.cdi.AutoConversation] is not found with the qualifiers Qualifiers: [@javax.enterprise.inject.Default()] for injection into Field Injection Point, field name : autoConversation, Bean Owner : [null] at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:60) at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:250) at org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:76) at org.apache.webbeans.inject.InjectableField.doInjection(InjectableField.java:65) at org.apache.webbeans.portable.InjectionTargetImpl.injectFields(InjectionTargetImpl.java:372) at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:358) at org.apache.webbeans.portable.InjectionTargetImpl.inject(InjectionTargetImpl.java:342) at org.apache.wicket.cdi.NonContextual.postConstruct(NonContextual.java:129) at org.apache.wicket.cdi.NonContextualManager.postConstruct(NonContextualManager.java:65) at org.apache.wicket.cdi.ConversationPropagator.(ConversationPropagator.java:122) at org.apache.wicket.cdi.CdiConfiguration.configure(CdiConfiguration.java:188) … I’ve been looking for information online, but there seems to be nothing on it. I have the seam-conversation-spi and seam-conversation-owb jars on my classpath, so that’s not a dependency issue (had some of those, but got over them). I understand from other people that deploying an EAR with wicket-cdi on other application servers is very easy and straightforward. However, I really like TomEE (the whole "based on TomCat" concept), and wouldn't want to have to switch. I'm at a loss here, does anyone have a clue on what's going on ? Edit 1: This is the contents of my application class init method: public void init() { super…
type: Question
has comment: http://stackoverflow.com/comment/36975091
downvote count: 0
has comment: http://stackoverflow.com/comment/36974674
score: 4
tagged with: apache-tomee
has comment: http://stackoverflow.com/comment/36975016
answer count: 1
favorite count: 0
tagged with: cdi
has comment: http://stackoverflow.com/comment/37024562

http://stackoverflow.com/a/24042387
upvote count: 1
answers question: http://stackoverflow.com/q/24041869
has comment: http://stackoverflow.com/comment/37068976
has comment: http://stackoverflow.com/comment/37068024
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The ROOT logger is created with a level of DEBUG. When a child logger is created, its effective logging level is set to that of its parent. Also, isDebugEnabled() checks if the effective logging level of the Logger (an int value) is &gt;= to the value of DEBUG. In this case, it is equal since it is inherited from ROOT. In the example where you don't have a logger declared, it also doesn't have any appenders. The message gets constructed but there's no where to log it to. So while the debug level does get satisfied, it doesn't log anywhere. In newer versions of logback, it appears the log message construction is done after appenders are checked.
accepted answer of: http://stackoverflow.com/q/24041869
score: 1

http://stackoverflow.com/a/24026880
has comment: http://stackoverflow.com/comment/37039144
has body: I think you can do what you want by subtracting 5 hours from the time and using that as the date for comparison. That way, 4:00 a.m. will be in the same "day" as 11 p.m. of the date before. I think the following does this in SQLite: SELECT tdate, qty, shift, (SELECT sum( b.qty ) FROM table1 AS b WHERE b.id &lt;= a.id AND b.shift = a.shift and date(b.tdate, '-5 Hours') = date(a.tdate, '-5 Hours') ) AS bo_total FROM table1 AS a ORDER BY date(a.tdate ) ASC, a.shift ASC;
has comment: http://stackoverflow.com/comment/37041592
has comment: http://stackoverflow.com/comment/37037510
score: 0
answers question: http://stackoverflow.com/q/24026747
has comment: http://stackoverflow.com/comment/37039152
type: Answer

http://stackoverflow.com/q/24057816
answer count: 2
has body: I have worked in some web project based in Spring Framework, and I always find the same PMD/Checkstyle problems cause of complexity level :(. Here an easy example: We define the parent class. public Class ObjectA(){ private ObjectB objectB; public ObjectB getObjectB(){ return objectB; } } Second we defined the child class. public Class ObjectB(){ private String str; public String getStr(){ return str; } } Now I get from a ObjectA the value of String "str", only if not is empty, but I have to check that all object are not nulls. First Solution (4 conditions) if(objectA != null &amp;&amp; objectA.getObjectB() != null &amp;&amp; objectA.getObjectB().getStr() != null &amp;&amp; !objectA.getObjectB().getStr().isEmpty()){ // Do something... } Second solution with StringUtils from Spring (3 conditions) if(objectA != null &amp;&amp; objectA.getObjectB() != null &amp;&amp; StringUtils.hasText(objectA.getObjectB().getStr())){ // Do something... } I want to know if exists some method in Spring to check if ObjectB in ObjectA is not null, and the method must check that ObjectA is not null too. Thanks!!!
tagged with: checkstyle
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24058063
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24057945
tagged with: pmd
has title: Tedious Checkout (Solution with Spring)
score: 0

http://stackoverflow.com/comment/37003221
has text: it's just a snippet, I do that later on. As I said if i leave the second row out, there is no issue with the general structure. It's only adding the second row that gives me issues.
type: Comment
comment on: http://stackoverflow.com/a/23990966
score: 0
type: AnswerComment

http://stackoverflow.com/q/24011457
has comment: http://stackoverflow.com/comment/37008080
has answer: http://stackoverflow.com/a/24011558
downvote count: 1
has comment: http://stackoverflow.com/comment/37008162
type: AnsweredQuestion
tagged with: java
has body: Consider the following code: public class MainClass { public static void main(String[] args) { ArrayList&lt;HashMap&lt;String, Integer&gt;&gt; collection = new ArrayList&lt;&gt;(); ArrayList&lt;HashMap&lt;String, Integer&gt;&gt; outCollecttion = &lt;String, Integer, HashMap&lt;String, Integer&gt;, ArrayList&lt;HashMap&lt;String, Integer&gt;&gt;&gt;doSomeWork(collection); } public static &lt;V extends Object, U extends Object, K extends Map&lt;V, U&gt;, J extends Collection&lt;K&gt;&gt; Collection&lt;K&gt; doSomeWork(J collection) { Collection&lt;K&gt; result = new ArrayList&lt;&gt;(); for (K element : collection) { result.add(element); //here is supposed other code, this is just example } return result; } } I want to do some work on a generic collection that contains map of some generic types. I know that Java has hard time figuring complex generic expressions, so I put explicit types before method call: &lt;String, Integer, HashMap&lt;String, Integer&gt;, ArrayList&lt;HashMap&lt;Integer, String&gt;&gt;&gt;doSomeWork(collection) But compiler will not compile that. I do understand that it might have something to do with the fact that I'm trying to use generic type in generic type, but I don't know how to write this method without using casts and than deprecating warnings (I usually compile with -Xlint:unchecked flag).
accepted answer: http://stackoverflow.com/a/24011654
type: Question
answer count: 2
has title: Java generic method call
favorite count: 0
score: 0
tagged with: generics
has answer: http://stackoverflow.com/a/24011654
possible better answer: http://stackoverflow.com/a/24011558
upvote count: 1

http://stackoverflow.com/comment/37146161
score: 0
type: AnswerComment
type: Comment
has text: Following [this](http://stackoverflow.com/questions/19550514/selenium-unhandledalertexception-was-unhandled) and [this](https://groups.google.com/forum/#!topic/webdriver/QhZyaAzEk3c), how about something like `try { sleep(10000); } except (UnandledAlertException) { // run your test }`? Also, consider grabbing the `IAlert` object and working with that. It looks like [someone else has had a similar issue](https://code.google.com/p/selenium/issues/detail?id=4986).
comment on: http://stackoverflow.com/a/24085546

http://stackoverflow.com/a/24097882
upvote count: 1
score: 1
downvote count: 0
has body: you should write you Java code in the src directory. You will need to navigate to src/your.package.name/ActivityName.java. Each activity will need it's own java file in the same place. For example the default path would be: src/com.example.helloworld/MainActivity.java
answers question: http://stackoverflow.com/q/24097804
type: Answer

http://stackoverflow.com/a/23971671
has comment: http://stackoverflow.com/comment/36934094
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23971629
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23971629
type: Answer
has body: It's quite simple. read() blocks until data is available in the stream, or the stream is closed The server sends bytes to the stream, but never closes it, so the client reading from this stream doesn't have any way to know if some more data will come or not, so it blocks. Close the stream at server-side, or design a protocol allowing the client to know when to stop reading (like for example sending the number of bytes in the file, then sending these bytes).
has comment: http://stackoverflow.com/comment/36933987
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36934025
has comment: http://stackoverflow.com/comment/36933941
has comment: http://stackoverflow.com/comment/36937688
has comment: http://stackoverflow.com/comment/36934141

http://stackoverflow.com/comment/36975987
type: Comment
has text: It does not give me any information... If you want help, don't say "I have problem" but **explain** your problem.
comment on: http://stackoverflow.com/a/23993397
type: AnswerComment
score: 0

http://stackoverflow.com/q/23990317
possible better answer: http://stackoverflow.com/a/23990373
downvote count: 0
tagged with: ide
has answer: http://stackoverflow.com/a/23990373
has comment: http://stackoverflow.com/comment/40636086
has body: I just built a game in Java, and I want to make it so that it can be opened on any other computer without using an IDE or command line or something of the like. Basically, I want it to be like those computer games you download from the internet and start playing. I'm sorry if this is a stupid question (or an impossible question), but english is my second language and I don't know any other way to put it. Basically, I've gotten pretty good at making video games, and I'm about done with my game, but I don't know how to make it so the game can run without an IDE. Namely, I want my little brother to be able to double click on an icon which will cause the game to start up. Now, just approaching this logically, I'd assume whatever computer the game will be running on will need to have Java downloaded (like the JDK) or something, and I'm ok with that. I just want to be able to give someone who doesn't speak or read english a simple icon to double click on and play a game. If this is impossible without some industry grade developers, please let me know, since I know some of the bigger games out their use their own version of a language to make the game work. I just want to know if this is possible for someone like me to do, and if so, how. Thank you for your time!
has answer: http://stackoverflow.com/a/23990416
has comment: http://stackoverflow.com/comment/40391922
type: Question
has comment: http://stackoverflow.com/comment/36968359
score: 1
has answer: http://stackoverflow.com/a/23990379
favorite count: 0
linked to: http://stackoverflow.com/q/5258159
has comment: http://stackoverflow.com/comment/36968314
accepted answer: http://stackoverflow.com/a/23990379
upvote count: 1
duplicate of: http://stackoverflow.com/q/5258159
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/36968312
has title: How do I build/deploy a Java program so that anyone can open it without an IDE or Command Line?
type: AnsweredQuestion

http://stackoverflow.com/a/24089138
downvote count: 0
has body: The code below worked for me. There were three issues that I fixed: I added a check for spaces to your regular expression. I added a check for punctuation to your regular expression. I pasted the string from your comment into the string in your code. They weren't the same! Here's the code: public static void main(String[] args) { String s = "பாரதீய ஜனதா இளைஞர் அணி தலைவர் அனுராக்சிங் தாகூர் எம்.பி. நேற்று தேர்தல் ஆணையர் வி.சம்பத்"; List&lt;String&gt; characters = new ArrayList&lt;String&gt;(); Pattern pat = Pattern.compile("\\p{P}|\\p{L}\\p{M}*| "); Matcher matcher = pat.matcher(s); while (matcher.find()) { characters.add(matcher.group()); } // Test if we have the right characters and length int i = 1; for (String character : characters) { System.out.println(String.format("%d = [%s]", i++, character)); } System.out.println("Characters Size: " + characters.size()); } It's probably worth pointing out that your code is remarkably similar to the solution for this SO. One comment on that solution in particular led me to discover the missing check for punctuation in your code and allowed me to notice that the string from your comment didn't match the string in your code.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24074485
score: 1

http://stackoverflow.com/a/24080754
score: 1
accepted answer of: http://stackoverflow.com/q/24080710
answers question: http://stackoverflow.com/q/24080710
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Because Postfix Operator has more precedence over prefix operator. the advantage of having a simple and well-memorizeable precedence list in which all postfix operators come before any of the prefix operators is sufficient to tolerate the minor drawback of always having to use parentheses to compose pre- and postfix operators ++/--, as this composition is used very seldom.

http://stackoverflow.com/q/24055105
has answer: http://stackoverflow.com/a/24055219
has comment: http://stackoverflow.com/comment/37089699
has comment: http://stackoverflow.com/comment/37089937
tagged with: java
downvote count: 3
tagged with: jpanel
linked to: http://stackoverflow.com/q/24024888
type: Question
has comment: http://stackoverflow.com/comment/37089857
answer count: 2
has comment: http://stackoverflow.com/comment/37089774
upvote count: 0
has answer: http://stackoverflow.com/a/24055411
score: -3
tagged with: class
has comment: http://stackoverflow.com/comment/37090935
favorite count: 0
has title: How to reference the class fromasubclass
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/37089906
has body: I am trying to find the answer but I can't. In java, when I create a subclass, how can I reffer the first level class? Using "this" accesses the subclass so I can't. The other option is passing the argument to the subclass but I'm curious if there is a simpliest method. //here there is my other 1st level class implementation, this is a JFrame btnNewProject.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { VehicleScreen pp=new VehicleScreen(**here should go the top class reference**); //v is a JPanel that I pass to allJframes v.setContentPane(pp); v.setVisible(true); } });

http://stackoverflow.com/a/29573232
has comment: http://stackoverflow.com/comment/48869726
has comment: http://stackoverflow.com/comment/47295697
has body: If you are using Eclipse:(1) Select: (Your Project) -> Properties -> JPA; (2) Look for "Persistent class management" and select the option "Discover annotated classes automatically"; (3) Press "Apply".
upvote count: 58
downvote count: 0
has comment: http://stackoverflow.com/comment/60477789
has comment: http://stackoverflow.com/comment/104747355
score: 58
type: Answer
answers question: http://stackoverflow.com/q/24040208

http://stackoverflow.com/q/23964331
has answer: http://stackoverflow.com/a/23964824
tagged with: palette
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36921782
tagged with: image
has comment: http://stackoverflow.com/comment/36928935
score: 0
answer count: 1
type: UnansweredQuestion
has body: I'm developing a Java component for displaying some videos and for each frame of the video, my decoder gives me a Color[256] palette + a width*height bytes pixel indices array. Here's how I create my BufferedImage right now: byte[] iArray = new byte[width * height * 3]; int j = 0; for (byte i : this.lastFrameData) { iArray[j] = (byte) this.currentPalette[i &amp; 0xFF].getRed(); iArray[j + 1] = (byte) this.currentPalette[i &amp; 0xFF].getGreen(); iArray[j + 2] = (byte) this.currentPalette[i &amp; 0xFF].getBlue(); j += 3; } DataBufferByte dbb = new DataBufferByte(iArray, iArray.length); ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] { 8, 8, 8 }, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); return new BufferedImage(cm, Raster.createInterleavedRaster(dbb, width, height, width * 3, 3, new int[] { 0, 1, 2 }, null), false, null); This works but it looks ugly and I'm sure there is a better way. So what would the fastest way to create the BufferedImage be then? /Edit: I've tried using the setRGB method directly on my BufferedImage but it resulted in worse performance than the above. Thanks
has title: Best way to create Image from palette Color array + indice byte array?
tagged with: indices

http://stackoverflow.com/comment/36962424
type: AnswerComment
has text: @AliJafar that is not possible. You must have App context for display AlertDialog.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23979198

http://stackoverflow.com/comment/36930475
type: AnswerComment
comment on: http://stackoverflow.com/a/23969451
type: Comment
has text: check this http://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/Query.html method with signature above
score: 1

http://stackoverflow.com/comment/36984372
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23994187
has text: Are you sure, the request is `application/x-www-form-urlencoded`? Usually, data like XML is NOT sent via HTTP that way.
type: AnswerComment

http://stackoverflow.com/comment/36926456
comment on: http://stackoverflow.com/q/23967235
type: Comment
has text: One method to do this would be to use `spring-aop` to create a pointcut at your repository layer where you inspect passed-in values to the repository for your annotation (using normal reflection) and insert the encrypted value into the field.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23977968
upvote count: 2
type: AcceptedAnswer
has body: Based on this my problem had been solved. For a workaround add the following to the end of your eclipse.ini -Dorg.eclipse.swt.browser.DefaultType=mozilla
accepted answer of: http://stackoverflow.com/q/23973188
type: Answer
answers question: http://stackoverflow.com/q/23973188
score: 2
downvote count: 0

http://stackoverflow.com/a/23978923
has comment: http://stackoverflow.com/comment/36947675
has comment: http://stackoverflow.com/comment/36951691
score: 0
answers question: http://stackoverflow.com/q/23978277
has comment: http://stackoverflow.com/comment/36952212
accepted answer of: http://stackoverflow.com/q/23978277
has comment: http://stackoverflow.com/comment/36947407
has comment: http://stackoverflow.com/comment/36947720
has comment: http://stackoverflow.com/comment/36951301
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36953736
has comment: http://stackoverflow.com/comment/36952580
has comment: http://stackoverflow.com/comment/36953125
has comment: http://stackoverflow.com/comment/36952427
has body: You have to run the code that is changing the position in the render() method, other wise it changes only once. Unless if you are changing the position elsewhere. Show the code that changes the position to get a better answer
type: Answer

http://stackoverflow.com/comment/37121050
comment on: http://stackoverflow.com/q/24051445
score: 0
type: Comment
type: QuestionComment
has text: As I have said before I don't really have any experience with Jongo and also a lack of time to try out some examples, but if you have a MongoDB 2.6 or greater version then this manual section on [Bulk Update](http://docs.mongodb.org/manual/reference/command/update/#bulk-update) may be of interest. I have posted a few answers on the usage, and there should be a way for you to at least get to the raw database object from the Java driver in order to use the required `runCommand` version of this. Or possibly other bulk update API exposed by your Java driver if it is a recent release.

http://stackoverflow.com/comment/43183497
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23996352
score: 0
has text: Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts).

http://stackoverflow.com/a/23950575
score: 0
has comment: http://stackoverflow.com/comment/37053360
type: Answer
answers question: http://stackoverflow.com/q/23949924
has body: You can use opencsv. It is a csv parser library for Java.

http://stackoverflow.com/comment/36923253
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23965490
has text: This indirectly fixes my problem

http://stackoverflow.com/q/23962993
has comment: http://stackoverflow.com/comment/36918438
upvote count: 9
has body: i just started learning spring and i would like to use 4.0.4.RELEASE version - it's actually the newest version offered by maven repository, so my question's here: if i add dependency like this: org.springframework spring-context 4.0.4.RELEASE -it automatically adds all of the "basic" modules like context, core, aop, beans, expression into my project, but for example if i add dependency like this: org.springframework spring-core 4.0.4.RELEASE -it will only add the spring-core jar file into my project, can anyone explain me why it is like it is? Because i'm learning from tutorial and in the tutorial, the guy added both of these dependencies -> spring-core and spring-context, why he did it? he should add just spring-context dependency and the result would be the same, can anyone explain? thanks :)
has comment: http://stackoverflow.com/comment/80990654
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23963418
favorite count: 0
linked to: http://stackoverflow.com/q/10037450
type: Question
score: 9
has comment: http://stackoverflow.com/comment/36918706
answer count: 2
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/36918040
has answer: http://stackoverflow.com/a/23963382
tagged with: java
possible better answer: http://stackoverflow.com/a/23963382
has title: understanding spring 4 (spring-context) maven dependency
accepted answer: http://stackoverflow.com/a/23963418

http://stackoverflow.com/a/24014656
has comment: http://stackoverflow.com/comment/37015449
type: Answer
has comment: http://stackoverflow.com/comment/37015409
has comment: http://stackoverflow.com/comment/37015400
has comment: http://stackoverflow.com/comment/37015124
has comment: http://stackoverflow.com/comment/37014837
has comment: http://stackoverflow.com/comment/37015017
has body: You are following a wrong package structure. Remove that matrix folder and create the package matrix in src. Now include processing-core.jar Then do a clean built and it should work. It may ask for other dependant jars. Whenever a new project is created its advisable to use maven because a single dependency entry will include all dependant jar files required.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24014462
has comment: http://stackoverflow.com/comment/37014955
has comment: http://stackoverflow.com/comment/37014935
has comment: http://stackoverflow.com/comment/37015327
answers question: http://stackoverflow.com/q/24014462
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24099120
has comment: http://stackoverflow.com/comment/37171553
has comment: http://stackoverflow.com/comment/37171573
score: 7
answers question: http://stackoverflow.com/q/24099055
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24099055
type: AcceptedAnswer
downvote count: 0
has body: The definition of a week depends on what each Locale (country, region, whatever) defines as the first day of the week. You can check that with Calendar#getFirstDayOfWeek(). It also depends on what it considers the minimal days in the first week should be. You can get that with Calendar#getMinimalDaysInFirstWeek(). Your Locale seems to show that it needs more than one day to consider that period a week. For example, with Locale.CANADA, I get 6 weeks since the getMinimalDaysInFirstWeek() returns 1.
type: Answer

http://stackoverflow.com/comment/37174524
score: 0
type: Comment
type: QuestionComment
has text: This isn't clear. If you swap the lines around, your output should be in a different order. Please post the *real* output.
comment on: http://stackoverflow.com/q/24100603

http://stackoverflow.com/comment/93287388
type: QuestionComment
comment on: http://stackoverflow.com/q/24029998
has text: @bandeesh-r-sirga In case this is an XY question and you're actually just trying to get things working with Selenium, you need to re-find the element once it's stale. If you get a StaleElementException, driver.findElement(By) again and the element will no longer be stale. Elements go "stale" if the DOM tree changes at that node or above it in the hierarchy. Would finding the element again suit your needs, or do you absolutely have to deal with the same stale element that you originally found?
score: 0
type: Comment

http://stackoverflow.com/comment/37203674
comment on: http://stackoverflow.com/a/24037787
type: AnswerComment
score: 0
has text: Here http://stackoverflow.com/questions/24115722/jasperreports-5-6-0-and-hibernate-4-nosuchfielderror-boolean I've described another one problem.
type: Comment

http://stackoverflow.com/a/24011036
answers question: http://stackoverflow.com/q/24010987
has comment: http://stackoverflow.com/comment/37007512
type: Answer
downvote count: 0
score: 1
has body: You should create a new map for each menuItem. In the example below, I moved the map initializer to the for loop: public ArrayList&lt;Map&lt;String, String&gt;&gt; XMLToArray(String Data, Document Doc, XMLParser file) { ArrayList&lt;Map&lt;String, String&gt;&gt; menuItems = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); for(int i = 0; i &lt; Doc.getElementsByTagName("item").getLength();i++) { Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); Element e = (Element)Doc.getElementsByTagName("title").item(i); Element e2 = (Element)Doc.getElementsByTagName("description").item(i); //Element e3 = (Element)Doc.getElementsByTagName("link").item(i); map.put("titre", file.getElementValue(e)); map.put("description", file.getElementValue(e2)); //map.put("lien", file.getElementValue(e3)); // adding HashList to ArrayList menuItems.add(map); } return menuItems; }
has comment: http://stackoverflow.com/comment/37007986
upvote count: 1

http://stackoverflow.com/q/23943898
score: -1
tagged with: return
has title: The Return value is not true in arraylist of android App
has answer: http://stackoverflow.com/a/23943943
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: This function returns two objects TMBase.customer@40fb1588, TMBase.customer@40fb1ad8, but I need to return these values emy, samera. I need to know what is the problem? public ArrayList&lt;TMBase.Customer&gt; GetWorkerNameOfCustomerByID( int LineID) { ArrayList&lt;TMBase.Customer&gt; CustomerArr = new ArrayList&lt;TMBase.Customer&gt;(); connecttodatabase qq = new connecttodatabase(); qq.dbconnect(); if (qq.con != null) { String result = ""; ResultSet rs = null; try { CallableStatement cstmt = null; Statement st = qq.con.createStatement(); cstmt = qq.con.prepareCall("{CALL GetWorkerNameOfCustomerByID(?)}"); cstmt.setInt(1, LineID); rs = cstmt.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()) { TMBase.Customer CustomerObj=new TMBase.Customer(); CustomerObj.setWorkerName(rs.getString("WorkerName")); CustomerArr.add(CustomerObj); } } catch (SQLException e) { e.printStackTrace(); } qq.closeConnection(); } return CustomerArr; } Customer class: package TMBase; public class Customer { private int ID; private int LineId; private int WorkerId; private Timestamp DateSubscribe; private String WorkerName; public int getID() { return this.ID; } public int setID(int ID){ return this.ID = ID; } ////////////////////////////////////////////// public int getLineId() { return this.LineId; } public int setLineId(int LineId){ return this.LineId = LineId; } ////////////////////////////////////////////// public int getWorkerId() { return this.WorkerId; } public int setWorkerId(int WorkerId){ return this.WorkerId = WorkerId; } /////////////////////////////////////////////// public Timestamp getDateSubscribe() { return this.DateSubscribe;`enter code here` } public Timestamp setDateSubscribe(Timestamp DateSubscribe){ return this.DateSubscribe = DateSubscribe; } /////////////////////////////////////////////// public String getWorkerName() { return this.WorkerName; } public String setWorkerName(String WorkerName){ return this.WorkerName = WorkerName; } }
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23943943
tagged with: arraylist
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/37008737
comment on: http://stackoverflow.com/q/24011096
score: 0
type: Comment
type: QuestionComment
has text: its about the issue with the jar files . for JAVA Sockets , i included requiered jar files but event though i am getting error as "specified package is not there" . I also tried with different versions of awake-file and awake-sql ect . So please let me know if anybody want further information .

http://stackoverflow.com/comment/37069270
type: QuestionComment
comment on: http://stackoverflow.com/q/24043734
score: 0
type: Comment
has text: Would you please post a code sample?

http://stackoverflow.com/comment/37181459
type: QuestionComment
comment on: http://stackoverflow.com/q/24103791
has text: you may prepare Voronoi diagram over all points, and then check which region the inspected point falls to
score: 0
type: Comment

http://stackoverflow.com/q/24016513
answer count: 0
type: UnansweredQuestion
has body: I am writing a listener to shell events in Java. I have a codesnippet which looks like this: Listener shellListener = new Listener() { @Override public void handleEvent(Event event) { if (event == null || event.widget == null) { return; } // do some other stuff } } Sometimes I got a null event or the widget of the event object is null. For now, I catch them manually. But my question is: How can a null event or the widget of an event be null? I am using Eclipse and reproducing it (to further investigate the reason) is not so easy as I thought.
has comment: http://stackoverflow.com/comment/37017775
has title: Java swt handleevent event sometimes null
tagged with: events
tagged with: listener
type: Question
score: 0
tagged with: swt
has comment: http://stackoverflow.com/comment/37017495
has comment: http://stackoverflow.com/comment/37017857
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/37021940
comment on: http://stackoverflow.com/q/24018838
has text: Your FOR loop iterates over each character of the String. If it finds a number, it exits. But do you see what happens if it doesn't find a number?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37001098
score: 0
type: AnswerComment
has text: I need to calculate unique lines in the file.
type: Comment
comment on: http://stackoverflow.com/a/24007630

http://stackoverflow.com/q/24096685
has comment: http://stackoverflow.com/comment/37231265
type: Question
has comment: http://stackoverflow.com/comment/37169031
tagged with: java
has comment: http://stackoverflow.com/comment/37212928
has title: problems with drawing a graph through graphviz java api
tagged with: graphviz
has comment: http://stackoverflow.com/comment/37168570
has comment: http://stackoverflow.com/comment/37167968
has comment: http://stackoverflow.com/comment/37222770
score: 0
has body: I am working on a project that requires drawing graphs from .dot files through Graphviz. I have downloaded the Java API from the Graphviz site (http://www.loria.fr/~szathmar/off/projects/java/GraphVizAPI/index.php), but it doesn't seem to work. I changed the code a bit, specifically changing the variable that holds the location of the temp file to hold System.getProperty("java.io.tmpdir"), and I changed the variable that holds the location of the dot exe file to the location of the file on my computer. When I run my code, the program stops showing progress (yet does not terminate), and running it in debug shows that is "stops" because it is waiting for the end of the exec command that draws the graph from the dot file. What problem could there be that stops my code from running? The code I'm running is basically the same as the example code in the comments at the start of the API file, with the onlt difference being that I'm loading a premade dot file and not creating a new dot source.
has comment: http://stackoverflow.com/comment/37226016
has comment: http://stackoverflow.com/comment/37169443
has comment: http://stackoverflow.com/comment/37216909
has comment: http://stackoverflow.com/comment/37208856
answer count: 0
linked to: http://stackoverflow.com/q/21903326
type: UnansweredQuestion

http://stackoverflow.com/q/24072803
score: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37122765
type: Question
has body: I'm developer and game developers use my library in their apps only a single developer reported a runtime Abstract method error crash issue on Android device and when i looked into the proguard mapping on where its happenig it's pointing to Line 68 in this class org.bson.util.AbstractCopyOnWriteMap. Crash Report: Fatal Exception: java.lang.AbstractMethodError abstract method "java.util.Map com.mypackage.sdk.impl.bf.a(java.util.Map)" com.mypackage.sdk.impl.bf. (SourceFile:68) Proguard Mapping : org.bson.util.AbstractCopyOnWriteMap -&gt; com.mypackage.sdk.impl.bf: java.util.Map delegate -&gt; a The weird part is, it doesn't happen everytime it randomly happens and i noticed it only on Android 4.4.2 platform and only that developer reported it. Does anybody have an idea on why its crashing ? It's different from the normal Abstract Method error crash, mostly its a compile time issue, but it can happen @ runtime if the jars not getting packaged properly, but thats not seems to be the issue here. It will be helpful if someone can provide an insight on how to debug this one.
has comment: http://stackoverflow.com/comment/37122673
tagged with: abstract-methods
has title: Abstract method error runtime crash

http://stackoverflow.com/a/23976488
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36942606
answers question: http://stackoverflow.com/q/23976431
type: Answer
has body: else if (xPos == 220) is useless. :) because you are using loop upto 219 as xPos&lt;220 so change it to xPos&lt;=220 catch (InterruptedException e) { } you are swallowing Exception so that it compiles properly but you won't determine the Exception so use catch (InterruptedException e) { e.printStackTrace();} and because of 1. gr.drawString(list[counter], xPos, yPos); can't get proper counter in public void paint(Graphics gr).
has comment: http://stackoverflow.com/comment/36942577
score: 0
accepted answer of: http://stackoverflow.com/q/23976431

http://stackoverflow.com/comment/36923563
has text: Good suggestions, but I'm not using setResizable(false) or setMaximumSize on the Frame. If I use the exact same code but run using Java6 it works fine; it seems to be a problem with Java7 on mac. It also runs fine on Windows using Java7.
comment on: http://stackoverflow.com/q/23964862
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24079425
upvote count: 2
answer count: 3
has body: I have a String as Follows String sentence = "I tried to speak @td Spanish @ty, and my @yd friend tried to @yi speak English @yy."; I want to replace @td, @ty, @yi.. etc words by empty space(''). @xx words are dynamic, keeps changing in different scenarios. How can it be done? Thanks
has answer: http://stackoverflow.com/a/24079628
favorite count: 0
has answer: http://stackoverflow.com/a/24079629
tagged with: regex
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37134436
downvote count: 0
tagged with: java
has title: Replacing some series of words with other words
type: Question
has answer: http://stackoverflow.com/a/24079652
accepted answer: http://stackoverflow.com/a/24079652
possible better answer: http://stackoverflow.com/a/24079629

http://stackoverflow.com/comment/37093830
type: QuestionComment
comment on: http://stackoverflow.com/q/24056657
score: 0
has text: Right. But that would apply to a lot of constructs and tools designed to minimize mistakes - accidental or due to ignorance - and I kind of like that ;)
type: Comment

http://stackoverflow.com/q/23985412
answer count: 1
tagged with: spring-security
has answer: http://stackoverflow.com/a/23986736
has title: Access data from other spring security filters
tagged with: spring
type: AnsweredQuestion
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/23986736
type: Question
has body: Is it possible to access the credentials and authorities granted by a previous filter in spring security? Background: I am developing a Java RESTful API using Spring and Spring Security with token-based authentication. However, some calls have an additional protection with the user's password. Currently I have my own implementation of a GenericFilterBean that filters out the token from the HTTP-Header and checks if it is present in the database. Depending on the permissions associated with this token, the user is granted different roles. The permissions are stored in the my database and can be retrieved with the token. There are several calls in the API which need an additional authentication with the user's password. I thought of creating a second custom filter that extractes the password from the header. The problem with this approach is that I don't want to identify the user just by his password but rather by the user extracted from the the token in the first filter.

http://stackoverflow.com/a/33867023
downvote count: 0
has body: Java.time Use java.time library built into Java 8 and TemporalAdjuster. See Tutorial. import java.time.DayOfWeek; import java.time.LocalDate; import static java.time.temporal.TemporalAdjusters.firstInMonth; LocalDate now = LocalDate.now(); //2015-11-23 LocalDate firstMonday = now.with(firstInMonth(DayOfWeek.MONDAY)); //2015-11-02 (Monday) If you need to add time information, you may use any available LocalDate to LocalDateTime conversion like firstMonday.atStartOfDay() # 2015-11-02T00:00
type: Answer
has comment: http://stackoverflow.com/comment/57781918
score: 31
has comment: http://stackoverflow.com/comment/73547386
upvote count: 31
answers question: http://stackoverflow.com/q/23971439

http://stackoverflow.com/comment/37180150
type: AnswerComment
score: 0
type: Comment
has text: old one might be better
comment on: http://stackoverflow.com/a/24102943

http://stackoverflow.com/a/57250855
downvote count: 0
has body: The reason for exception is: Hibernate expects from underlying database to provide an auto increment feature for a given property, in your case it's id. IOW, Oracle(your case) should support auto increment feature for a field. Oracle started to provide auto increment feature with 12c version and, as your version was less, you got that exception .
answers question: http://stackoverflow.com/q/24009042
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/45599149
has text: @ElectronicGeek I think the way the OP asked this question is fine. He explains what he has already done in the question (he has implemented the image loading but is experiencing flickering) and is asking if Picasso provides some sort of image loading callback to solve the issue. Nothing wrong with that at all.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24072176

http://stackoverflow.com/comment/37040884
type: QuestionComment
has text: @greg-449 I tried `RC3` SDK for Linux. It has the same problem.
comment on: http://stackoverflow.com/q/23993206
score: 0
type: Comment

http://stackoverflow.com/comment/68397326
type: Comment
score: 0
has text: O(2n) does not exist, it is simply O(n).
type: AnswerComment
comment on: http://stackoverflow.com/a/23992070

http://stackoverflow.com/comment/36991435
score: 3
comment on: http://stackoverflow.com/q/24002132
type: Comment
type: QuestionComment
has text: And which line is line 102?

http://stackoverflow.com/comment/38073231
type: Comment
type: QuestionComment
has text: Because speak like Yoda, programmers do.
score: 0
comment on: http://stackoverflow.com/q/24078127

http://stackoverflow.com/q/23999290
has body: public int print(Graphics g, PageFormat pf, int page, String customer_name) throws PrinterException { System.out.println("The value of customer name:"+customer_name); if (page &gt; 0) { /* We have only one page, and 'page' is zero-based */ return NO_SUCH_PAGE; } /* User (0,0) is typically outside the imageable area, so we must * translate by the X and Y values in the PageFormat to avoid clipping */ Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); String x = layout.get(""); System.out.println("The value of x is\n"+x); /* Now we perform our rendering */ g.drawString("Customer Name: "+customer_names, 100, 100); /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } I want to call this method from another class, while passing an additional argument to it, customer_name. I call this method from another class as follow: Printer print = new Printer(); //making an object to access that class Printer.java PageFormat page = job.defaultPage(); print.print(&lt;I have no idea what to put here for graphics&gt;, page, 5, customer_name_field.getText()); When I call the method print.print, I gives the message that it requires Graphics, PageFormat, int, String. But what should I put for Graphics, I have no idea?
downvote count: 2
has answer: http://stackoverflow.com/a/23999336
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/60991959
has title: Issues with passing arguments to the print function in Java
has comment: http://stackoverflow.com/comment/36986710
score: -2
has comment: http://stackoverflow.com/comment/36986498
tagged with: printing
has answer: http://stackoverflow.com/a/23999886
answer count: 3
upvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36986150
tagged with: java

http://stackoverflow.com/comment/36908389
comment on: http://stackoverflow.com/q/23957824
has text: You could use a socket connection if the client interface doesn't change oftne, otherwise you're stuck with the same problem. If the application is not used often, then you could have people remote desktop into the central machine running your Java application.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23945464
has comment: http://stackoverflow.com/comment/36933846
score: 9
type: Question
has answer: http://stackoverflow.com/a/24042674
answer count: 3
tagged with: akka
has comment: http://stackoverflow.com/comment/37038553
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/37034791
has title: Best practices for dealing with exceptions in Akka actors
has comment: http://stackoverflow.com/comment/36937322
has comment: http://stackoverflow.com/comment/36886866
has comment: http://stackoverflow.com/comment/36932514
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41218769
has comment: http://stackoverflow.com/comment/36886110
has comment: http://stackoverflow.com/comment/36935867
has comment: http://stackoverflow.com/comment/37029041
has body: I have the following task, for which I have Java/Executors solution working well but I'd like to implement same functionality in Akka and looking for best practices suggestions. Problem: Fetch/parse data from multiple URLs in parallel, block till all data to be fetched and return aggregated result. Should retry on errors (IOException etc) up to certain number of times. My implementation so far is pretty straightforward - create Fetcher actor which knows what URLs should be fetched, it creates bunch of Worker actors and send them URLs, one per message. Once done with particular URL Worker send message back to Fetcher with a result. Fetcher keeps state of results, Workers stateless. Simplified code below. Fetcher: class Fetcher extends UntypedActor { private ActorRef worker; public void onReceive(Object message) throws Exception { if (message instanceof FetchMessage) { this.worker = context().actorOf(SpringExtension.SpringExtProvider.get(actorSystem).props("Worker") .withRouter(new RoundRobinPool(4)), "worker"); for(URL u: urls) { this.worker.tell(new WorkUnit(u), getSelf()); } } else if (message instanceof Result) { // accumulate results } } Worker: class Worker extends UntypedActor { public void onReceive(Object message) throws Exception { if (message instanceof WorkUnit) { // fetch URL, parse etc // send result back to sender getSender().tell(new Result(...), null); } } So far so good and in absence of exceptions everything works as expected. But if there is say IOException in fetching URL in Worker then Akka would restart Worker actor but message that Worker was processing at the time is lost. Even if I use different SupervisorStrategy the result is the same - some of the messages are effectively 'lost'. Of course I could have wrapped code inside Worker.onReceive() with try/catch but I feel that this goes against Akka philosophy. I guess I could use persistent messaging but I don't think added complexity of message persistence is justified in this case. I need per…
tagged with: java
has answer: http://stackoverflow.com/a/24027680

http://stackoverflow.com/comment/36947923
has text: You need to provide code to demonstrate where this is happening before definitive answer can be given.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23979135

http://stackoverflow.com/q/24089030
type: Question
accepted answer: http://stackoverflow.com/a/24090116
has body: I'm trying to put together a generic whitelist of characters allowed in a text box which includes some but not all special characters. So basically the user is entering a phone number and I want to limit the characters they can type to only phone numbers ( so if they tried to type 'a' then nothing would happen). I'm using an SWT Verify Listener to accomplish what I have so far, but any of the special characters that use a SHIFT + __ combination don't work with how I've used it. I assume it's because the shift character is getting trapped. Here is what I have VerifyListener verify = new VerifyListener() { public void verifyText(VerifyEvent event) { event.doit = false; if (Character.isDigit(event.character) { || Character.isWhitespace(event.character) || event.keyCode == '.' || event.keyCode == ',' || event.keyCode == '#' //requires shift key || event.keyCode == '*' //requires shift key || event.keyCode == '/' || event.keyCode == '(' //requires shift key || event.keyCode == ')' //requires shift key || event.keyCode == '[' || event.keyCode == ']' || event.keyCode == '-' || event.keyCode == SWT.ARROW_LEFT || event.keyCode == SWT.ARROW_RIGHT || event.keyCode == SWT.BS || event.keyCode == SWT.DEL || event.keyCode == SWT.MODIFIER_MASK) { event.doit = true; } } }; Also, if there is a better way to do this, I would love to hear that as well.
has title: Using SWT Verify to whitelist characters to be entered into a text box
score: 0
tagged with: swt
answer count: 1
tagged with: widget
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24090116

http://stackoverflow.com/comment/37178677
type: AnswerComment
score: 0
type: Comment
has text: I know your problem at Lista.setMultiChoiceModeListener(this); and return true in onCreateActionMode. However, I cannot understand what you explain so nobody cant help you. Try to explain better.
comment on: http://stackoverflow.com/a/24100844

http://stackoverflow.com/comment/48500038
comment on: http://stackoverflow.com/a/26624037
has text: @DanielOchoa - the best would be to use https://github.com/dlew/joda-time-android
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37053034
has text: Maybe it is a proxy problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24035584

http://stackoverflow.com/comment/37077818
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24048046
has text: Without a runnable example that demonstrates your problem, it's going to be impossible to diagnose your problem
score: 0

http://stackoverflow.com/a/24075083
answers question: http://stackoverflow.com/q/24074648
has comment: http://stackoverflow.com/comment/37145581
type: Answer
has body: You will need to use Optical Character Recognition (OCR) to accomplish your task. You have a couple of options available: Google Documents API Tesseract Qualcomm Vuforia SDK The only one of those options that I have used is the Vuforia SDK so I cannot say what would be the best or easiest to use. Vuforia is an augmented reality SDK but it has support for text recognition and it worked well when I used it but it did take me a while to setup and use.
score: 0

http://stackoverflow.com/q/24009528
has comment: http://stackoverflow.com/comment/37004799
tagged with: java
score: -1
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24060171
possible better answer: http://stackoverflow.com/a/24009629
favorite count: 0
has answer: http://stackoverflow.com/a/24009629
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24060171
has title: Can I localize my whole android app from a button click
downvote count: 1
type: Question
has body: I have to localize an android project for both English and Arabic users. From the next link I get codes for doing this task programmatically-change-language My activity_main.xml contains two buttons English button for changing my application ‘s texts for English users, and Arabic button for changing my application’s texts for Arabic users. On my activity_main.xml there are texts of buttons which are converted from the language to another language after pressing either English or Arabic button fine. My question here How I can convert buttons’ texts on other activities ? if I try to update them through updateTexts() method , I will get error :- unfortunately app has stopped (Because their activities didn’t start). MainActivity.java public class MainActivity extends Activity { private Button English,Arabic; private Locale myLocale; public void changeLang(String lang) { if (lang.equalsIgnoreCase("")) return; myLocale = new Locale(lang); saveLocale(lang); Locale.setDefault(myLocale); android.content.res.Configuration config = new android.content.res.Configuration(); config.locale = myLocale; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); updateTexts(); } public void saveLocale(String lang) { String langPref = "Language"; SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(langPref, lang); editor.commit(); } public void loadLocale() { String langPref = "Language"; SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE); String language = prefs.getString(langPref, ""); changeLang(language); } private void updateTexts() { English.setText(R.string.English); Arabic.setText(R.string.Arabic); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.English= (Button)findViewById(R.id.English); this.A…

http://stackoverflow.com/comment/37125295
has text: Let's say, it returns me back a list of all the user's from the java code.
comment on: http://stackoverflow.com/a/24074419
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/112475260
type: QuestionComment
has text: The string constant pool is there is create a bit of efficiency for constant strings that can be known at compile-time. Other than that it doesn't matter. You should always compare strings with equals().
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24053587

http://stackoverflow.com/comment/37029500
score: 0
has text: The are multiple options here. Two options are to store it as a file on the database or as a byte array in a CLOB.
type: QuestionComment
comment on: http://stackoverflow.com/q/24022219
type: Comment

http://stackoverflow.com/comment/37123154
comment on: http://stackoverflow.com/a/23989727
type: AnswerComment
type: Comment
score: 0
has text: tomsontom sir, I am getting an error during extraction of this eclipse zip file, it says that the name of the directory in which javafx files are there is more than 255 characters long and can't be extracted, is it a problem related to winrar as i am using winrar for extraction, pls resolve my doubt if u can :)

http://stackoverflow.com/comment/36891172
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23947701
type: QuestionComment
has text: @Tejash Raval Prajapati: seriously?

http://stackoverflow.com/comment/36981559
type: Comment
has text: Not sure about that. Probably not. There could be a race condition between calling `setOut` in one thread and resolving `System.out` in another. No matter how you call setOut, that would require synchronizing **all** `System.out` calls. Also the example given by @Durandal is a good example of an issue that could occur.
type: AnswerComment
comment on: http://stackoverflow.com/a/23996797
score: 0

http://stackoverflow.com/comment/37301061
has text: from this url: what is the post_id ? `https://www.facebook.com/photo.php?fbid=10154208667515153&set=a.10154208667405153.1073741857.685560152&type=1&theater`
type: AnswerComment
comment on: http://stackoverflow.com/a/24147945
score: 0
type: Comment

http://stackoverflow.com/a/23961728
upvote count: 8
answers question: http://stackoverflow.com/q/23961684
downvote count: 0
has comment: http://stackoverflow.com/comment/36915548
has comment: http://stackoverflow.com/comment/36915918
has comment: http://stackoverflow.com/comment/36915813
has body: You could try this: ^when is (.*)$ This will find a string that starts with when is and capture everything else to the end of the line. The regex will return one group. You can access it like so: String line = "when is Veteran's Day."; Pattern pattern = Pattern.compile("^when is (.*)$"); Matcher matcher = pattern.matcher(line); while (matcher.find()) { System.out.println("group 1: " + matcher.group(1)); System.out.println("group 2: " + matcher.group(2)); } And the output should be: group 1: when is Veteran's Day. group 2: Veteran's Day.
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/36915749

http://stackoverflow.com/q/23947299
type: Question
tagged with: jgrasp
has body: Is it necessary to use Eclipse (or similar high-level IDE counterpart) for a professional programmer? I kept running into errors with Eclipse when setting up projects and I got hooked on JGrasp for its simplicity; struggling with Eclipse was ultimately detracting from coding time. I understand that Eclipse offers many features beyond that of a lightweight environment like JGrasp which could save effort (lending to more effeficent use of time), and also allows for much better organization with more complex projects. I have not yet tried Netbeans. But I guess I am simply asking if you walked in on your colleague and he was using JGrasp, would you look at him funny? ...or take him less seriously.
has answer: http://stackoverflow.com/a/23947644
tagged with: java
has answer: http://stackoverflow.com/a/23947762
score: -1
tagged with: eclipse
has title: Do I Have To Use Eclipse (Or Similar IDE)
has comment: http://stackoverflow.com/comment/36888499
possible better answer: http://stackoverflow.com/a/23947366
has answer: http://stackoverflow.com/a/23947366
has comment: http://stackoverflow.com/comment/36889331
favorite count: 0
has answer: http://stackoverflow.com/a/23947614
has comment: http://stackoverflow.com/comment/36888489
accepted answer: http://stackoverflow.com/a/23947762
has comment: http://stackoverflow.com/comment/36888523
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1927308
has comment: http://stackoverflow.com/comment/37558054
has comment: http://stackoverflow.com/comment/36888475
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/37067316
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24042963
type: Comment
has text: @NielsPeeren honestly, unless one of the bukkit methods stores some state, or the `Util.CreateFile` holds references to files or something, it doesn't look like you should get any memory leaks

http://stackoverflow.com/comment/37125328
has text: Thank you Every1, for helping me out, i had two problems one was, i used containsValue() insteas of containsKey() another problem the list variable in my main class, which i was passing as parameter, after passing i was calling Clear() method, so that emptied the other referenced links in PhoneBookContactsImpl.. Thank you every 1
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24067159

http://stackoverflow.com/q/24069229
has body: I am making a homework planner GUI program in Java. One GUI takes in data from the user about the assignment, determines priority for the order the homework should be done in, then allows the user to view their schedule as another GUI that displays all their assignments in the appropriate days of the week that they will work on them. My problem is that I can't get the Strings to format correctly in the JLists. See here: I'm filling the JLists with String representations of Homework Objects from a PriorityQueue, like this: while(!sun.isEmpty()) sundayListItems.add(sunday.poll().toString()); . . . sundayList = new JList(sundayListItems.toArray()); My toString method in my Homework class looks like this, which works as it's supposed to in the console when I put in System.out.prints to see how it's working: String string = nameOfAssignment + " for " + hoursPerDay +" hours"; if (string.length()&gt;17) {//17 characters per line in this JList String[] words = string.split(" "); string = ""; int count = words.length; int i = 0; while(count&gt;0) { do{ string += words[i] + " "; //adding words to a line until 17 characters i++; count--; } while(string.length() &lt;= 17); string += "\n";//skips line when 17 characters do{ string += words[i] + " "; count--; i++; } while(i &lt; words.length); string += "\n\n";//separates assignments w/ 2 lines } } return string; But, in the GUI JLists, the Strings are not formatting the way I want. I want the String to wrap around to the next line after 17 characters. Anyone have any ideas?
tagged with: formatting
type: Question
has comment: http://stackoverflow.com/comment/37117404
has comment: http://stackoverflow.com/comment/37116531
linked to: http://stackoverflow.com/q/7306295
has comment: http://stackoverflow.com/comment/37117509
score: 0
tagged with: jlist
tagged with: string
has title: Having trouble with Java GUI String formatting in JList
type: UnansweredQuestion
tagged with: swing
answer count: 0
tagged with: java

http://stackoverflow.com/q/23947358
has body: I am reading a text file and checking for the null column, but null check isn't working and I am getting ArrayIndexOutOfBound exception. I am reading a text file like this fstream17 = new FileInputStream( Environment.getExternalStorageDirectory() + "/InputFiles" + "/XYZ.TXT"); in17 = new DataInputStream(fstream17); buffreader17 = new BufferedReader(new UnicodeReader(in17)); while ((strRead = buffreader17.readLine()) != null) { splitarray = strRead.split("\t"); Log.d("Split array", ""+splitarray[0]/*+""+splitarray[11]*/); if(splitarray[8] == null || splitarray[8].length() == 0) //Checking for null coloumn { Log.d("Null", "Null"); } And my UnicodeReader class looks like this. public class UnicodeReader extends Reader { private static final int BOM_MAX_SIZE = 4; private InputStreamReader delegate; public UnicodeReader(InputStream in) throws IOException { init(in, null); } private void init(InputStream in, String defaultEnc) throws IOException { String encoding; byte bom[] = new byte[BOM_MAX_SIZE]; int n, unread; PushbackInputStream internalIn = new PushbackInputStream(in, BOM_MAX_SIZE); n = internalIn.read(bom, 0, bom.length); if ((bom[0] == (byte) 0xEF) &amp;&amp; (bom[1] == (byte) 0xBB) &amp;&amp; (bom[2] == (byte) 0xBF)) { encoding = "UTF-8"; unread = n - 3; } else if ((bom[0] == (byte) 0xFE) &amp;&amp; (bom[1] == (byte) 0xFF)) { encoding = "UTF-16BE"; unread = n - 2; } else if ((bom[0] == (byte) 0xFF) &amp;&amp; (bom[1] == (byte) 0xFE)) { encoding = "UTF-16LE"; unread = n - 2; } else if ((bom[0] == (byte) 0x00) &amp;&amp; (bom[1] == (byte) 0x00) &amp;&amp; (bom[2] == (byte) 0xFE) &amp;&amp; (bom[3] == (byte) 0xFF)) { encoding = "UTF-32BE"; unread = n - 4; } else if ((bom[0] == (byte) 0xFF) &amp;&amp; (bom[1] == (byte) 0xFE) &amp;&amp; (bom[2] == (byte) 0x00) &amp;&amp; (bom[3] == (byte) 0x00)) { encoding = "UTF-32LE"; unread = n - 4; } else { // Unicode BOM mark not found, unread all bytes encoding = defaultEnc; unread = n; } if (unread &gt; 0) internalIn.unread(bo…
has comment: http://stackoverflow.com/comment/36888755
accepted answer: http://stackoverflow.com/a/23947512
type: Question
tagged with: encoding
has comment: http://stackoverflow.com/comment/36888617
has comment: http://stackoverflow.com/comment/36888648
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36888557
tagged with: android
has title: Why String Array null check not working?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23947512
tagged with: java

http://stackoverflow.com/q/24082519
tagged with: java
has title: Static Class with attributes and synchronized methods
has comment: http://stackoverflow.com/comment/37139842
answer count: 2
has answer: http://stackoverflow.com/a/24082749
has body: I know that there are alot of nearly equal answers here on StackOverFlow but they didn't fit my needs. Given the following code example: (inner class) static class OutgoingFileTransfer implements Runnable { File sendThisFile; outgoingFileTransfer(File sendThis) { this.sendThisFile = sendThis; } @Override public synchronized void run() { //Send the file... } } I know, that the synchronized method will lock the whole class, but only if the run() method has been called. If I do the following: Thread a = new Thread(new OutgoingFileTransfer(new File("c:/.../file1"))).start(); Thread b = new Thread(new OutgoingFileTransfer(new File("c:/.../file2"))).start(); Could it be, that Thread a initialises file1 and BEFORE entering the synchronized method, and then Thread b interrupts, set file2 and joins the run() method? This would mean, that file1 never would be sent. Right? And is there any way to prevent this? I know the cheap way: Make everything non static an add a boolean iAmCurrentlySendingAFilePleaseWaitInTheQueueTillTheOtherFileTransferFinished, so that all goes sequential. But I think there will be nicer ways to do this. Thanks for your help. :)
has comment: http://stackoverflow.com/comment/37139910
has comment: http://stackoverflow.com/comment/37140438
possible better answer: http://stackoverflow.com/a/24082963
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37140270
has comment: http://stackoverflow.com/comment/37140576
has answer: http://stackoverflow.com/a/24082963
has comment: http://stackoverflow.com/comment/37140138
score: 0
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24082749
type: Question
tagged with: synchronize

http://stackoverflow.com/a/24009446
upvote count: 1
answers question: http://stackoverflow.com/q/24009301
has comment: http://stackoverflow.com/comment/37097749
downvote count: 0
has comment: http://stackoverflow.com/comment/37083755
type: Answer
has comment: http://stackoverflow.com/comment/37063785
has body: You can refer this example taken from ORMLite documentation: // get our query builder from the DAO QueryBuilder&lt;Account, String&gt; queryBuilder = accountDao.queryBuilder(); // the 'password' field must be equal to "qwerty" queryBuilder.where().eq(Account.PASSWORD_FIELD_NAME, "qwerty"); // query for all accounts that have "qwerty" as a password List&lt;Account&gt; accountList = queryBuilder.query();
score: 1

http://stackoverflow.com/q/23995341
tagged with: java
has comment: http://stackoverflow.com/comment/36979296
tagged with: authentication
type: Question
has comment: http://stackoverflow.com/comment/36978016
has title: Jsoup login to Moody's
tagged with: jsoup
score: 2
has comment: http://stackoverflow.com/comment/36979066
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24000079
tagged with: http://stackoverflow.com/tag/html
has body: I have problem when trying to login to Moody's website using Jsoup. I had no problems with other sites, but the way I login in other cases doesn't work for Moodys. This is my code: Response initialResponse = Jsoup.connect("https://www.moodys.com/login.aspx") .execute(); Response loginResponse = Jsoup.connect("https://www.moodys.com/login.aspx") .cookies(initialResponse.cookies()) .data("MdcUserName", "username") .data("MdcPassword", "password") .method(Method.POST).execute(); doc = Jsoup.connect("any other moody's page") .cookies(loginResponse.cookies()) .timeout(3000000).get(); System.out.printl(doc.html()); But this does not work. What am I doing wrong? Thank you.
upvote count: 2
has comment: http://stackoverflow.com/comment/36977900
tagged with: cookies
type: UnansweredQuestion

http://stackoverflow.com/a/23943943
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: you need to override the toString() method of your Customer object. I'm assuming you are using an ArrayAdapter to display these in your ListView, which calls toString() on each item in the dataset to display on the screen. By overriding toString(), you can return whatever data you want to be displayed in the ListView for example: public String toString(){ return getWorkerName(); }
accepted answer of: http://stackoverflow.com/q/23943898
answers question: http://stackoverflow.com/q/23943898
type: AcceptedAnswer

http://stackoverflow.com/q/23996809
has body: This is an odd situation for me, I just started learning Java OOP. I made a class looks like this public class Student { public static String name; public static int marks; public Student(String n, int m){ name = n; marks = m; } public static void printProperties(){ System.out.println("Name = " + name + " , marks = " + m); } } As you can see the constructor accepts two data: name and marks. in my main method System.out.println("Please enter number of students:"); int n = scan.nextInt(); Student[] stu = new Student[n]; String name; int marks = 0; for(int i = 0; i &lt; stu.length; i++){ System.out.println("Please enter name for student #" + (i+1)); name = scan.next(); System.out.println("Please enter marks for student #" + (i+1)); marks = scan.nextInt(); stu[i] = new Student(name,marks); System.out.println(); } //Display for(int x = 0; x &lt; stu.length; x++){ System.out.println("#" + (x+1) + " Name: " + stu[x].name + ", Marks: " + stu[x].marks); } So my output as follows: Please enter number of students: 2 Please enter name for student #1 tom Please enter age for student #1 20 Please enter name for student #2 billy Please enter age for student #2 80 #1 Name: billy, Marks: 80 #2 Name: billy, Marks: 80 It should be: #1 Name: tom, Marks: 20 #2 Name: billy, Marks: 80 Why is the preceding index value overidding its previous index value?
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36980956
type: Question
has answer: http://stackoverflow.com/a/23996893
has answer: http://stackoverflow.com/a/23996874
score: 0
possible better answer: http://stackoverflow.com/a/23996893
has answer: http://stackoverflow.com/a/23996894
has title: object array index value is being overided by the preceding index value
has answer: http://stackoverflow.com/a/23997160
has comment: http://stackoverflow.com/comment/36980941
accepted answer: http://stackoverflow.com/a/23996874

http://stackoverflow.com/q/24025560
has answer: http://stackoverflow.com/a/24034624
tagged with: java
score: 0
tagged with: swing
has title: How to create a jtable with different buttons in each row
tagged with: jtable
accepted answer: http://stackoverflow.com/a/24034624
type: AnsweredQuestion
has body: I have tried tutorial at http://java-swing-tips.blogspot.com/2009/10/multiple-jbuttons-in-jtable-cell.html to produce the table below. Now, i need to create a table with different buttons in each row. Please help me.
linked to: http://stackoverflow.com/q/3590897
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/37034896
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/37035068

http://stackoverflow.com/q/24075800
has comment: http://stackoverflow.com/comment/37128386
answer count: 0
tagged with: java
tagged with: box2d
type: Question
tagged with: libgdx
score: 0
has title: Box2D: Problems with LinearImpulse
has comment: http://stackoverflow.com/comment/37130944
has body: I have a problem with Box2D. I tried to do LinearImpulse in render(): Player.body.applyLinearImpulse(0, -12, Player.body.getPosition().x, Player.body.getPosition().y, true); But it doesn't work. Body stays on it position. DynamicBody. public static Body createBox(World world, BodyType type, float width, float height, float density) { BodyDef def = new BodyDef(); def.type = type; Body box = world.createBody(def); PolygonShape poly = new PolygonShape(); poly.setAsBox(width, height); box.createFixture(poly, density); poly.dispose(); return box; } body = MyWorld.createBox(world, BodyDef.BodyType.DynamicBody, WIDTH, HEIGHT, 1); body.setTransform(startX, startY, 0); body.setFixedRotation(true); LInearVelocity works good. OK, I set very big value for impulse and it starts to work. But body moves only on ~1 meter (after Contacting with ther body). How can I make the body moves far?
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/24083553
type: UnansweredQuestion
tagged with: eclipse
type: Question
has body: Eclipse (Indigo) suddenly stopped working, giving the rather well-known error when trying to start it: Java was starte but returned exit code=1 ... I've tried adding this to the eclipse.ini file: -vm C:\Program Files\Java\jdk1.7.0_03\jre\bin\server\jvm.dll just before the -vmarg line. This gets rid of the error message, but now there's just a short glimpse of the eclipse startup image, then it disappears. And eclipse doesn't start, of course. As mentioned, this suddenly happened, without any changes to eclipse or the java installation. When the problem occured, I finally accepted the annoying Java update nag screen and installed the update.It didn't help at all. Any ideas? EDIT: I noticed in the eclipse.ini file these lines: -vmargs -Dosgi.requiredJavaVersion=1.5 I tried changing the version to 1.7, and even removing the two lines alltogether. Still the error message. Here's the complete error message:
score: 0
has answer: http://stackoverflow.com/a/24083862
answer count: 3
has title: Cannot start Eclipse - Java error
has answer: http://stackoverflow.com/a/24083650
tagged with: java
has answer: http://stackoverflow.com/a/24089314

http://stackoverflow.com/comment/37136666
type: AnswerComment
has text: Thanks again. The problems starts when I want to call fucntion from the FragmentActivty Of my Map. It shows me a lot of errors.I don't want load just the fragment, I want to load all of the "Activity".
type: Comment
comment on: http://stackoverflow.com/a/24056720
score: 0

http://stackoverflow.com/a/24003936
answers question: http://stackoverflow.com/q/24002066
downvote count: 1
score: -1
has body: I had this exact problem, to solve it I had to write AsyncTask complete listener. Which sends a notification to UI thread, that data was loaded and it has to change something, in this case hide the ProgressBar. This is the basic example of how this should look like. I am not sure this will work for you after you copy it to your project, but complete listener is what you need, so after studying this case you should be able to find a solution. AsyncTaskCompleteListener.java - listener interface. public interface AsyncTaskCompleteListener { public void onTaskComplete(); } LoadDataTask.java class LoadDataTask extends AsyncTask&lt;Object, Object, Object&gt; { /* Your object types according to your task. */ private AsyncTaskCompleteListener callback; // Callback field public LoadDataTask(AsyncTaskCompleteListener cb){ this.callback = cb; } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Object doInBackground(String... urls) { /* Your task here */ return result; } @Override protected void onPostExecute(Object o) { callback.onTaskComplete(); // Set the Callback } } MainActivity.java public class MainActivity implements AsyncTaskCompleteListener{ /* ...Other methods and fields... */ /* onTaskComplete method which fires after your data is loaded. */ @Override public void onTaskComplete(){ // Hide ProgressBar } }
upvote count: 0
has comment: http://stackoverflow.com/comment/36997395
type: Answer
has comment: http://stackoverflow.com/comment/37001298

http://stackoverflow.com/q/23943910
has answer: http://stackoverflow.com/a/23944274
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/36883655
has body: So i have a JSP page, that contents editable table with checkbox in each row, the question is, how can i pass the data from selected rows to servlet? Can i pass it as a parameter, or get html code in servlet to parse it and get selected data? Thank you.
has title: Pass data from editable HTML table to servlet
tagged with: servlets
answer count: 2
upvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/23955282
favorite count: 0
type: UnansweredQuestion
score: -3

http://stackoverflow.com/q/23955670
has answer: http://stackoverflow.com/a/23955719
downvote count: 6
score: -6
linked to: http://stackoverflow.com/q/218384
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/23353173
has title: Unfortunately, *app* has stopped
upvote count: 0
duplicate of: http://stackoverflow.com/q/23353173
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
has body: I'm new on programming. I stuck at the start... when i try to run on the emulator, emulator starts but application can't open. anyone could solve that problem.. thanks! MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView tv = (TextView) findViewById(R.id.textView1); Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub tv.setText("JustNope"); } }); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } fragment_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android: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.worrkkkk.grrrrr.MainActivity$PlaceholderFragment" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Button" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button1" android:layout_centerHorizontal="true" android:layout_marginBottom="24dp" android:text="Nope" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; logcat &gt; 05-30 11:00:58.741: I/dalvikvm(569): threadid=3: reacting to signal 3 05-30 11:00:59.009: I/dalvikvm(569): Wrote stack traces to '/data/anr/traces.txt' 05-30 11:00:59.132: D/AndroidRuntime(569): Shutting down VM 05-30 11:00:59.…
tagged with: android-emulator
type: Question
linked to: http://stackoverflow.com/q/23869019
has answer: http://stackoverflow.com/a/23955723
tagged with: java
has comment: http://stackoverflow.com/comment/36903436
duplicate of: http://stackoverflow.com/q/23869019
linked to: http://stackoverflow.com/q/23653778
answer count: 2
has comment: http://stackoverflow.com/comment/36903440

http://stackoverflow.com/q/24084834
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37342945
tagged with: spring
has body: I am running Spring through tomcat and using Log4j. I have recently added a spring bean to handle a graceful shutdown of the Spring Integration components. This all works fine but my logging output in my destroy method is lost - I assume this is because log4j has already been terminated. I can see output by using System.out. My bean's destroy method is called from the spring config "destroy-method" The logging inside the bean is via: private final static Logger LOGGER = Logger.getLogger(Monitor.class.getName()); ... LOGGER.info("Application shutdown started"); I have log4j on the classpath (which is the only way Spring is aware of it) and a log4j.properties file. I am thinking because my bean does not directly rely on log4j, Spring is terminating it before my destroy() method. Does anybody know of some way to make Spring hold onto log4j until I have finished my destroy()?
has comment: http://stackoverflow.com/comment/37146514
linked to: http://stackoverflow.com/q/16783552
tagged with: java
upvote count: 1
tagged with: logging
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37144715
has comment: http://stackoverflow.com/comment/37202215
has title: Spring Log4j shutdown order
answer count: 0
downvote count: 0
score: 1
tagged with: tomcat
tagged with: log4j

http://stackoverflow.com/comment/36882420
has text: I don't see here code that will pass the pending intent as an extra from creator to receiver. If you have code doing that post it.
comment on: http://stackoverflow.com/q/23943804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24095581
has body: I have copied my project from one system to another,now I am trying to run it,I am having a message in build path that 95 build path entries are missing. I am having main problem with importing some packages like: import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRField import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import com.mysql.jdbc.Statement; import org.krysalis.barcode4j.BarcodeDimension; import org.krysalis.barcode4j.HumanReadablePlacement; import org.krysalis.barcode4j.impl.AbstractBarcodeBean; import org.krysalis.barcode4j.impl.code128.Code128Bean; import org.krysalis.barcode4j.impl.upcean.EAN13Bean; import org.krysalis.barcode4j.output.java2d.Java2DCanvasProvider; import org.jdesktop.swingx.JXTaskPane; import org.jdesktop.swingx.JXTaskPaneContainer; import orgimp.pushingpixels.substance.api.SubstanceLookAndFeel; import org.pushingpixels.substance.api.SubstanceSkin;
has comment: http://stackoverflow.com/comment/37164938
answer count: 3
has answer: http://stackoverflow.com/a/26132325
has answer: http://stackoverflow.com/a/24095630
favorite count: 0
has title: build path entries are missing
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/24095624
type: Question
downvote count: 0

http://stackoverflow.com/q/24086252
type: Question
tagged with: java
tagged with: fortify
score: 0
answer count: 1
has title: How to generate pdf report through Maven using FORTIFY's fpr file
has body: Hi I am trying to generate a PDF report from fpr file using maven. Can any one tell me if there is any plugin available for that? The following is the output that i want to achieve but from maven. Command in command prompt: "ReportGenerator -format pdf -f outputFile.pdf -source dev-rkm-KMS-aggregate.fpr " Thanks
has answer: http://stackoverflow.com/a/26419028
type: UnansweredQuestion
tagged with: reportgenerator
tagged with: maven

http://stackoverflow.com/a/23962334
has comment: http://stackoverflow.com/comment/36917732
type: Answer
has comment: http://stackoverflow.com/comment/36918569
has comment: http://stackoverflow.com/comment/36918412
has body: Yes. If your application itself reads the pseudo text file /proc/self/maps you will find a list of the libraries (both .jar and .odex as well as native .so) which are either in use by your application process, or preemptively loaded into shared pages for all apps by zygote. Note however that those used at runtime are not the same as those used at build time. You will find that what you link against as "android.jar" is actually implemented on the device in other files. And jar's which are attached to your project source will get collapsed into your code itself, as if they were part of it and not distinct .jar's.
accepted answer of: http://stackoverflow.com/q/23961539
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23961539
has comment: http://stackoverflow.com/comment/36917510
has comment: http://stackoverflow.com/comment/36919098
score: 0
has comment: http://stackoverflow.com/comment/36919072

http://stackoverflow.com/q/23946349
tagged with: java
has body: I'm looking for the proper Java algorithm for password encryption, and I found that Java SDK provides PBKDF2WithHmacSHA1, but not PBKDF2WithHmacSHA256. I heard that HMAC-SHA256 will take more time than HMAC-SHA-1 does. Since system resources are limited, I'm going to apply different iteration values to make them most secure as long as service requirements can bear it. Even with the same expected time of processes, using HMAC-SHA256 is more secure than using HMAC-SHA-1? If so, could you describe how far using HMAC-SHA256 is secure than using HMAC-SHA-1?
answer count: 1
tagged with: hmacsha1
has answer: http://stackoverflow.com/a/23946571
score: 6
has title: For PBKDF2, using HMAC-SHA256 is more secure than using HMAC-SHA-1?
type: AnsweredQuestion
downvote count: 0
tagged with: cryptography
tagged with: pbkdf2
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/23946571
tagged with: sha
upvote count: 6

http://stackoverflow.com/comment/37063919
type: Comment
comment on: http://stackoverflow.com/a/24034634
has text: StringBuffer has an append method that takes a char, so you don't need logtext. Just do `stringBuffer.append(singleData);`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37225463
type: QuestionComment
has text: 50 TB is not huge. You need to define "best" to get a useful answer. You are asking for opinions.
comment on: http://stackoverflow.com/q/23990942
score: 0
type: Comment

http://stackoverflow.com/comment/36989600
has text: Do you start your AsyncTask multiple times?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24000926
type: Comment

http://stackoverflow.com/comment/37073617
has text: Step through it and see what gets added to `sum`.
comment on: http://stackoverflow.com/q/24046281
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/36952324
has text: Is there some better way to read properties instead of declaring all those variables with @Value annotations?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23981670

http://stackoverflow.com/comment/37169360
type: QuestionComment
comment on: http://stackoverflow.com/q/24096111
has text: Can you post a hash password in you have in your database?? By the way according to java documentation about SecretKeyFactory it uses DES encryption algorithm.
score: 0
type: Comment

http://stackoverflow.com/q/24069728
accepted answer: http://stackoverflow.com/a/24070324
tagged with: calendar
possible better answer: http://stackoverflow.com/a/24070029
has comment: http://stackoverflow.com/comment/37120737
has answer: http://stackoverflow.com/a/24070203
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: JDK 6 Calendar October 20 2041 BUG
downvote count: 0
has comment: http://stackoverflow.com/comment/37143964
has answer: http://stackoverflow.com/a/24070324
has body: We get a bug in our system: when we set the date to October, 20, 2041, we set the date to October, 19, 2041 - 23 hs Calendar c = Calendar.getInstance(); c.set(2041, Calendar.OCTOBER, 20, 0, 0, 0); System.out.println(c.getTime()); Output: Sat Oct 19 23:00:00 BRT 2041 This behavior happens when we use JDK 6, in JDK 7 the output is correct: Sat Oct 20 00:00:00 BRT 2041 But we cannot use the jdk 7 in our system. Anyone have more information about this bug? -- more information: this happens only on dates after 2040
answer count: 3
has comment: http://stackoverflow.com/comment/37117636
favorite count: 0
has answer: http://stackoverflow.com/a/24070029
has comment: http://stackoverflow.com/comment/37117479
upvote count: 1

http://stackoverflow.com/q/24102920
accepted answer: http://stackoverflow.com/a/24102943
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
tagged with: session
has body: I want to add multiple items to add to the shopping cart using session.i wrote the code only to add a single item to the cart. can u plz suggest how i can add multiple items.plz?? String name=req.getParameter("n"); String cost=req.getParameter("c"); HttpSession s=req.getSession(); s.setAttribute("name",name); s.setAttribute("cost",cost); out.println("item successfully added to cart"); out.println("\nview cart");
tagged with: servlets
has title: adding multiple items to shopping cart using session through servlet
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24102943

http://stackoverflow.com/q/23983230
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23984674
tagged with: integer
favorite count: 0
has comment: http://stackoverflow.com/comment/36958404
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/36955368
has comment: http://stackoverflow.com/comment/36955326
has comment: http://stackoverflow.com/comment/36955297
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/36955321
has answer: http://stackoverflow.com/a/23984674
has body: I am trying to create validation in a switch statement that will allow only positive integers but when I try entering a negative integer, it does output the error message but does not repeat the loop and just carries on. This is what I have come up with. Can someone please tell me where I am going wrong? public void InsertMoney() { String soption; productName = " Nothing"; // Vending machine welcome dialog soption = JOptionPane.showInputDialog( "============================================" + "\nWelcome to the College Vending Machine!" + "\n============================================" + "\n\nOptions: i for insert money, s for select item, q for quit." + "\n\n============================================"); switch (soption) { case "q": // user chooses q to quit JOptionPane.showMessageDialog(null, "Have a Nice Day!"); System.exit(0); // terminate application break; case "i": // if user chooses i: insert money; do { spaymentSum = JOptionPane.showInputDialog( "=============================" + "\nPlease enter some money (in pence)" + "\n============================="); // Inserting money paymentSum = Integer.parseInt(spaymentSum); // Parsing for calculations if (paymentSum &lt;= 0) { JOptionPane.showMessageDialog(null,"Must be a positive input! Try again."); } } while (paymentSum &gt; 0); break; case "s": // if user chooses s: select item break; } }
has title: Positive numbers only validation in a do..while + switch/case statement
has comment: http://stackoverflow.com/comment/36955338
type: AnsweredQuestion
tagged with: validation

http://stackoverflow.com/comment/37055540
type: Comment
type: QuestionComment
has text: What do you do with the sub-strings?
comment on: http://stackoverflow.com/q/24020461
score: 0

http://stackoverflow.com/q/23976985
has answer: http://stackoverflow.com/a/23977283
has comment: http://stackoverflow.com/comment/39708728
has comment: http://stackoverflow.com/comment/36953410
has body: I have been trying to write a poker scoring algorithm... which has seven nested for-loops to iterate through every combination of seven card poker hands and score them. It is of course a pretty intensive loop... with just under 110.5 million combinations. My algorithm is a raw work in progress... but manages to correctly score all the hand combinations in about 8.5 seconds in Eclipse on my Desktop. Not bad I thought... but the same algorithm in an Android thread takes 17 minutes on the Android emulator and 4 minutes on my HTC One XL. I was fully prepared for the phone to run slower than my newish desktop... but not by a factor of 30. My code is below; public void startThread() { Runnable runnable = new Runnable() { String bitString; byte[] bitCount = new byte[8192]; byte[] isStraight = new byte[8192]; boolean[] isFlush = new boolean[8912]; int c, c1, c2, c3, c4, c5, c6, c7; int[] cards = new int[7]; long sTime, eTime, score = 0; int[] handCount = new int[9]; int pipMask; int[] pips = new int[6]; int[] suit = new int[4]; @Override public void run() { for (c = 0; c &lt; 8192; c++) { bitString = String.format("%13s", Integer.toBinaryString(c)).replace(" ","0"); } sTime = System.currentTimeMillis(); pips[0] = 8191; for (c1 = 0; c1 &lt; 46; c1++) { for (c2 = c1 + 1; c2 &lt; 47; c2++) { for (c3 = c2 + 1; c3 &lt; 48; c3++) { for (c4 = c3 + 1; c4 &lt; 49; c4++) { for (c5 = c4 + 1; c5 &lt; 50; c5++) { for (c6 = c5 + 1; c6 &lt; 51; c6++) { for (c7 = c6 + 1; c7 &lt; 52; c7++) { --- code goes here --- }}}}}}} eTime = System.currentTimeMillis(); Log.d("end", "" + (eTime - sTime)); message = handler.obtainMessage(); bundle = new Bundle(); bundle.putString("msgText", "Finished in " + (eTime - sTime)); message.setData(bundle); handler.sendMessage(message); } // end run() }; // end runnable Thread myThread = new Thread(runnable); myThread.start(); } // end Am I doing something wrong with implementing Threads in Android? I'm worried it may be the size of the byte and boolean arrays a…
has title: Why is my Android Thread so Slow?
answer count: 2
has comment: http://stackoverflow.com/comment/37121684
downvote count: 0
has comment: http://stackoverflow.com/comment/36974863
favorite count: 0
has comment: http://stackoverflow.com/comment/36985956
has comment: http://stackoverflow.com/comment/36943553
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36946182
tagged with: multithreading
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/37522131
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36974713
has comment: http://stackoverflow.com/comment/37120475
type: Question
has comment: http://stackoverflow.com/comment/36944510
has comment: http://stackoverflow.com/comment/36943540
has answer: http://stackoverflow.com/a/24071769

http://stackoverflow.com/comment/37043826
has text: I have Eclipse installed, but I need JUnit plug-in to work with @JonSkeet.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24030470
score: 0

http://stackoverflow.com/a/24063696
score: 2
has body: Elasticsearch Java API wraps json query building, but it's better for you to use java api, rather then manually json building, because in case of future updates it's much easier to update dependency, that to find json and find bugs, related to it.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24063309
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24063309

http://stackoverflow.com/q/23947811
type: Question
upvote count: 2
tagged with: jframe
has comment: http://stackoverflow.com/comment/36890626
has comment: http://stackoverflow.com/comment/36889453
has title: how to accept keyboard shortcuts when jframe is not in focus?
tagged with: java
tagged with: swing
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36890054
has answer: http://stackoverflow.com/a/23948045
has body: I made an application using java which takes and stores screenshots in the specified folder. I set the shortcut ctrl+K to take and save the screenshot and I managed to make my application minimize to system tray when minimize button of jframe is pressed, but the problem is the keyboard shortcut assigned doesn't works as soon as jframe is either minimized or is put in background by some other application, Is it possible to make d application work even when JFrame is not in focus? Please help! Thanks! (I am making the application for windows only)
tagged with: desktop-application
has comment: http://stackoverflow.com/comment/36889429
accepted answer: http://stackoverflow.com/a/23948045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36890723
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36890675

http://stackoverflow.com/comment/36969210
has text: @user2357112 - Exactly. The question doesn't specify that the user shouldn't be allowed to add new key value pairs.
type: Comment
comment on: http://stackoverflow.com/a/23990703
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36979022
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23995856
has text: @JonSkeet I call it from the main method, I updated the code in the question :)
score: 0

http://stackoverflow.com/q/24050160
answer count: 0
score: 1
has body: Is it possible to create a traversal in java using neo4j that keeps a state for the duration of the traversal? For example, I need an Evaluator that is almost identical to toDepth(), except that the depth at the current node is based on another comparison. Say that you had a linked list with 20 items, and you wanted the 10th [valid] one, meaning that some of the items had a particular property flag excluding them from the count. So the final returned item might actually be the 12th in the Path. The only efficient way I can think of doing this is being able to store some state variable that is accessible to each individual evaluation. Is that possible? I understand that I could write my own custom traversing functions to do this, but it would be nice if I could build it into the Traversal Framework.
tagged with: java
has comment: http://stackoverflow.com/comment/37114282
upvote count: 1
type: Question
has title: Implementing a traversal with dynamic depth
tagged with: traversal
has comment: http://stackoverflow.com/comment/37503625
downvote count: 0
tagged with: neo4j
has comment: http://stackoverflow.com/comment/37191427
favorite count: 0
type: UnansweredQuestion
tagged with: neo4j-embedded
has comment: http://stackoverflow.com/comment/37473575

http://stackoverflow.com/q/24089812
tagged with: socket.io
has comment: http://stackoverflow.com/comment/37154689
type: Question
has answer: http://stackoverflow.com/a/24090673
accepted answer: http://stackoverflow.com/a/24090673
has comment: http://stackoverflow.com/comment/37154790
answer count: 2
has title: Muitiplexed socket communication in Java
possible better answer: http://stackoverflow.com/a/24090053
upvote count: 1
favorite count: 0
has body: I am writing a server program that can accept communication from multiple (but fixed) number of clients. I want to keep the program single-threaded. To do so, I am using non-blocking socket to iterate over each client, but each client's channel uses blocking mode. Here's my server code: class server { public static void main(String args[]) throws Exception { ServerSocketChannel channel = ServerSocketChannel.open(); channel.configureBlocking(false); channel.socket().bind(new java.net.InetSocketAddress("localhost", 8005)); System.out.println("Server attivo porta 8005"); Selector selector = Selector.open(); channel.register(selector, SelectionKey.OP_ACCEPT); for(;;) { selector.select(); Set keys = selector.selectedKeys(); Iterator i = keys.iterator(); while(i.hasNext()) { SelectionKey key = (SelectionKey) i.next(); i.remove(); if (key.isAcceptable()) { SocketChannel client = channel.accept(); client.configureBlocking(true); ObjectInputStream ois = new ObjectInputStream( client.socket().getInputStream()); String s = (String)ois.readObject(); System.out.println(s); } } } } } The client uses simple blocking I/O, as shown here: class client { public static void main(String args[]) throws Exception { SocketChannel channel = SocketChannel.open(); channel.configureBlocking(true); channel.connect(new java.net.InetSocketAddress("localhost", 8005)); ObjectOutputStream oos = new ObjectOutputStream (channel.socket().getOutputStream()); for (int i = 0; i &lt; 100; i++) { oos.writeObject(new String("Hello " + i)); System.out.println(i); } } } The problem is that although the client wants to write 100 times, the server is reading the message just once. Neither the server nor the client is giving any exception, but I am only getting the output "Hello 0" from the server. Is there any problem in what I am doing here? If so, what alternatives do I have? Thanks. Update: Closing the ObjectInputStream within the server's loop gives a BrokenPipeException by the client (the server behaves in …
tagged with: sockets
has comment: http://stackoverflow.com/comment/37156025
linked to: http://stackoverflow.com/q/2685534
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37155957
downvote count: 0
has answer: http://stackoverflow.com/a/24090053
score: 1
tagged with: java

http://stackoverflow.com/comment/36903101
has text: @Doctoror Drive : Just tried, but unfortunately, it doesn't work. But I don’t really understand how the FrameLayout could matter, as I’m calling the Fragment by calling : `getSupportFragmentManager().beginTransaction().replace(R.id.venue_container, instanceOfMyFragment).commit()`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23953599

http://stackoverflow.com/a/24063420
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24038842
has body: If you want to verify that every item has that property, and that there are exactly two items, then use everyItem and hasSize: assertThat(objects, everyItem(hasProperty("property", is(propertyIWantToTest)))); assertThat(objects, hasSize(2)); If you want to specifically test the contents of the collection, but it just so happens that both expected items are the same, use a variable and containsInAnyOrder: Matcher&lt;MyObject&gt; m = hasProperty("property", is(propertyIWantToTest)); assertThat(objects, containsInAnyOrder(m, m));

http://stackoverflow.com/comment/37070947
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24044553
has text: See if any of the answers to [this question](http://stackoverflow.com/questions/7462202) help. It covers most if not all of the causes of a 406 using Jackson.

gradlew
tags question: http://stackoverflow.com/q/24063790
type: Tag
tag name: gradlew

http://stackoverflow.com/q/24100437
has comment: http://stackoverflow.com/comment/37175823
score: 0
has comment: http://stackoverflow.com/comment/37174194
has title: Glassfish V4 admin password
answer count: 1
tagged with: admin
has comment: http://stackoverflow.com/comment/37175955
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24101404
has body: Help! I have tried everything. I cannot log into the glassfish admin console on ec2. I want to enable the admin console at 4848 but ./asadmin keeps asking me for a password. I have tried admin/adminadmin anonymous/adminadmin changeit/adminadmin changeit/admin. What in god's name is this out of the box install? Running ubuntu!
tagged with: java
tagged with: ubuntu
tagged with: glassfish

http://stackoverflow.com/a/24040367
type: Answer
has comment: http://stackoverflow.com/comment/37062473
has comment: http://stackoverflow.com/comment/37062997
has body: Avoid using Statement and use PreparedStatement instead. This way you can set parameters for your query instead of concatenating Strings. Also, you should close the PreparedStatement before closing the connection. String query = "INSERT INTO andre(username,password) VALUES(?, ?)"; //PreparedStatement supports parameters, Statement doesn't PreparedStatement stmt = con.prepareStatement(query); stmt.setString(1, username); stmt.setString(2, password); stmt.executeUpdate(); //check the order of execution stmt.close(); con.close(); More info on the advantages of PreparedStatement over Statement: Difference between Statement and PreparedStatement
has comment: http://stackoverflow.com/comment/37062070
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24040101
accepted answer of: http://stackoverflow.com/q/24040101
has comment: http://stackoverflow.com/comment/37062508

http://stackoverflow.com/comment/36990292
comment on: http://stackoverflow.com/q/24001473
has text: Maven is not an IDE. Those links are the javadoc of the library's packages. You want the library containing all of those.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37093775
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24057250
type: Comment
has text: Your right, the two instance problem would still be in play.

http://stackoverflow.com/comment/37017610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24013114
score: 0
has text: I don't get it... Where is currently this "label of WebApplication", and where do you want to put it? Upload from where?

http://stackoverflow.com/comment/36912636
has text: Argh. `ChronoZonedDateTime` has `toEpochSecond` not `getEpochSecond`. So yes I think this allows skipping the use of `Instant`. I'll test and update.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23945792
type: Comment

http://stackoverflow.com/q/24065988
tagged with: log4j
favorite count: 0
accepted answer: http://stackoverflow.com/a/30142753
has title: SyslogAppender: Using a pattern not starting with square brackets overwrites the host name
has comment: http://stackoverflow.com/comment/48394017
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: rsyslog
type: Question
has answer: http://stackoverflow.com/a/30142753
has body: I am using log4j and the SyslogAppender class to send messages to rsyslog running on the local Linux machine (called orion). I currently have the following pattern: log4j.appender.SYSLOG_LOCAL1.layout.conversionPattern=[%p] %m%n Which produces this output: Jun 5 16:16:09 orion [ERROR]: &lt;My message here&gt; This doesn't show the source of the message and so I wanted to add that but unfortunately when I add anything before the square brackets, the host name disappears. eg. log4j.appender.SYSLOG_LOCAL1.layout.conversionPattern=TEST [%p] %m%n Jun 5 16:22:41 TEST [ERROR]: &lt;My message here&gt; It is not just literal text that causes this problem. For example, if I use the sample pattern from the documentation, "%-5p [%t]: %m%n", the hostname is also not there: log4j.appender.SYSLOG_LOCAL1.layout.conversionPattern=%-5p [%t]: %m%n Jun 5 16:25:34 ERROR [main]: &lt;My message here&gt; Here is the simplest example I can come up with to demonstrate the problem using the patterns aaa and [aaa]: log4j.appender.SYSLOG_LOCAL1.layout.conversionPattern=aaa Jun 5 17:47:29 aaa log4j.appender.SYSLOG_LOCAL1.layout.conversionPattern=[aaa] Jun 5 17:48:24 orion [aaa]: The documentation doesn't show that square brackets have any special meaning so I don't understand why this is happening. I'm also unclear on whether this problem is caused by the SyslogAppender class or rsyslog. How do I keep the host name in the syslog message without wrapping the first item in square brackets?
has comment: http://stackoverflow.com/comment/45813407
has comment: http://stackoverflow.com/comment/45814959
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37052932
comment on: http://stackoverflow.com/a/24035526
type: AnswerComment
has text: `PropertyValueFactory`'s constructor takes a `String`. As long as `LieferscheinArtikel` has an `ObjectProperty<Produkt> produktProperty()` method, or a `Produkt getProdukt()` method, this is fine.
score: 0
type: Comment

http://stackoverflow.com/comment/37021332
score: 0
type: Comment
type: QuestionComment
has text: This is the problem: *Invalid resource : jdn/TaeKwonDo__pm*. What's TaeKwonDo__pm file?
comment on: http://stackoverflow.com/q/24018461

http://stackoverflow.com/comment/37043577
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24030239
has text: Modifying the list while iterating over it with an Iterator _is_ the problem. (And the sublist counts as the "main" list here, because the sublist is backed by the main list -- it's a view into the same data structure.)

http://stackoverflow.com/a/23949793
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36893049
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23949687
has body: You can try this: $('*').filter(function() { if ($(this).css('position') === 'fixed'){ $(this).css('position', 'relative'); } });
accepted answer of: http://stackoverflow.com/q/23949687
upvote count: 1

http://stackoverflow.com/q/24065077
accepted answer: http://stackoverflow.com/a/24121312
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate Criteria conditions or subqueries on OneToMany property values
tagged with: criteria
answer count: 1
has answer: http://stackoverflow.com/a/24121312
score: 0
has body: One component of my application logs the parameters that an User send with an http URL. The mapping is as follow: public class ActivityLog { @Column(name = "id") private Long id; @OneToMany(mappedBy="activityLog", fetch = FetchType.LAZY, cascade = CascadeType.ALL) protected List&lt;ActivityLogParameter&gt; activityLogParameters = new ArrayList&lt;ActivityLogParameter&gt;(); } public class ActivityLogParameter { @Column(name = "id") private Long id; @Column(name = "key", length=10) protected String key; @Column(name = "value", length=50) protected String value; @ManyToOne(fetch = FetchType.LAZY, cascade={CascadeType.MERGE}) @JoinColumn(name="activity_log_id") protected ActivityLog activityLog; } Let assume with every URL always 2 parameters are being passed: U and L I need to create a query using hibernate's Criteria (mandatory from specification) so that it returns me all the ActivityLogs where both parameters matche a certain value. i.e.: U=aaa and L=bbb I tried like this: Criteria criteria = getCurrentSession().createCriteria(ActivityLog.class, "al"); // create alias criteria = criteria.createAlias("activityLogParameters", "alp",JoinFragment.LEFT_OUTER_JOIN); // create transformer to avoid duplicate results criteria = criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); criteria = criteria.setFetchMode("al.activityLogParameters", FetchMode.SELECT); //filters criteria = criteria.add(Restrictions.or(Restrictions.eq("alp.value", UValue), Restrictions.ne("alp.key", "L"))); criteria = criteria.add(Restrictions.or(Restrictions.eq("alp.value", LValue), Restrictions.ne("alp.key", "U"))); But here I'm stuck. I tried to add projections like distinct and group by on this but it's not enough to have a correct result. I'm trying also to use this criteria as a sub criteria, so to count the number of rows for any ActivityLog and keep only the records that have count(*) = 2 (all parameters match the condition) but I can't find how to do it with Subqueries. A…

http://stackoverflow.com/q/24082147
tagged with: label
accepted answer: http://stackoverflow.com/a/24085714
type: AnsweredQuestion
has title: Custom title for MultiplePieChart
type: Question
has comment: http://stackoverflow.com/comment/37274324
score: 0
has body: Need to create in JFreeChart multiplePieChart with custom charts label. In documentation example title for charts create automatically. Documentation example: package demo; import java.awt.Dimension; import java.awt.Font; import javax.swing.JPanel; import org.jfree.chart.*; import org.jfree.chart.labels.StandardPieSectionLabelGenerator; import org.jfree.chart.plot.MultiplePiePlot; import org.jfree.chart.plot.PiePlot; import org.jfree.data.category.CategoryDataset; import org.jfree.data.general.DatasetUtilities; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RefineryUtilities; import org.jfree.util.TableOrder; public class MultiplePieChartDemo1 extends ApplicationFrame { public MultiplePieChartDemo1(String s) { super(s); JPanel jpanel = createDemoPanel(); jpanel.setPreferredSize(new Dimension(600, 380)); setContentPane(jpanel); } private static CategoryDataset createDataset() { double ad[][] = { { 3D, 4D, 3D, 5D }, { 5D, 7D, 6D, 8D }, { 5D, 7D, (0.0D / 0.0D), 3D }, { 1.0D, 2D, 3D, 4D }, { 2D, 3D, 2D, 3D } }; CategoryDataset categorydataset = DatasetUtilities.createCategoryDataset("Region ", "Sales/Q", ad); return categorydataset; } private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createMultiplePieChart("Multiple Pie Chart", categorydataset, TableOrder.BY_ROW, true, true, false); MultiplePiePlot multiplepieplot = (MultiplePiePlot)jfreechart.getPlot(); JFreeChart jfreechart1 = multiplepieplot.getPieChart(); PiePlot pieplot = (PiePlot)jfreechart1.getPlot(); pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}")); pieplot.setLabelFont(new Font("SansSerif", 0, 8)); return jfreechart; } public static JPanel createDemoPanel() { JFreeChart jfreechart = createChart(createDataset()); return new ChartPanel(jfreechart); } public static void main(String args[]) { MultiplePieChartDemo1 multiplepiechartdemo1 = new MultiplePieChartDemo1("JFreeChart: MultiplePieChartDemo1.java"); multiplepiechartde…
tagged with: jfreechart
answer count: 1
tagged with: charts
has answer: http://stackoverflow.com/a/24085714
tagged with: java

http://stackoverflow.com/comment/37071841
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24045087
has text: This seems to be a step in the right direction, except if I enter a file name that doesn't exist it throws an exception now. `Exception in thread "main" java.io.FileNotFoundException: up (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:131) at java.util.Scanner.<init>(Scanner.java:611)`

http://stackoverflow.com/a/24056769
score: 3
answers question: http://stackoverflow.com/q/24056591
downvote count: 0
has body: The problem is here: int psi = Integer.parseInt(e1.getText().toString()); int cable = Integer.parseInt(e2.getText().toString()); This will throw a NumberFormatException if the value is "" or a non-number. Try checking for a blank string before you try to parse it. You are checking it but you're doing it after you actually attempt to parse. Do it before parsing. And by the way this: if(e1.getText().toString() == "" || e2.getText().toString() == "") t1.setText("Fill field,please"); is not how you check for equality of strings. Use the equals() method. To select just one RadioButton group them in a RadioGroup as described here.
has comment: http://stackoverflow.com/comment/37092766
upvote count: 3
type: Answer

http://stackoverflow.com/q/24013981
favorite count: 0
has answer: http://stackoverflow.com/a/24014062
answer count: 3
has title: Creating an object of the same class as the parameterized type
has answer: http://stackoverflow.com/a/24014109
tagged with: generics
tagged with: parameterized-types
possible better answer: http://stackoverflow.com/a/24014109
upvote count: 1
accepted answer: http://stackoverflow.com/a/24014062
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/1090458
type: Question
has answer: http://stackoverflow.com/a/24014105
has body: Here's the code: package Fabrika.Trake; import Vozila.*; public class Traka&lt;T extends Vozilo&gt; extends Thread { protected int vrijemeRada; ... @Override public void run() { while(true) { //I want to create the object here } } } Now, let's say I have a class called Auto which extends Vozilo. I'd like to know if there is a way of constructing an object of type T without using reflection. Something like: T object = new T(); This, of course, is completely incorrect, but it just serves as an illustration of what I'd like to do. :)
duplicate of: http://stackoverflow.com/q/1090458
downvote count: 0

http://stackoverflow.com/comment/36964117
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23987760
has text: `EJB` can deploy only on application server like JBoss, Weblogic, Websphere, not on web server/web container.
score: 0

http://stackoverflow.com/comment/99329822
has text: i found the problem in /app/build/reports/lint-results-release-fatal.xml. thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/52140460
type: Comment

http://stackoverflow.com/comment/37076775
type: QuestionComment
comment on: http://stackoverflow.com/q/24047941
has text: sorry for weeak english. wait 2 mins i wil paste the code.
score: 0
type: Comment

http://stackoverflow.com/comment/36916629
score: 1
has text: That is what I guessed but doesn't that beat the purpose of the fact that we have to implement all the methods in interface...
comment on: http://stackoverflow.com/a/23946591
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36921579
comment on: http://stackoverflow.com/q/23964739
type: Comment
type: QuestionComment
has text: I added a breakpoint at the sort function and went to debug. I am new to using the debug but can you help @Dukeling
score: 0

http://stackoverflow.com/q/24032017
type: Question
has body: I am doing an Android app with native code. I have the typical error "fatal signal", wich usually means that in my native code there is a problem. But this time I dind't find the error. This is the Logcat: 06-04 09:48:19.115: D/dalvikvm(27203): GC_CONCURRENT freed 460K, 4% free 17100K/17700K, paused 0ms+2ms, total 14ms 06-04 09:48:19.165: A/libc(27328): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27344 (Binder_3) 06-04 09:48:19.215: A/libc(27328): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27369 (bucle) 06-04 09:48:19.265: I/DEBUG(26629): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-04 09:48:19.265: I/DEBUG(26629): Build fingerprint: 'google/hammerhead/hammerhead:4.4.2/KOT49H/937116:user/release-keys' 06-04 09:48:19.265: I/DEBUG(26629): Revision: '11' 06-04 09:48:19.265: I/DEBUG(26629): pid: 27328, tid: 27344, name: Binder_3 &gt;&gt;&gt; org.gradiant.sistole.locservice &lt;&lt;&lt; 06-04 09:48:19.265: I/DEBUG(26629): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000 06-04 09:48:19.345: I/DEBUG(26629): r0 00000000 r1 c0186201 r2 00000000 r3 00000000 06-04 09:48:19.345: I/DEBUG(26629): r4 74ec7740 r5 74ec7710 r6 74ec7770 r7 00000001 06-04 09:48:19.345: I/DEBUG(26629): r8 00000001 r9 752df000 sl 74da7bd4 fp 4016f2ec 06-04 09:48:19.345: I/DEBUG(26629): ip 00000001 sp 753dccf0 lr 00000000 pc 00000000 cpsr 000a0010 06-04 09:48:19.345: I/DEBUG(26629): d0 752de00000000000 d1 0000000800000000 06-04 09:48:19.345: I/DEBUG(26629): d2 0074006e00610000 d3 0073006900730000 06-04 09:48:19.345: I/DEBUG(26629): d4 0065006c006f0074 d5 0063006f006c002e 06-04 09:48:19.345: I/DEBUG(26629): d6 0076007200650073 d7 002e006500630069 06-04 09:48:19.345: I/DEBUG(26629): d8 0000000000000000 d9 0000000000000000 06-04 09:48:19.345: I/DEBUG(26629): d10 0000000000000000 d11 0000000000000000 06-04 09:48:19.345: I/DEBUG(26629): d12 0000000000000000 d13 0000000000000000 06-04 09:48:19.345: I/DEBUG(26629): d14 0000000000000000 d15 0000000000…
score: 0
has answer: http://stackoverflow.com/a/24032184
tagged with: android
answer count: 1
has title: Fatal signal 11 error while writing native code in Android
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37048360

http://stackoverflow.com/a/24093507
type: Answer
has body: x is the time zone id, there are a link of a list of them. Only need to feed the gettimeZone("with the time zone id") with the time zone of the city you want to know the time (I'm saying city because there are country with a lot of time zones like US or Russia). TimeZone tz = TimeZone.getTimeZone("x") http://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/
upvote count: 1
answers question: http://stackoverflow.com/q/24093414
score: 1
downvote count: 0

http://stackoverflow.com/a/24081732
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24080025
upvote count: 11
answers question: http://stackoverflow.com/q/24080025
type: AcceptedAnswer
has body: You say that your stylesheets and JavaScript files are under "/assets". I'm going to assume you have directories "/assets/css" and "/assets/js". Then, given the following resource handler definition: @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/assets/**") .addResourceLocations("classpath:/assets/"); } You would load these resources in your HTML like so: &lt;link href="/assets/css/style.css" rel="stylesheet" /&gt; &lt;script src="/assets/js/general.js"&gt;&lt;/script&gt;
type: Answer
score: 11

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24049945
tags question: http://stackoverflow.com/q/24056424
tags question: http://stackoverflow.com/q/24037022
tags question: http://stackoverflow.com/q/24023067
tags question: http://stackoverflow.com/q/24019319
tags question: http://stackoverflow.com/q/24038802
tags question: http://stackoverflow.com/q/24032610
tags question: http://stackoverflow.com/q/24016334
tags question: http://stackoverflow.com/q/24006512
tags question: http://stackoverflow.com/q/24085074
tags question: http://stackoverflow.com/q/24032865
tags question: http://stackoverflow.com/q/24032319
tags question: http://stackoverflow.com/q/24069259
type: Tag
tags question: http://stackoverflow.com/q/24088579
tags question: http://stackoverflow.com/q/24071115
tags question: http://stackoverflow.com/q/24049794
tags question: http://stackoverflow.com/q/24050596
tags question: http://stackoverflow.com/q/24028841
tags question: http://stackoverflow.com/q/23968316
tags question: http://stackoverflow.com/q/24034360
tags question: http://stackoverflow.com/q/24013375
tags question: http://stackoverflow.com/q/24015924
tags question: http://stackoverflow.com/q/24097425
tags question: http://stackoverflow.com/q/23948133
tags question: http://stackoverflow.com/q/24095626
tags question: http://stackoverflow.com/q/23949139
tags question: http://stackoverflow.com/q/24047789
tags question: http://stackoverflow.com/q/24021126
tags question: http://stackoverflow.com/q/24042486
tags question: http://stackoverflow.com/q/24010946
tags question: http://stackoverflow.com/q/24086126
tags question: http://stackoverflow.com/q/23951856
tags question: http://stackoverflow.com/q/24046976
tags question: http://stackoverflow.com/q/24055854
tags question: http://stackoverflow.com/q/23997855
tags question: http://stackoverflow.com/q/23998167
tags question: http://stackoverflow.com/q/24051148
tags question: http://stackoverflow.com/q/23971457
tags question: http://stackoverflow.com/q/23942763
tags question: http://stackoverflow.com/q/24035478
tags question: http://stackoverflow.com/q/23956058
tags question: http://stackoverflow.com/q/23962657
tags question: http://stackoverflow.com/q/24040084
tags question: http://stackoverflow.com/q/24101597
tags question: http://stackoverflow.com/q/23992395
tags question: http://stackoverflow.com/q/24070399
tags question: http://stackoverflow.com/q/23975767
tags question: http://stackoverflow.com/q/24032121
tags question: http://stackoverflow.com/q/24076508
tags question: http://stackoverflow.com/q/24033620
tags question: http://stackoverflow.com/q/23996958
tags question: http://stackoverflow.com/q/23999698
tags question: http://stackoverflow.com/q/24002663
tags question: http://stackoverflow.com/q/23951132
tags question: http://stackoverflow.com/q/24005295
tags question: http://stackoverflow.com/q/23945973
tags question: http://stackoverflow.com/q/24041684
tags question: http://stackoverflow.com/q/24101084
tags question: http://stackoverflow.com/q/24074601
tags question: http://stackoverflow.com/q/23982368
tags question: http://stackoverflow.com/q/24063808
tags question: http://stackoverflow.com/q/24054469
tags question: http://stackoverflow.com/q/24018420
tags question: http://stackoverflow.com/q/23974249
tag name: xml
tags question: http://stackoverflow.com/q/23981030
tags question: http://stackoverflow.com/q/24040233
tags question: http://stackoverflow.com/q/24085292
tags question: http://stackoverflow.com/q/23949628
tags question: http://stackoverflow.com/q/23997031
tags question: http://stackoverflow.com/q/24017498
tags question: http://stackoverflow.com/q/24066690
tags question: http://stackoverflow.com/q/24034817
tags question: http://stackoverflow.com/q/23989101
tags question: http://stackoverflow.com/q/24045207
tags question: http://stackoverflow.com/q/24024574
tags question: http://stackoverflow.com/q/24037502
tags question: http://stackoverflow.com/q/24059098
tags question: http://stackoverflow.com/q/23955462

http://stackoverflow.com/comment/37033511
comment on: http://stackoverflow.com/a/24024685
score: 0
type: AnswerComment
has text: You can use Mule or Camel and deploy it on Tomcat. I think that for this particular app the advantages of using an ESB would be huge.
type: Comment

http://stackoverflow.com/q/23961640
tagged with: android
tagged with: java
has body: How do I swap the position of btn3 and btn in the GridLayout? final Button btn = new Button(this); final Button btn2 = new Button(this); final Button btn3 = new Button(this); btn.setText("2"); btn2.setText("4"); btn3.setText("2"); final GridLayout gl = (GridLayout) this.findViewById(R.id.gridLayout); gl.addView(btn); gl.addView(btn2); gl.addView(btn3);
type: Question
tagged with: android-layout
has title: Changing row (location) of Button in GridLayout Android Java
score: 0
has answer: http://stackoverflow.com/a/23961855
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/37168441
type: Comment
type: QuestionComment
score: 1
has text: You need to give a reference to what you are reading. Also see this post: http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java
comment on: http://stackoverflow.com/q/24097356

http://stackoverflow.com/q/24033027
type: Question
linked to: http://stackoverflow.com/q/3741765
answer count: 1
favorite count: 0
tagged with: synchronized
has body: I was trying to understand the synchronized function when I observed this issue. First, here is the code - SampleThread04.java public class SampleThread04 extends Thread { public void disp(String s) { System.out.print("["+s); try { Thread.sleep(1000); }catch(Exception e){ System.out.print(e); } System.out.println("]"); } } SampleThread05.java public class SampleThread05 implements Runnable { SampleThread04 d; String s; Thread t; public SampleThread05(SampleThread04 d1, String s1) { s = s1; t = new Thread(this); d = d1; t.start(); } public void run() { synchronized(d){ d.disp(s); } } } ThreadDemo02.java public class ThreadDemo02 { public static void main(String[] args) { SampleThread04 st4 = new SampleThread04(); new SampleThread05(st4,"one"); new SampleThread05(st4,"two"); new SampleThread05(st4,"three"); } } I'm getting different outputs as I run the code. Output #1: [one] [two] [three] Output #2: [three] [one] [two] Output #3: [three] [two] [one] And so on. Without using synchronized(), I'm getting the following output - [one[two[three] ] ] This is quite understandable but why is it the when I use synchronized(), the strings are sometimes printed out of sequence when without using it I always get the same output. Shouldn't the output be always as follows - [one] [two] [three] Please explain how the strings are printed out of sequence. Thanks in advance. :)
has answer: http://stackoverflow.com/a/24033152
upvote count: 2
score: 1
tagged with: multithreading
has title: Strings are not being displayed in order even after using synchronized()
downvote count: 1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24033152

http://stackoverflow.com/q/24024023
favorite count: 0
has answer: http://stackoverflow.com/a/24024296
has title: good practices regarding downcasting in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37031953
has comment: http://stackoverflow.com/comment/37031951
has body: I have a set of operations. Every operation is a sequence of 2 steps. So, I have a base class which executes these two steps and all the operations extend this base class and provide the actual implementations for the two steps. Ex. class Base { Step1 step1; Step2 step2; B execute() { A a = step1.perform(); B b = step2.perform(a); } //Set methods... } Here Step1 and Step2 are interfaces and one can change the implementations for them to do different things. I have the following questions: Every implementation of step2 takes instance of A as input which can also contain a derived type of A. So I need to do a downcast. Is it ok to do a downcast in this case or is there a better way to achieve this? Some implementations of step2 may not return any value. Is it ok if we have an empty class just for the type hierarchy and other classes extend this class?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37031933
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37031842
has answer: http://stackoverflow.com/a/24024435
answer count: 2

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

http://stackoverflow.com/comment/37038949
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24005881
has text: But it's not needed though right? I took it out and everything is just fine and dandy. Seems like bloat to me.

http://stackoverflow.com/a/24054465
answers question: http://stackoverflow.com/q/24053301
score: 0
has body: In main() method change second line like this,may be it should works for you, Bag1 bag = new Bag1(); While compiling java application ,java compiler checks that Bag1 class contains show() method or not,if method is not available java compiler throws "cannot find symbol": show().
type: Answer

http://stackoverflow.com/comment/37109865
comment on: http://stackoverflow.com/q/24065817
type: Comment
type: QuestionComment
has text: Even after moving the file to src/main/resources?
score: 0

ant
tags question: http://stackoverflow.com/q/24063020
tags question: http://stackoverflow.com/q/24100659
tags question: http://stackoverflow.com/q/24063233
type: Tag
tags question: http://stackoverflow.com/q/24067858
tags question: http://stackoverflow.com/q/23958028
tags question: http://stackoverflow.com/q/23987373
tags question: http://stackoverflow.com/q/23954875
tag name: ant
tags question: http://stackoverflow.com/q/23968713
tags question: http://stackoverflow.com/q/24027573
tags question: http://stackoverflow.com/q/24005295
tags question: http://stackoverflow.com/q/24083920
tags question: http://stackoverflow.com/q/24024379
tags question: http://stackoverflow.com/q/23999893
tags question: http://stackoverflow.com/q/24043349
tags question: http://stackoverflow.com/q/24065678
tags question: http://stackoverflow.com/q/23944387
tags question: http://stackoverflow.com/q/24084973
tags question: http://stackoverflow.com/q/24058953
tags question: http://stackoverflow.com/q/23944680
tags question: http://stackoverflow.com/q/24064551
tags question: http://stackoverflow.com/q/24053861
tags question: http://stackoverflow.com/q/23945765
tags question: http://stackoverflow.com/q/23955182

http://stackoverflow.com/comment/37125036
has text: Aren't numbers signed in Java?
comment on: http://stackoverflow.com/q/24074312
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24078416
possible better answer: http://stackoverflow.com/a/24078648
has answer: http://stackoverflow.com/a/24078648
answer count: 4
score: 2
has comment: http://stackoverflow.com/comment/37134714
downvote count: 2
has body: What's the benefit of using enum embedded inside a class in JAVA? Like so: public class Outter { public enum Color { WHITE, BLACK, RED, YELLOW, BLUE } }
has answer: http://stackoverflow.com/a/24078450
type: Question
type: AnsweredQuestion
tagged with: enums
has answer: http://stackoverflow.com/a/24078473
tagged with: java
upvote count: 4
has title: What's the benefit of using enum embedded inside a class in JAVA?
accepted answer: http://stackoverflow.com/a/24078450
favorite count: 0
has answer: http://stackoverflow.com/a/24078767

http://stackoverflow.com/a/24009890
has body: You can use XML parser, in whatever language you are using. Here is for Java: http://www.mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/
upvote count: 1
answers question: http://stackoverflow.com/q/24008961
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23976506
answers question: http://stackoverflow.com/q/23976418
type: Answer
has body: the syntax might be a bit off, but import java.utils.HashMap; class CharHolder { private char myChar; CharHolder( char someChar ) { myChar = someChar; } char getChar() { return myChar; } public static void main(String[] args) { HashMap&lt;Character, CharHolder&gt; mapita = new HashMap&lt;&gt;(); mapita.put( 'a', new CharHolder('a') ); mapita.put( 'b', new CharHolder('b') ); System.out.println( mapita.get('a').getChar() + " " + mapita.get('b').getChar() ); } } the output should be: a b
score: 0

http://stackoverflow.com/a/24084966
answers question: http://stackoverflow.com/q/24069210
type: Answer
upvote count: 3
score: 3
has body: Well the reason for your result seems rather obvious: System.currentTimeMillis acquires a lock somewhere along the way which makes the code basically sequential (the kernel call is by far the most expensive thing that's done in the loop). In this case you'd expect the numbers of the four threads to be about the same as the sequential version which is pretty much what happens. The interesting question is why does System.currentTimeMillis need a lock? It's a native function that's implemented in src/os/&lt;os&gt;/vm/os_&lt;os&gt;.cpp where &lt;os&gt; is linux, windows or solaris. The function slightly simplified looks as follows in the jdk9 dev tree: jlong os::javaTimeMillis() { FILETIME wt; GetSystemTimeAsFileTime(&amp;wt); return windows_to_java_time(wt); } So Java itself does not synchronize since GetSystemTimeAsFileTime is thread-safe. So we can assume that the OS internally acquires a lock for that method - rather surprising, I don't really see why that'd be necessary.. the used struct has only 8 byte so could be updated atomically. Anyhow that's how it is, I wouldn't be surprised if running the same code on Linux wouldn't exhibit such behavior.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24069210

http://stackoverflow.com/comment/37005228
score: 0
type: Comment
has text: Are you pertaining to 5xx errors ?
type: QuestionComment
comment on: http://stackoverflow.com/q/24009733

http://stackoverflow.com/q/23981605
has comment: http://stackoverflow.com/comment/36952146
tagged with: java
type: Question
answer count: 1
favorite count: 0
has body: Can we add @Autowired on primitive setter method of a bean? How does @Autowired work for primitive?
linked to: http://stackoverflow.com/q/317687
score: -1
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23981639
tagged with: spring
tagged with: autowired
has title: Can we add @Autowired on primitive setter method of a bean?

http://stackoverflow.com/comment/37044567
comment on: http://stackoverflow.com/a/24030843
score: 0
type: AnswerComment
has text: @SreeVeni, Yes that is mistake. Please debug your code and see how your value changed.
type: Comment

http://stackoverflow.com/a/24099198
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23973097
downvote count: 0
has body: Do you need a timestamp or just a high resolution increasing number that it time based? If so, you might be able to use System.nanoTime. There were issues with this call in early JVM's/OS' but they seem to have been addressed (see first answer here). Of course there's that odd chance that it might loop around on you. Don't know what kind of flexibility you have with your protocol, but there should be ways to deal with that.
type: Answer

http://stackoverflow.com/comment/37094735
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24039405
type: Comment
has text: getServletContext ().getRequestDispatcher() used to forward request to other application (Context) in same container...

http://stackoverflow.com/q/24073418
tagged with: java
has title: When using a new JTA Transaction, what happens to PersistenceContexts in other transactions?
type: Question
tagged with: jakarta-ee
has body: I'm using CMT with a stateless EJB. Suppose I have two methods, one of which is a timeout for an EJB timer and one which modifies existing entities: @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Timeout public void cullOldEntities() { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaDelete&lt;T&gt; cd = cb.createCriteriaDelete(clazz); Root&lt;T&gt; root = cd.from(clazz); Path&lt;Date&gt; dateCreatedPath = root.get("lastUpdated"); cd.where(cb.lessThan(dateCreatedPath, dateOfExpiry())); em.createQuery(cd).executeUpdate(); } public void modifyEntities(...) As cullOldEntities requires a new transaction, a new persistence context is created and then it is committed when the method ends. The issue is what happens to a preexisting persistence context of another transaction. If modifyEntities and then cullOldEntities are called so they run concurrently what happens to modifyEntities persistence context if cullOldEntities finishes first and has it's persistence context committed? Does the modifyEntities's persistence context get synchronized with the changes made? If not what will happen when an entity is modified? How can I do a bulk delete that is safe with concurrent modification?
tagged with: ejb
tagged with: jpa
has answer: http://stackoverflow.com/a/24079527
tagged with: jta
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24078279

http://stackoverflow.com/q/23998082
has title: Detect doubleclick on cell of TableView JavaFX
score: 3
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24005865
tagged with: mouseevent
type: Question
answer count: 2
downvote count: 0
tagged with: double-click
favorite count: 0
has body: I am trying to detect a doubleclick on a random cell of a tableview. The detection of the doubleclick is not a problem but rather which cell has been doubleclicked. table.addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent event) { if (event.getClickCount() &gt; 1) { System.out.println("double clicked!"); TableCell c = (TableCell) event.getSource(); System.out.println("Cell text: " + c.getText()); } } }); This is how I'm building my table: private void BuildTable() throws Exception { /*Some initialisations etc*/ for(int i=0; i&lt;result.getMetaData().getColumnCount();i++) { final int j = i; TableColumn col = new TableColumn(result.getMetaData().getColumnName(i+1)); col.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;ObservableList,String&gt;,ObservableValue&lt;String&gt;&gt;(){ public ObservableValue&lt;String&gt; call(CellDataFeatures&lt;ObservableList, String&gt; param) { return new SimpleStringProperty(param.getValue().get(j).toString()); } }); table.getColumns().addAll(col); } while(result.next()){ ObservableList&lt;String&gt; row = FXCollections.observableArrayList(); for(int i = 1; i&lt;=result.getMetaData().getColumnCount();i++){ row.add(result.getString(i)); } data.add(row); } table.setItems(data); }catch(Exception e){ e.printStackTrace(); } } The real problem here is that I can't just typecast into a TableCell. Can someone help me out? I would be very grateful.
has answer: http://stackoverflow.com/a/37979428
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/comment/36959586
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23983410
has text: I had some more typos (joinGroup needed the interface of curse, not the IP twice :D) But this is more or less copy and past back into netbeans and fix some typos. ;D Same result, I can run it on one machine but when I seperate the two (adjusting the interface name) it doesn't receive / send packets.

http://stackoverflow.com/comment/37065566
type: Comment
type: QuestionComment
has text: What does for (i = 0; i > counting.length(); ++i) even mean? counting is a character, how can it have length. Did you even compile this code? and shouldn't counting=U.charAt(i) be inside the for loop?
comment on: http://stackoverflow.com/q/24042111
score: 0

http://stackoverflow.com/q/24096964
has title: Reading from file into HashMap
has body: I'm trying to fill my HashMap with Strings from the text file (zadania.txt) . It's a simple text file in format like : Q: question 1 A: answer for question 1 Q: question 2 A: answer for question 2 etc ... Then I want to write it out on console and here the problem is . It runs , but doesn't write out anything. When I change the source file it works but I'm wondering why it doesn't work with that file ( file is ok, not broken , written in Pages and saved as a text file). Anyone can help ? Here's my code : import java.io.File; import java.io.FileNotFoundException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Scanner; public class testClass { public static void main(String[] args) { // TODO Auto-generated method stub File file = new File("zadania.txt"); try { Scanner skaner = new Scanner(file); HashMap&lt;String,String&gt; questions = new HashMap&lt;String,String&gt;(); while(skaner.hasNext()){ String question = skaner.nextLine(); String answer = skaner.nextLine(); questions.put(question, answer); } Iterator&lt;String&gt; keySetIterator = questions.keySet().iterator(); while(keySetIterator.hasNext()){ String key = keySetIterator.next(); System.out.println(key + "//** " +questions.get(key)); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37167702
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24097211
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37167691
tagged with: text-files
type: Question
has answer: http://stackoverflow.com/a/24100755
tagged with: hashmap
has answer: http://stackoverflow.com/a/24097207

http://stackoverflow.com/a/32672997
downvote count: 0
has body: The "connection reset" means that the other party (i.e. the server) closed the connection. Internally the SDK builds and reuses a http connection to not have to open a connection every time you make a request. The log message tells you that the connection was reset, but normally this is not something to worry about. The SDK will retry automatically in cases like this. So if you are only seeing this sporadically in the logs but everything works as expected you should probably not worry about it
answers question: http://stackoverflow.com/q/24011301
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23968600
has body: You example is not a visitor pattern. It is just inheritance. A visitor pattern first requires an visitor interface interface ThingVisitor { void visit(ThingA a); void visit(ThingB b); } Now you need an interface Thing: interface Thing { void accept(ThingVisitor visitor); } And your implementation of, for example, ThingA would be class ThingA implements Thing { public void accept(final ThingVisitor visitor) { visitor.visit(this); } } Now you see the logic to handle the Thing types is contained in the implementations of ThingVisitor.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23968494
upvote count: 2

http://stackoverflow.com/comment/37119296
type: QuestionComment
has text: possible duplicate of [How to create Java method that accepts variable number of arguments?](http://stackoverflow.com/questions/7607353/how-to-create-java-method-that-accepts-variable-number-of-arguments)
comment on: http://stackoverflow.com/q/24070959
score: 0
type: Comment

http://stackoverflow.com/a/24087111
answers question: http://stackoverflow.com/q/24074749
downvote count: 1
has comment: http://stackoverflow.com/comment/37178127
has body: Now that I look closer, I think that the DataSource problem is a red-herring. Boot's Hibernate auto-configuration is being triggered and that's what causing a DataSource to be required. Hibernate's on the classpath because you've got a dependency on spring-boot-starter-data-jpa which pulls in hibernate-entitymanager. Update your spring-boot-starter-data-jpa dependency to exclude Hibernate: org.springframework.boot spring-boot-starter-data-jpa org.hibernate hibernate-entitymanager
has comment: http://stackoverflow.com/comment/37152181
has comment: http://stackoverflow.com/comment/37150791
type: Answer
has comment: http://stackoverflow.com/comment/37167274
has comment: http://stackoverflow.com/comment/126011203
has comment: http://stackoverflow.com/comment/44629877
has comment: http://stackoverflow.com/comment/82359146
score: 20
has comment: http://stackoverflow.com/comment/37174498
has comment: http://stackoverflow.com/comment/37177745
upvote count: 21
has comment: http://stackoverflow.com/comment/44628997

http://stackoverflow.com/comment/37132872
has text: Thanks @CeilingGecko you are right. I did not realize that the first argument of `replaceAll()` function is a RegEx.
type: Comment
comment on: http://stackoverflow.com/a/24045381
score: 0
type: AnswerComment

http://stackoverflow.com/a/24052792
has body: The URL I used in the local machine is http://localhost.mydomain/TNAService/services/TNAService?WSDL and the URL in the rhc is http://myapp-mydomain.rhcloud.com/services/TNAService?WSDL No idea why different URLs on different machines but like mentioned above you have to either correct your web.xml or use different URLs.
type: Answer
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24034563
upvote count: 1

http://stackoverflow.com/a/24027966
downvote count: 1
score: -1
has body: You are using ExecutorService, so you can do it after submitting the task: ExecutorService executor = // ... Future&lt;?&gt; future = executor.submit(task); future.get(5, TimeUnit.MINUTES); // timeout 5 mins
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/24027314
has comment: http://stackoverflow.com/comment/37040757
has comment: http://stackoverflow.com/comment/37039817

http://stackoverflow.com/q/23971709
has comment: http://stackoverflow.com/comment/36937056
duplicate of: http://stackoverflow.com/q/21678077
has comment: http://stackoverflow.com/comment/36934102
answer count: 0
has body: I am trying to replace components in jpanel using replace() in GroupLayout but it didn't worked. I tried to google it but didn't found any helpful solution. Can any one please tell me where do I making mistake? Here is my code: contentPanelLayout.setHorizontalGroup( contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); contentPanelLayout.setVerticalGroup( contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); I am trying to replace the panel with another panel on button click button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ contentPanelLayout.replace(contentPanel,anotherPanel); } }); I've read the java docs, but not found any helpful.
type: UnansweredQuestion
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/21678077
tagged with: java
has title: Replacing component in grouplayout
tagged with: grouplayout
score: 0
has comment: http://stackoverflow.com/comment/36934252

http://stackoverflow.com/comment/37015409
has text: Hope you have configured your server in eclipse using "Add server wizard"
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24014656

http://stackoverflow.com/comment/37169535
comment on: http://stackoverflow.com/q/24097778
has text: Little side note: Either stick to snake_case or camelCase, but don't mix them. The general Java standard would be camelCase.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24033168
has title: spring with plain jdbc and transaction management - transaction not maintane
tagged with: spring
tagged with: spring-mvc
tagged with: spring-jdbc
has comment: http://stackoverflow.com/comment/37050748
answer count: 0
has comment: http://stackoverflow.com/comment/37050281
tagged with: transactions
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37050555
type: Question
has body: I am working on Spring with jersey rest Webservice. i have used spring transaction support for transaction management. But transaction it is not working. Here are my configuration: datasource.xml <property name="dataSource" ref="dataSource" /> <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" /> dao classes import org.springframework.transaction.annotation.Transactional; @Transactional public class CustomerDao { public void insertCustomer() { //insertion with plain jdbc like catch exception and rethrow it } } caller Product product= new Product(); customerDao.insertCustomer(product.getCustumer()); prderDao.insertOrder(product.getOrder()); ctx.close(); isssue > After throwing exception in product.getOrder, data is still persist in customer table.
has comment: http://stackoverflow.com/comment/37051071
has comment: http://stackoverflow.com/comment/37050920
downvote count: 0
has comment: http://stackoverflow.com/comment/37072942
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37126468
type: QuestionComment
has text: And *where* are you getting the exception? Please show the full stack trace. It would help if you could indent your code to make it easier to reader, too.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24075047

http://stackoverflow.com/a/23967269
has body: z.insert(name.length(), " The Great ");
answers question: http://stackoverflow.com/q/23967251
type: Answer
upvote count: 1
score: 1
downvote count: 0

android-intent
tags question: http://stackoverflow.com/q/23988802
tags question: http://stackoverflow.com/q/23991613
tags question: http://stackoverflow.com/q/24001232
tags question: http://stackoverflow.com/q/23982764
tags question: http://stackoverflow.com/q/23961761
tags question: http://stackoverflow.com/q/24093045
tags question: http://stackoverflow.com/q/24078307
tags question: http://stackoverflow.com/q/23943804
tags question: http://stackoverflow.com/q/23958468
tags question: http://stackoverflow.com/q/24035311
tags question: http://stackoverflow.com/q/24103725
tags question: http://stackoverflow.com/q/24095759
tags question: http://stackoverflow.com/q/24046049
tags question: http://stackoverflow.com/q/24067370
tags question: http://stackoverflow.com/q/24061189
tags question: http://stackoverflow.com/q/24067806
tags question: http://stackoverflow.com/q/24022847
tags question: http://stackoverflow.com/q/23989939
type: Tag
tags question: http://stackoverflow.com/q/24066487
tag name: android-intent
tags question: http://stackoverflow.com/q/24069912
tags question: http://stackoverflow.com/q/24052000
tags question: http://stackoverflow.com/q/23954300
tags question: http://stackoverflow.com/q/24012575
tags question: http://stackoverflow.com/q/23950033
tags question: http://stackoverflow.com/q/24023273
tags question: http://stackoverflow.com/q/23978541
tags question: http://stackoverflow.com/q/23971960

http://stackoverflow.com/a/24050639
has body: If this is the only way to solve your problem (generating all combinations) then it's going to be slow, it doesn't necessarily have to take up a bunch of memory though. When doing recursion, you'll want to use tail-recursion to optimize memory usage. Or just switch over to an iterative approach. If you need to save the combinations that match, make sure you only save the combination not copies of the objects themselves. As a last resort you could always append each matching combination to a file to read in later, then you wouldn't be using much memory at all. All these things could help with your memory problems.
has comment: http://stackoverflow.com/comment/37082501
type: Answer
answers question: http://stackoverflow.com/q/24050383
has comment: http://stackoverflow.com/comment/37082161
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/24104150
downvote count: 1
has comment: http://stackoverflow.com/comment/37182134
type: Question
accepted answer: http://stackoverflow.com/a/24104312
tagged with: awt
score: 0
answer count: 1
favorite count: 0
has body: I'm trying to create a simple app in Java. It is like a contact list with a few functions such as next, previous, first, and last buttons. I wrote some code for the "next" button. My program runs but when I click on the "next" button it gives me this error Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Employees.Workers.btnnextActionPerformed(Workers.java:199) at Employees.Workers.access$200(Workers.java:11) at Employees.Workers$3.actionPerformed(Workers.java:111) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) Below is my code: public Workers() { initComponents(); DoConnect(); } public void DoConnect(){ try{ String host = "jdbc:derby://localhost:1527/Employees"; String uName = "Administrator"; String uPass = "*********"; Connection con = DriverManager.getConnection(host,uName,uPass); stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE ); String SQL; SQL = "SELECT * FROM Administrator.Workers"; ResultSet rs = stmt.executeQuery(SQL); //identify the Columns // We want to go through all the records from our table. Thats why we used a while loop rs.next(); int id_col = rs.getInt("ID"); String id = Integer.toString(id_col); String first_name = rs.getString("First_Name"); String last_name = rs.getString("Last_Name"); String job_title = rs.getString("Job_Title"); textID.setText(id); textFirstName.setText(first_name); textLastName.setText(last_name); textJobTitle.setText(job_title); } catch(SQLException err){ JOptionPane.showMessageDialog(Workers.this, err.getMessage()); } } private void btnnextActionPe…
tagged with: javadb
tagged with: nullpointerexception
tagged with: resultset
has answer: http://stackoverflow.com/a/24104312
has title: Next Button on Java DB Program
type: AnsweredQuestion
tagged with: java
upvote count: 1

random
tags question: http://stackoverflow.com/q/24104680
tags question: http://stackoverflow.com/q/24082209
tags question: http://stackoverflow.com/q/24085346
tags question: http://stackoverflow.com/q/23954453
tags question: http://stackoverflow.com/q/24022849
tags question: http://stackoverflow.com/q/24095294
tags question: http://stackoverflow.com/q/24043611
tags question: http://stackoverflow.com/q/23988977
tag name: random
tags question: http://stackoverflow.com/q/23948322
type: Tag
tags question: http://stackoverflow.com/q/24097920
tags question: http://stackoverflow.com/q/24001640
tags question: http://stackoverflow.com/q/23971365

http://stackoverflow.com/a/24038025
answers question: http://stackoverflow.com/q/24037692
has comment: http://stackoverflow.com/comment/37057796
has comment: http://stackoverflow.com/comment/37058041
has comment: http://stackoverflow.com/comment/37057835
has body: long randomNumber = 0; long power = 1; for(int i = 0; i &lt; 12; i++) { // up to 12 not 13 Random r = new Random(); int randomInt = r.nextInt(10); randomNumber += (power * randomInt); power *= 10; } // here, the most stupid way to provide last digit to be not zero Random r = new Random(); int randomInt = r.nextInt(9); randomInt++; randomNumber += (power * randomInt); power *= 10;
score: 0
has comment: http://stackoverflow.com/comment/37057946
type: Answer
has comment: http://stackoverflow.com/comment/37057881

http://stackoverflow.com/comment/37161645
score: 0
has text: Figures. It was worth a try. It is probably not security related.
comment on: http://stackoverflow.com/a/24090857
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37167133
type: AnswerComment
comment on: http://stackoverflow.com/a/24095290
type: Comment
has text: ok i use 8 buffer with size of 32KB for 8thread that is 8 * 32 KB , so it doesnt take a lot of ram , so why occupy so much ? i dont understand your meaning ? sorry please explain it for me more
score: 0

http://stackoverflow.com/a/23987803
answers question: http://stackoverflow.com/q/23986792
score: 0
has body: I did something like this. #!/bin/bash # set n to 1 n=1 # continue until $n equals 5 while [ $n -le 84 ] do java VC.vc testsFixed/test$n java jasmin.Main testsFixed/test$n.j java testsFixed/test$n n=$(( n+1 )) # increments $n done
type: Answer

http://stackoverflow.com/q/24084850
answer count: 2
has body: I'm working on Java application which prints label on Zebra printer. I've been using ZPL language and Java printing API till now, but ZPL is not suffiecient for my further works. The next thing I need to do is (programatically) checking if font with specified name is already installed on the printer. I've found that I may achieve my goal with SGD commands. But I have no idea how to send it from Java application and get the response. The command I would like to send is ! U1 do "file.dir" "R:" Has anybody met similar problem? The printer is connected with computer via USB. Is it possible to use Java printing API to send the command and receive answer or maybe I should use sockets or something completely different?
upvote count: 3
tagged with: java
has title: Sending SGD command to Zebra printer and receiving the response with Java
tagged with: zpl
accepted answer: http://stackoverflow.com/a/24085957
downvote count: 0
possible better answer: http://stackoverflow.com/a/73798237
tagged with: printing
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/73798237
favorite count: 0
has answer: http://stackoverflow.com/a/24085957
type: Question

compilation
tags question: http://stackoverflow.com/q/23963903
tags question: http://stackoverflow.com/q/24047507
tag name: compilation
type: Tag

http://stackoverflow.com/a/24104329
has body: You need to use the Thread.sleep() call. More info here: https://docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html
score: 12
answers question: http://stackoverflow.com/q/24104313
type: Answer
upvote count: 13
downvote count: 1

http://stackoverflow.com/comment/137761055
type: Comment
comment on: http://stackoverflow.com/a/70977690
score: 0
type: AnswerComment
has text: Thanks for pointing this out, fixed the typo.

http://stackoverflow.com/q/24005295
type: Question
has comment: http://stackoverflow.com/comment/36997902
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/37026584
has comment: http://stackoverflow.com/comment/37014141
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36997362
favorite count: 0
type: UnansweredQuestion
has title: Must set build.dir error in project
has comment: http://stackoverflow.com/comment/37002944
tagged with: http://stackoverflow.com/tag/xml
tagged with: build
upvote count: 2
has answer: http://stackoverflow.com/a/24007009
has body: So, I'm running a java+xml program as my project (Generate timetable using Genetic Algorithm). So, right now I have problem in my xml. My java code all has no error. So, I have build-impl.xml, project.xml, and build.xml. I'm running in eclipse macbook pro late 2010. This program is originally build for netbeans so you might see the words netbeans. I got this error. "Users/admin/eclipse/workspace/GA_TestBench/src/nbproject/build-impl.xml:137: Must set build.dir" Where do I edit the to set build.dir? It is in project.xml like I did for src.dir My coding for project.xml <?xml version="1.0" encoding="UTF-8"?> <property name="src.dir" value="/Users/admin/eclipse/workspace/GA_TestBench/src"/> org.eclipse.modules.java.j2seproject GA_TestBench <root id="src.dir"/> <root id="test.src.dir" <!-- "src.dir"="/Users/admin/eclipse/workspace/GA_TestBench/src.dir "/>--> My coding for build.xml <?xml version="1.0" encoding="UTF-8"?> <property name="src.dir" value="src"/> <property name="test.src.dir" value="test"/> <property name="classes.dir" value="classes"/> Builds, tests, and runs the project GA_TestBench. <import file="/Users/admin/eclipse/workspace/GA_TestBench/src/nbproject/build-impl.xml"/> My coding for build-impl.xml is here the link. I'm sorry i can't post since it exceeds character that i can. https://code.google.com/p/csc384-genetic-algorithms-project/source/browse/trunk/GA_TestBench/nbproject/build-impl.xml?r=30 Thank you!

http://stackoverflow.com/comment/37141677
has text: for the 2) i get the error neighborCells has private access in Cell
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24078653

http://stackoverflow.com/comment/36952695
comment on: http://stackoverflow.com/a/23981789
score: 0
type: AnswerComment
type: Comment
has text: Wouldn't this consume a lot of resources, resetting the batch's color every frame ?

http://stackoverflow.com/comment/37169842
has text: Yes I have read it, and also several posts. It's hard to explain what I don't understand, since I'm new to wait/notify and also to BlockingQueue. That's what I want a simple example about producing at a time interval and consuming as soon as it is available
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24098139

http://stackoverflow.com/comment/37006195
comment on: http://stackoverflow.com/q/24010109
has text: An `IntStream` has no `.sorted(Comparator)` method; you have to go through a `Stream<Integer>` first and reverse there before yielding an `IntStream`
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/37012465
has text: Did you first compile the package?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24013824
score: 1

http://stackoverflow.com/q/24008767
has comment: http://stackoverflow.com/comment/37003251
type: Question
accepted answer: http://stackoverflow.com/a/24008972
answer count: 3
has answer: http://stackoverflow.com/a/24008809
has body: public static void main(String[] args) { String[] months = ("jan","Feb", "March", "April", .... , "Dec"); System.out.println(months[Integer.parseInt(args[0]-1)]); } Why args[0]-1 ?
possible better answer: http://stackoverflow.com/a/24008768
tagged with: arrays
has comment: http://stackoverflow.com/comment/37003361
favorite count: 0
has comment: http://stackoverflow.com/comment/37003250
has title: Java: What does the following method do?
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/37003252
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24008972
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24008768

http://stackoverflow.com/comment/130320921
score: 1
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
comment on: http://stackoverflow.com/a/73753039
type: Comment

http://stackoverflow.com/comment/36944280
type: Comment
has text: Thank you very much, really it was helpful. I only make small editing and it works for me. Appreciated your help.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23977278

spring
tags question: http://stackoverflow.com/q/24055755
tags question: http://stackoverflow.com/q/24059138
tags question: http://stackoverflow.com/q/24082437
tags question: http://stackoverflow.com/q/24061849
tags question: http://stackoverflow.com/q/24061834
tags question: http://stackoverflow.com/q/24065555
tags question: http://stackoverflow.com/q/23986950
tags question: http://stackoverflow.com/q/24086207
tags question: http://stackoverflow.com/q/24028155
tags question: http://stackoverflow.com/q/24043241
tags question: http://stackoverflow.com/q/24055182
tags question: http://stackoverflow.com/q/24004959
tags question: http://stackoverflow.com/q/24036224
tags question: http://stackoverflow.com/q/23966161
tags question: http://stackoverflow.com/q/24046856
tags question: http://stackoverflow.com/q/23981118
tags question: http://stackoverflow.com/q/24048853
tags question: http://stackoverflow.com/q/23994234
tags question: http://stackoverflow.com/q/23965584
tags question: http://stackoverflow.com/q/24099691
tags question: http://stackoverflow.com/q/23978225
tags question: http://stackoverflow.com/q/24095334
tags question: http://stackoverflow.com/q/23974128
tags question: http://stackoverflow.com/q/23994515
tags question: http://stackoverflow.com/q/23988523
tags question: http://stackoverflow.com/q/24050228
tags question: http://stackoverflow.com/q/24016692
tags question: http://stackoverflow.com/q/24066512
tags question: http://stackoverflow.com/q/23943455
tags question: http://stackoverflow.com/q/24069484
tags question: http://stackoverflow.com/q/24079365
tags question: http://stackoverflow.com/q/24033419
tags question: http://stackoverflow.com/q/23951373
tags question: http://stackoverflow.com/q/24012334
tags question: http://stackoverflow.com/q/23981231
tags question: http://stackoverflow.com/q/23970663
tags question: http://stackoverflow.com/q/24053310
tags question: http://stackoverflow.com/q/23974207
tags question: http://stackoverflow.com/q/24057475
tags question: http://stackoverflow.com/q/24045540
tags question: http://stackoverflow.com/q/24040208
tags question: http://stackoverflow.com/q/24032865
tags question: http://stackoverflow.com/q/23950068
tags question: http://stackoverflow.com/q/24051548
tags question: http://stackoverflow.com/q/24059618
tags question: http://stackoverflow.com/q/23998495
tags question: http://stackoverflow.com/q/24096924
tags question: http://stackoverflow.com/q/24057816
tags question: http://stackoverflow.com/q/24040430
tags question: http://stackoverflow.com/q/24099644
tags question: http://stackoverflow.com/q/23990859
tags question: http://stackoverflow.com/q/24025352
tags question: http://stackoverflow.com/q/23989625
tags question: http://stackoverflow.com/q/24011096
tags question: http://stackoverflow.com/q/23990683
tags question: http://stackoverflow.com/q/24036586
tags question: http://stackoverflow.com/q/24086911
type: Tag
tags question: http://stackoverflow.com/q/24044553
tags question: http://stackoverflow.com/q/24065120
tags question: http://stackoverflow.com/q/24099961
tags question: http://stackoverflow.com/q/24010483
tags question: http://stackoverflow.com/q/24010468
tags question: http://stackoverflow.com/q/24002206
tags question: http://stackoverflow.com/q/24026570
tags question: http://stackoverflow.com/q/24041409
tags question: http://stackoverflow.com/q/24063270
tags question: http://stackoverflow.com/q/24072579
tags question: http://stackoverflow.com/q/23996575
tags question: http://stackoverflow.com/q/24047500
tags question: http://stackoverflow.com/q/24058573
tags question: http://stackoverflow.com/q/24096381
tags question: http://stackoverflow.com/q/24076757
tags question: http://stackoverflow.com/q/23970054
tags question: http://stackoverflow.com/q/23996776
tags question: http://stackoverflow.com/q/24052390
tags question: http://stackoverflow.com/q/24047499
tags question: http://stackoverflow.com/q/24065807
tags question: http://stackoverflow.com/q/23991574
tags question: http://stackoverflow.com/q/24039173

http://stackoverflow.com/comment/37037082
comment on: http://stackoverflow.com/q/24026633
score: 0
has text: Sounds like you do get multiple keypressed events, but the second "overrides" the first (in terms of your logic for movement). @MadProgrammer's suggestion sounds good then.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37147458
score: 0
type: Comment
type: QuestionComment
has text: To load a library you will need to extract it from the jar to somewhere the OS actually can load from (the file system). A method I've seen commonly used is to use getResource for the library in the jar, then copying it to system temp and load from there (using qualified path). Some even have libraries for multiple OS's in the same jar and select which one fits the OS.
comment on: http://stackoverflow.com/q/24085347

http://stackoverflow.com/q/24002081
has body: I am trying to use the maven-dependency-plugin to copy the dependencies to another location however, it fails on a checksum validation when retrieving transitive dependencies specifically org.codehaus.plexus:plexus-container-default:pom:1.0-alpha-30 from a private nexus server. Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencies (copy-dependencies) on project myapp: Execution copy-dependencies of goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencies failed: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-dependency-plugin:jar:2.8 (): Failed to read artifact descriptor for org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-30: Could not transfer artifact org.codehaus.plexus:plexus-container-default:pom:1.0-alpha-30 from/to mycompany.nexus (http://nexus.mycompany.com/content/groups/public): Checksum validation failed, expected aa1efeb7ed05a3c5037cc194b9e8fbf97e52268a but is 351451aebadb3a5dfa07ea8bdf9e4e336d299054 I tried to force the version of the plexus-container-default dependency with no luck. If anyone can chime in on how I can resolve this noob issue it would be greatly appreciated Thanks! This is the relevant snippet from my pom: org.apache.maven.plugins maven-dependency-plugin 2.8 org.codehaus.plexus plexus-container-default 1.5.5 copy-dependencies package copy-dependencies ${project.build.outputDirectory}/${build.dir}/lib true true
has title: maven-dependency-plugin: failure while fetching its dependencies
tagged with: maven-plugin
tagged with: maven-2
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19246860
tagged with: maven
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37002781
type: Question
has comment: http://stackoverflow.com/comment/66828085
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36946623
type: QuestionComment
comment on: http://stackoverflow.com/q/23978289
type: Comment
has text: No, it depends on several parameters either in the object itself or some programm state...
score: 0

http://stackoverflow.com/comment/37026501
comment on: http://stackoverflow.com/q/24021126
type: Comment
type: QuestionComment
has text: app:showAsAction="never" .. you have it set to never show
score: 0

http://stackoverflow.com/q/24030118
tagged with: oracle-database
tagged with: jdbc
answer count: 0
has comment: http://stackoverflow.com/comment/37275032
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37044686
has comment: http://stackoverflow.com/comment/37043876
tagged with: count
has comment: http://stackoverflow.com/comment/37043977
has comment: http://stackoverflow.com/comment/37049291
tagged with: java
type: Question
has title: Is there Any InBuilt function or procedure/method to get Number of Records of table with bigint return type in ORACLE
has comment: http://stackoverflow.com/comment/37043582
has body: I was working with multiple database repositories with Java. In case of MySQL/Postgresql their inbuilt count(*) function returns BigInteger Data type to Java layer, for SQLServer I managed this by using count_big(*) function of SQLServer. Now I got stuck with Oracle repository, the count(*) function of Oracle is returning me Integer at Java layer. Please suggest/guide me what is the efficient way to get the number of records from a table in Oracle which will return the result as a BigInteger type at Java Layer.

http://stackoverflow.com/comment/37175505
comment on: http://stackoverflow.com/q/24100736
score: 0
type: Comment
type: QuestionComment
has text: @HotLicks I do not understand you, if the .class files contain the ver number, does that mean that even if the code technically works in the older jdk it wont run on it was signed by the newer one ? That sounds really bad, why limit java developers like that, if the code can run on jdk 6 why not allow it just because it was compiled under jdk 7?

http://stackoverflow.com/comment/37082524
score: 0
has text: You've mis-stated your problem. What you have is a string containing space-separated hex digits representing UTF-8 code points. There's enough information in *that* description for you to be able to solve your problem completely.
type: QuestionComment
comment on: http://stackoverflow.com/q/24051152
type: Comment

http://stackoverflow.com/comment/36992598
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24002483
has text: Thanks for your response, I am not sure what you mean by a direct execution of excel, could you expand on that please?
score: 0

http://stackoverflow.com/comment/37284079
has text: I found out that this is working fine on another system. strange.
comment on: http://stackoverflow.com/q/23949972
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24006181
has answer: http://stackoverflow.com/a/26308122
upvote count: 18
has answer: http://stackoverflow.com/a/42253634
possible better answer: http://stackoverflow.com/a/26308122
has answer: http://stackoverflow.com/a/24042109
accepted answer: http://stackoverflow.com/a/24041015
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37038343
has comment: http://stackoverflow.com/comment/36999870
tagged with: android
tagged with: fragment
score: 18
answer count: 4
has title: Android - How to change fragments in the Navigation Drawer
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has body: I'm fairly new to Android programming, but have been doing pretty well until now. I've read a lot of answers to this question but can't seem to make mine work. Basically what I have is a MainActivity with a Navigation Drawer. I have two fragments correctly initialized with corresponding fragment layout xmls. Currently I can get my first fragment to show up when the app starts and when I click on each item in the drawer, the titles change; however, the fragment stays the same. Any suggestions? What I believe to be relevant code is below (not shown is the code for the NavigationDrawerFragment.java with the necessary code automatically built by Eclipse). Thanks in advance! 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.content_frame, PlaceholderFragment.newInstance(position + 1)) .commit(); } public void onSectionAttached(int number) { switch (number) { case 1: mTitle = getString(R.string.title_home); break; case 2: mTitle = getString(R.string.title_infodirect); break; case 3: mTitle = getString(R.string.title_trailmap); …
has answer: http://stackoverflow.com/a/24041015
type: Question
tagged with: navigation-drawer

http://stackoverflow.com/a/23979377
answers question: http://stackoverflow.com/q/23954425
score: 0
has body: I think what you are looking for is a configuration file parser that also provides a "schema validation" engine. Within the syntax of the schema validation language, you would specify which configuration variables are required (and their types), so the validation engine could verify that those variables are present and have values that comply with their types (for example, "42" is a valid integer, but "hello, world" is not). XML has several competing schema validation languages, including XML Schema and RELAX NG. If you look on Amazon, you can find books on those. JSON also has its own schema validation language. The only other configuration language with its own schema validation language I can think of Config4*, which is one that I developed. If you want to read more about Config4*, then I suggest you read Chapters 2 and 3 of the Config4* Getting Started Guide (PDF and HTML) to get an overview of its syntax and API. Then skip to Chapter 9 to find full details of its schema validation language. The ignore rules (discussed in Section 9.2.6) can be used to specify that the schema validation engine should ignore some configuration variables/scopes.
type: Answer

http://stackoverflow.com/comment/37041112
has text: Check whether we have Another Activity entry in the AndroidManifest.Intent refer androidManifest for change from one activity to another.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24012199
type: Comment

http://stackoverflow.com/comment/37041192
score: 0
has text: @user3117081 what kind of errors? Post the traceback.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24028933

http://stackoverflow.com/comment/37128209
type: Comment
type: QuestionComment
has text: Yes, but i don't understand why, i see i have 2 objects, but why is that happening? What happened when i use "new" to an already exciting object?
comment on: http://stackoverflow.com/q/24076075
score: 0

http://stackoverflow.com/comment/37038071
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24027229
type: QuestionComment
has text: What's the point of me asking senior guys with more experience if all you're going to do is downvote me and respond with "Look up how to do it"

http://stackoverflow.com/comment/37177947
score: 0
has text: FileIOManagement(fileName.getNameList()) you are using the object name as the parameter this getting that error. what you need is to get the non empty list. you cant just get a list from within your object you instantiated
type: Comment
comment on: http://stackoverflow.com/a/24101815
type: AnswerComment

http://stackoverflow.com/q/23948906
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23948958
has title: android.view.View.requestLayout(View.java:16431)
answer count: 1
tagged with: settext
tagged with: handler
tagged with: httphandler
favorite count: 0
upvote count: 2
has body: We're working in an android app with the 4 version and we need a mysql connection. We are doing this with a php file which returns the data base result. The following code are working because if we debug the project we can see the correct database result in the the System.out.println. line. But, if we try to change one text in our app for the result of the database our app can’t run correctly and the error was in the t.setText(txt); line. Can anybody help me with this problem? Do you have another idea to do the database connection or is it the correct way? Thanks a lot. My code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //FUNCIONA NO BORRAR final httpHandler handler = new httpHandler(); Thread thread = new Thread() { @Override public void run() { try { if(true) { sleep(1000); String txt = handler.post("http://www.golftipp.com/pruebas_android/app.php"); TextView t = (TextView) findViewById(R.id.textView2); t.setText(txt); System.out.println(txt); } } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); } The error 05-30 02:42:50.331 1276-1291/es.softline.connexiodb.app E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-87 Process: es.softline.connexiodb.app, PID: 1276 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:824) at android.view.View.requestLayout(View.java:16431) at android.view.View.requestLayout(View.java:16431) at android.view.View.requestLayout(View.java:16431) at android.view.View.requestLayout(View.java:16431) at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:352) at android.view.View.requestLayout(View.java:16431) at android.widget.TextView.checkForRelayout(TextView.java:6600) at android.widget.TextView.setText(TextVi…
has answer: http://stackoverflow.com/a/23948958
tagged with: android
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/37038258
comment on: http://stackoverflow.com/a/24011634
type: AnswerComment
score: 0
type: Comment
has text: yes you're right @Manu. Please see edit 2 above.

http://stackoverflow.com/q/24011735
tagged with: java
has body: Here i have Bookfolder in that few more folders(english,hindi,japanese).Converting english,hindi,japanese to english.zip,hindi.zip and japanese.zip.Everything is working fine and i'm keeping zip files and folders inside Bookfolder,this thing i'm doing using with java.But when i'm unzipping manually the zip file ex:english.zip ,right click on that extract here then showing error as UNEXPECTED END OF ARCHIVE.This is my code. public void foldertToZip(File zipDeleteFile) { //System.out.println(zipDeleteFile); File directoryToZip = zipDeleteFile; List&lt;File&gt; fileList = new ArrayList&lt;&gt;(); //System.out.println("---Getting references to all files in: " + directoryToZip.getCanonicalPath()); getAllFiles(directoryToZip, fileList); //System.out.println("---Creating zip file"); writeZipFile(directoryToZip, fileList); //System.out.println("---Done"); } public static void getAllFiles(File dir, List&lt;File&gt; fileList) { try { File[] files = dir.listFiles(); for (File file : files) { fileList.add(file); if (file.isDirectory()) { System.out.println("directory:" + file.getCanonicalPath()); getAllFiles(file, fileList); } else { System.out.println("file:" + file.getCanonicalPath()); } } } catch (IOException e) { } } public static void writeZipFile(File directoryToZip, List&lt;File&gt; fileList) { try { //try (FileOutputStream fos = new FileOutputStream(directoryToZip.getName() + ".zip"); ZipOutputStream zos = new ZipOutputStream(fos)) { File path = directoryToZip.getParentFile(); File zipFile = new File(path, directoryToZip.getName() + ".zip"); try (FileOutputStream fos = new FileOutputStream(zipFile)) { ZipOutputStream zos = new ZipOutputStream(fos); for (File file : fileList) { if (!file.isDirectory()) { // we only zip files, not directories addToZip(directoryToZip, file,zos); } } } } catch (FileNotFoundException e) { } catch (IOException e) { } } public static void addToZip(File directoryToZip, File file, ZipOutputStream zos) throws FileNotFoundException, IOException { …
accepted answer: http://stackoverflow.com/a/24012332
type: Question
tagged with: unzip
has title: Unzipping(extracting zip)file showing error,unexpected end of archive
has answer: http://stackoverflow.com/a/24012332
possible better answer: http://stackoverflow.com/a/75069087
answer count: 2
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/75069087
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/37117220
comment on: http://stackoverflow.com/q/24064178
score: 0
type: Comment
type: QuestionComment
has text: A good question. I have started to think about how I would figure this out. Probably someone else has already done so and I need to poke around the net.

http://stackoverflow.com/q/24036602
tagged with: arrays
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37055032
has comment: http://stackoverflow.com/comment/37055047
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37054913
has title: Arranging numbers, but outputting variable names
has body: I have got a few variables, and would like to arrange the variables in descending order in an array or arraylist. The problem is once it's arranged, I would like to print out the variable names, so I want an array/arraylist that would output: three3,eight8,four4,five5,six6,seven7 instead of 32,29,25,19,11,11. How would I get around this problem? double three3 = 32; double four4 = 25; double five5 = 19; double six6 = 11; double seven7 = 11; double eight8 = 29; Thanks
has comment: http://stackoverflow.com/comment/37055089
type: Question
has answer: http://stackoverflow.com/a/24036658
tagged with: java
has answer: http://stackoverflow.com/a/24037045
score: 0
answer count: 2

http://stackoverflow.com/q/23986792
has title: Multiple java commands with script
has comment: http://stackoverflow.com/comment/36962109
tagged with: shell
tagged with: macos
favorite count: 0
tagged with: terminal
has answer: http://stackoverflow.com/a/23987247
has body: all. I have a quick question. I have a bunch of files named test01.vc, test02.vc, .., test84.vc. These are source code for a subset of c. Now I want to automatically test my compiler. So what I want to do is basically run three commands on each source file automatically. The commands are, in order: java VC.vc testXX.vc java jasmin.Main testXX.j java testXX How do I write a terminal script that does this for each file?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23987803
answer count: 2
accepted answer: http://stackoverflow.com/a/23987247
downvote count: 0
possible better answer: http://stackoverflow.com/a/23987803

http://stackoverflow.com/q/24003582
has comment: http://stackoverflow.com/comment/37001496
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24205036
answer count: 5
has answer: http://stackoverflow.com/a/24774448
has body: So I'm trying to make custom buttons, for which I need to combine different parts of the button background. To do this I figured using a FrameBuffer would work, however it did not give viable results. Therefore I attempted to test my FrameBuffer drawing method, by writing a simple test method, which returns a texture that is drawn to the display at every render() call. This method is here (note that it is a test method, so it may be a little poorly optimized): private Texture test() { BitmapFont f = ReverseBlade.fontTitle; f.setColor(Color.LIGHT_GRAY); FrameBuffer fbo = new FrameBuffer(Format.RGBA8888, (int)f.getBounds("Hi").width, (int)f.getBounds("Hi").height, false); Batch b = ReverseBlade.batch; OrthographicCamera c = new OrthographicCamera(fbo.getWidth(), fbo.getHeight()); c.setToOrtho(false); c.update(); b.setProjectionMatrix(c.combined); fbo.begin(); b.begin(); f.draw(b, "Hi", 0, 0); b.end(); fbo.end(); Texture t = fbo.getColorBufferTexture(); fbo.dispose(); b.setProjectionMatrix(ReverseBlade.camera.combined); return t; } However, nothing is displayed. The screen is dark... I have tried without the camera and multiple other variations that I can no longer remember. What am I doing wrong? Half Solution What I ended up having to do is to make a new Matrix4 object for the FrameBuffer like this: Matrix4 m = new Matrix4(); m.setToOrtho2D(0, 0, fbo.getWidth(), fbo.getHeight()); batch.setProjectionMatrix(m); However, this makes everything that is drawn be upside down, like this:
has comment: http://stackoverflow.com/comment/37003702
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37035761
tagged with: opengl
tagged with: java
has answer: http://stackoverflow.com/a/24047185
has title: LibGDX - Drawing to a FrameBuffer does not work
type: Question
tagged with: framebuffer
accepted answer: http://stackoverflow.com/a/24047185
has answer: http://stackoverflow.com/a/24009315
tagged with: libgdx
has answer: http://stackoverflow.com/a/31857479
downvote count: 0
possible better answer: http://stackoverflow.com/a/24009315

http://stackoverflow.com/comment/37123094
score: 0
has text: @JustinPancakeRazon, `I would simply create a ListCellRenderer for` - and just using a custom renderer will break the default functionality of the combo box since you can no longer use the keyboard to select items in the combo box. See [Combo Box With Custom Renderer](http://tips4java.wordpress.com/2013/11/17/combo-box-with-custom-renderer/) for more information and a possible solution.
comment on: http://stackoverflow.com/a/24072131
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24013375
tagged with: java
has answer: http://stackoverflow.com/a/26266834
type: Question
upvote count: 2
tagged with: google-maps
has body: So, I have two fragments (F1 and F2), F1 contains the maps fragment, F2 contains some data. so when i load fragment F1, the map load perfectly, but when i go to fragment F2 and come back to fragment one via button click(which loads the fragment again), i get the following error: 06-03 16:13:56.227: E/AndroidRuntime(7748): FATAL EXCEPTION: main 06-03 16:13:56.227: E/AndroidRuntime(7748): android.view.InflateException: Binary XML file line #7: Error inflating class fragment 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 06-03 16:13:56.227: E/AndroidRuntime(7748): at com.porcupyne.mumbaifoodlovers.MapsFragment.onCreateView(MapsFragment.java:46) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.app.Fragment.performCreateView(Fragment.java:1695) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.app.BackStackRecord.run(BackStackRecord.java:694) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.os.Handler.handleCallback(Handler.java:725) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.os.Handler.dispatchMessage(Handler.java:92) 06-03 16:13:56.227: E/AndroidRuntime(7748): at android.os.Looper.loop(Loop…
linked to: http://stackoverflow.com/q/20919048
tagged with: android
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/48761399
has title: Maps in Fragment[IllegalArgumentException: Binary XML file line #7: Duplicate id]
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37013519
has comment: http://stackoverflow.com/comment/37011834
score: 2
has comment: http://stackoverflow.com/comment/37011636
downvote count: 0
tagged with: android-fragments

http://stackoverflow.com/q/24034974
accepted answer: http://stackoverflow.com/a/24054650
has title: Inject an EJB through the setter method
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cdi
type: AnsweredQuestion
score: 1
has body: I'm defining a Java EE bean as follows: @LocalBean @Stateless public class GreetingBean { private HelloBean helloBean; @Inject public void setHelloBean(HelloBean helloBean) { this.helloBean = helloBean; } // ... } And: @Named public class HelloBean { public HelloBean() { // ... } public HelloBean(String hello) { // ... } } Now, how can I inject the GreetingBean into another class by also setting an HelloBean instance for it? Supposing that I've two different constructors for the HelloBean class (the one with an argument, for instance a String, the other without [default]), how can I properly inject either?
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37084436
tagged with: ejb
tagged with: java
has comment: http://stackoverflow.com/comment/37088124
has answer: http://stackoverflow.com/a/24054650

http://stackoverflow.com/comment/36997201
type: Comment
type: AnswerComment
has text: first time it works , after that it fails.
score: 0
comment on: http://stackoverflow.com/a/24005317

http://stackoverflow.com/a/23949783
type: Answer
has body: window.location = 'Survey_Questions.jsp'; Will just redirect to a page and it will not pass your request object to other documents. Instead you can use below lines of code: RequestDispatcher rd = request.getRequestDispatcher("Survey_Questions.jsp"); rd.forward(request, response); RequestDispatcher helps you to forward your request to other pages. Also, use getAttribute instead of getParameter as you have used setAttribute to set myMap on First.jsp.
score: 1
answers question: http://stackoverflow.com/q/23949625
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/37110706
score: 0
comment on: http://stackoverflow.com/a/24064697
has text: That is one partial solution yes, however, it's still not quite what I'm looking for. +1 for being helpful!
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24015924
has comment: http://stackoverflow.com/comment/37025158
answer count: 2
downvote count: 0
has title: org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to org.apache.axiom.om.OMElement
has answer: http://stackoverflow.com/a/24020659
favorite count: 0
has answer: http://stackoverflow.com/a/24021181
possible better answer: http://stackoverflow.com/a/24020659
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: axiom
upvote count: 1
accepted answer: http://stackoverflow.com/a/24021181
type: Question
has comment: http://stackoverflow.com/comment/37016679
tagged with: java
has body: I'm trying to do the following. OMElement soapEnvelope = new StAXOMBuilder(soapEnvelopXMLFilePath).getDocumentElement(); OMElement firstElement = soapEnvelope.getFirstElement().getFirstElement(); Then i iterate through the child elements of the firstElement like this. Iterator&lt;OMElement&gt; items = firstElement.getChildren(); while (items.hasNext()) { OMElement element = items.next(); // ....do some processing here... } But when i try to execute this following class cast exception occurs. java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to org.apache.axiom.om.OMElement The error occurs when items.next() is assigned to element OMElement object. Any idea why i'm getting this exception? I can't figure out any mismatch. These are the contents of my sample xml file. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soapenv:Body&gt; &lt;ns:MONITOR xmlns:ns="http://try.example.com"&gt; &lt;ns:HOSTS&gt; &lt;ns:HOST NAME="node1"&gt; &lt;ns:METRIC NAME="metric1" VALUE="1123"/&gt; &lt;ns:METRIC NAME="metric3" VALUE="456"/&gt; &lt;ns:METRIC NAME="metric2" VALUE="789"/&gt; &lt;/ns:HOST&gt; &lt;ns:HOST NAME="node2"&gt; &lt;ns:METRIC NAME="metric1" VALUE="147"/&gt; &lt;ns:METRIC NAME="metric3" VALUE="258"/&gt; &lt;ns:METRIC NAME="metric2" VALUE="369"/&gt; &lt;/ns:HOST&gt; &lt;/ns:HOSTS&gt; &lt;ns:HOSTS&gt; &lt;ns:HOST NAME="node3"&gt; &lt;ns:METRIC NAME="metric1" VALUE="236"/&gt; &lt;ns:METRIC NAME="metric3" VALUE="159"/&gt; &lt;ns:METRIC NAME="metric2" VALUE="478"/&gt; &lt;/ns:HOST&gt; &lt;/ns:HOSTS&gt; &lt;/ns:MONITOR&gt; &lt;/soapenv:Body&gt; Thanks.
has comment: http://stackoverflow.com/comment/37025216
has comment: http://stackoverflow.com/comment/37020099

oracle-database
tags question: http://stackoverflow.com/q/23978895
tags question: http://stackoverflow.com/q/23953534
tags question: http://stackoverflow.com/q/23998008
tags question: http://stackoverflow.com/q/24018198
tags question: http://stackoverflow.com/q/24030118
tags question: http://stackoverflow.com/q/24029735
tags question: http://stackoverflow.com/q/24037285
tag name: oracle-database
tags question: http://stackoverflow.com/q/24091946
tags question: http://stackoverflow.com/q/24047242
tags question: http://stackoverflow.com/q/24038504
tags question: http://stackoverflow.com/q/23945427
tags question: http://stackoverflow.com/q/24016458
type: Tag
tags question: http://stackoverflow.com/q/24026329
tags question: http://stackoverflow.com/q/24058144
tags question: http://stackoverflow.com/q/24037673
tags question: http://stackoverflow.com/q/24055944
tags question: http://stackoverflow.com/q/24087391
tags question: http://stackoverflow.com/q/23984185
tags question: http://stackoverflow.com/q/24035128
tags question: http://stackoverflow.com/q/24011258
tags question: http://stackoverflow.com/q/24058989
tags question: http://stackoverflow.com/q/23955391
tags question: http://stackoverflow.com/q/24008395
tags question: http://stackoverflow.com/q/23977324
tags question: http://stackoverflow.com/q/23982301
tags question: http://stackoverflow.com/q/24041904
tags question: http://stackoverflow.com/q/23948144
tags question: http://stackoverflow.com/q/24076434
tags question: http://stackoverflow.com/q/24075267

http://stackoverflow.com/comment/37175769
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24100970
has text: @BoristheSpider i want all three threads to run all at the same. with each pausing and calling for another to continue in it's place.

http://stackoverflow.com/comment/37040865
type: Comment
comment on: http://stackoverflow.com/q/24028581
type: QuestionComment
has text: I think you would be getting NetworkOnMainThread Exception. If so, call getHttpGet() in AsyncTask or new Thread(){@Override public void run(){//code here}}.start();
score: 1

http://stackoverflow.com/a/23975307
has body: You can implement the PointLabeler interface to get the behavior you're after; you need to set the PointLabeler for each series that should use the custom formatting. For example: series1.setPointLabeler(new PointLabeler() { DecimalFormat df = new DecimalFormat("###.###"); @Override public String getLabel(XYSeries series, int index) { return df.format(series.getY(index)); } }); It's a little less intuitive than applying formatting to domain and range labels but was necessary in order to allow each series to have its own point labeling scheme.
type: Answer
accepted answer of: http://stackoverflow.com/q/23967835
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23967835
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37164970
comment on: http://stackoverflow.com/q/24095516
score: 0
type: Comment
type: QuestionComment
has text: Your `Scanner` is splitting on whitespace by default.

http://stackoverflow.com/comment/37109787
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24060862
score: 0
has text: @MisterSmith yes, app is getting recreated

http://stackoverflow.com/comment/36974526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23993440
has text: There are no other options. You took all the options off the table. Either you are going to store them locally in a cookie, which I think is a bad idea, or you will store them remotely on the server. If the only issue with server-side is that you can't use a DB, then store it some other way, like a flat file (also not recommended, but not sure what the requirements are so hard to say) or keep it in-memory in Cache.
score: 0

http://stackoverflow.com/comment/36903654
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23955730
has text: You already are injecting it, actually. It's just that once you've received a request, you're throwing away the injected object and creating a new one to replace it.

http://stackoverflow.com/comment/37126691
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24074872
type: Comment
has text: @AlvinThompson Take a look at the line labelled (1) in the original post. The left and right hand side types are not identical, yet this is (of course) legal Java. He wants to know why he can't do a similar thing on line (2).

http://stackoverflow.com/a/23946271
has comment: http://stackoverflow.com/comment/36904560
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23946253
upvote count: 2
has body: Actually, if you were to output the string created, you have the following statement: select p.telefone, p.celular, u.emailfrom prestador as p inner join usuario as u on p.usuario = u.idusuario where p.idprestador=? -- ^^^^^ I think you can see the problem.
type: Answer

http://stackoverflow.com/a/44826982
upvote count: 40
has comment: http://stackoverflow.com/comment/103464433
type: Answer
has body: You can add spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration to your application.properties file.
has comment: http://stackoverflow.com/comment/92751447
downvote count: 0
score: 40
has comment: http://stackoverflow.com/comment/134287212
answers question: http://stackoverflow.com/q/24074749

http://stackoverflow.com/comment/37083354
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24051618
type: Comment
has text: I tried doing that as well but it doesn't seem to work. the 'file' variable shows the correct path, but it still doesn't seem to be deleting.

http://stackoverflow.com/comment/70337152
type: Comment
score: 1
has text: Also you should use either setOuputMarkupPlaceholderTag or setOuputMarkupId but not both, although it does not make error.
comment on: http://stackoverflow.com/a/24062007
type: AnswerComment

http://stackoverflow.com/q/24065688
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/24065706
upvote count: 3
has body: So i have this String e.g. "B\z@b@s@rB{FpMgBrD~DK|" But Spring is producing this at json: "B\\z@b@s@rB{FpMgBrD~DK|" And it's the same with any string that has a backslash \. Replacing the character before generating the json is useless, since the String is correct before the json is generated. Every client that consumes the service could .replace("\\","\\\\") the json, but I wonder if there will be a cleaner way to solve the problema and at server side. Here is the code for the WS: @RequestMapping(value = "/rest/sinc/{ms}", method = RequestMethod.GET, produces="application/json;charset=UTF-8") @ResponseBody public String sincronizar(@PathVariable("ms") Long ms) { return sincService.getSinc(ms).toString(); } I have tried other ways to generate the json with libraries like Gson but the result is the same.
has answer: http://stackoverflow.com/a/24065706
answer count: 1
favorite count: 0
tagged with: rest
has title: Java Spring: Web Service REST producing double backslash at JSON

http://stackoverflow.com/a/23989237
has comment: http://stackoverflow.com/comment/86391613
downvote count: 0
has comment: http://stackoverflow.com/comment/86391747
accepted answer of: http://stackoverflow.com/q/23989134
score: 4
has comment: http://stackoverflow.com/comment/86411301
answers question: http://stackoverflow.com/q/23989134
type: AcceptedAnswer
has body: The answer is very simple, don't use a HashTable. This is a deprecated collection kept around for backwards compatibility. Collections.synchronizedMap is indeed the current replacement for HashTable, but it's next to useless unless you are doing very specific things. ConcurrentHashMap is almost always a better default choice. Directly from the JavaDocs If a thread-safe implementation is not needed, it is recommended to use HashMap in place of Hashtable. If a thread-safe highly-concurrent implementation is desired, then it is recommended to use ConcurrentHashMap in place of Hashtable. For conversion, ConcurrentHashMap has a copy constructor: Map&lt;Integer,Integer&gt; hm = new HashMap&lt;&gt;(); Map&lt;Integer,Integer&gt; chm = new ConcurrentHashMap&lt;&gt;(hm);
type: Answer
upvote count: 4

http://stackoverflow.com/a/23999739
answers question: http://stackoverflow.com/q/23999503
has body: SomeTimes eclipse get corrupted run configuration...... For that issue three solution is there Go to Run configuration setting , inside JAva Apllication you find your project, click on that, on right panel re-path you main class file path if 1st doesn't work,take a backup of your main class ,delete it and re create new main class ,and copy the code from back up if 2nd failed .Close eclipse. Delete the .metadata directory. Start eclipse. Import the projects. Run the project again.
score: 0
type: Answer

http://stackoverflow.com/a/24086052
type: Answer
has body: You can try using Collections.synchronizedList(subscribers) which may help avoiding this problem.
answers question: http://stackoverflow.com/q/24085674
score: 0

storage
tag name: storage
tags question: http://stackoverflow.com/q/24072800
tags question: http://stackoverflow.com/q/24096748
tags question: http://stackoverflow.com/q/24080387
tags question: http://stackoverflow.com/q/23969953
type: Tag
tags question: http://stackoverflow.com/q/23999780

http://stackoverflow.com/a/24016798
type: Answer
answers question: http://stackoverflow.com/q/23974514
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23974514
has body: Hibernate 4 has now a plug-in mechanism for registering internal services (connection provider, transaction management). Therefore you could customize how the services are going to be retrieved (e.g. OSGI), so having this option allows for maximum session factory customizability.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24039578
upvote count: 1
answers question: http://stackoverflow.com/q/23958873
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23958873
score: 1
has body: findViewById(R.id.textId)).setText(GooglePlayServicesUtil.getOpenSourceSoftware‌​LicenseInfo(this)); is wrong. You didn't DECLARE a TextView before using it. Wild guess: you have a NullPointerException, right? Make sure you have a TextView with id textId in /res/layout/activity_legal_notices.xml

http://stackoverflow.com/comment/37026876
type: QuestionComment
comment on: http://stackoverflow.com/q/24021348
score: 3
has text: To rephrase you want to know if Groovy (the whole language?) is based upon Java static initializers?
type: Comment

http://stackoverflow.com/q/24010140
favorite count: 0
accepted answer: http://stackoverflow.com/a/24010893
type: Question
tagged with: scala
has answer: http://stackoverflow.com/a/50282759
upvote count: 56
has answer: http://stackoverflow.com/a/24010826
has comment: http://stackoverflow.com/comment/37006466
has answer: http://stackoverflow.com/a/35293961
score: 53
has answer: http://stackoverflow.com/a/24017767
tagged with: java
downvote count: 3
answer count: 7
linked to: http://stackoverflow.com/q/13019835
has answer: http://stackoverflow.com/a/48936165
has title: How to declare a byte array in Scala?
tagged with: arrays
has comment: http://stackoverflow.com/comment/37006691
has body: In Scala, I can declare a byte array this way val ipaddr: Array[Byte] = Array(192.toByte, 168.toByte, 1.toByte, 9.toByte) This is too verbose. Is there a simpler way to declare a Byte array, similar to Java's byte[] ipaddr = {192, 168, 1, 1}; Note that the following results in an error due to the . in the String InetAddress.getByAddress("192.168.1.1".toByte)
linked to: http://stackoverflow.com/q/48926339
possible better answer: http://stackoverflow.com/a/24010831
has comment: http://stackoverflow.com/comment/37006919
has answer: http://stackoverflow.com/a/24010831
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37006843
has answer: http://stackoverflow.com/a/24010893

http://stackoverflow.com/comment/37126695
type: AnswerComment
score: 0
type: Comment
has text: using generics, doest it mean that the getter and the setter is no more available for the field?
comment on: http://stackoverflow.com/a/24074639

http://stackoverflow.com/comment/37160658
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24092953
type: AnswerComment
has text: I figured it. I was missing a delimiter in the .txt file so it threw it out.

http://stackoverflow.com/comment/37088995
score: 1
type: AnswerComment
has text: As it seems to me: 1. Akka gives you primitives with which you can build any type of messaging system with a set of desired properties. E.g. pick any of the integration patters from here http://www.eaipatterns.com/ and there is a high chance you will be able to implement them in Akka. So I would say that generally you have more flexibility in the way you do things.
comment on: http://stackoverflow.com/a/24042674
type: Comment

http://stackoverflow.com/q/24066305
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24066771
accepted answer: http://stackoverflow.com/a/24066771
type: Question
has comment: http://stackoverflow.com/comment/37110660
has comment: http://stackoverflow.com/comment/37111087
has body: Good afternoon, Java beginner here and I have been working with this tutorial online and the tutorial supplied this code along with an XML file. It said that it was based off of inserting the XML file into MySQL but doesn't auto insert the fields. So what I have done is created a database named movie, and have created a table named 'about'. So coming from the XML there are 4 field names. I've tried creating the 4 fields inside of that table but I end up getting the error: Field:year Field:title Field:movieid Field:unsortabletitle INSERT INTO about VALUES (?,?,?,?) java.sql.SQLException: Incorrect integer value: 'The Godfather' for column 'year' at row 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1347) at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:958) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1494) at xSQLTEST.Inserter.startElement(Inserter.java:138) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.Abst…
has comment: http://stackoverflow.com/comment/37111476
tagged with: database
score: 0
answer count: 1
has title: Inserting XML file into MYSQL database
has comment: http://stackoverflow.com/comment/37111136
has comment: http://stackoverflow.com/comment/37111287
tagged with: jdbc
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/37099302
score: 0
type: Comment
has text: Class File has the ability to get list() specific path with that he can get the file he want maybe i am wrong.
type: AnswerComment
comment on: http://stackoverflow.com/a/24060440

finalize
tags question: http://stackoverflow.com/q/23992650
type: Tag
tag name: finalize

http://stackoverflow.com/q/23969950
tagged with: append
type: AnsweredQuestion
has title: Append data to file in hadoop using java api
type: Question
has comment: http://stackoverflow.com/comment/36937466
tagged with: java
has comment: http://stackoverflow.com/comment/75483959
has answer: http://stackoverflow.com/a/24038277
tagged with: hadoop
score: 0
has body: I have created a file with the results of a sequence of map-reduce jobs. The program i' ve made iteratively outputs some results. I want to append those data in the result file using the java api. I have tried fs.append but it doesn't work. For the time being I am using built-in libraries of java (eclipse 4.2.2) and when I'm ok with the debugin I'll make it a jar and throw it in a cluster. First of all, is "append" accepted in hdfs? And if yes can anyone tell me how it's done? Thnx in advance. The code I am using to do this job is the following: try{ Path pt = new Path("/home/results.txt"); FileSystem fs = FileSystem.get(new Configuration()); BufferedWriter br = new BufferedWriter(new OutputStreamWriter(fs.append(pt))); String line = "something"; br.write(line); br.close(); } catch (Exception e) { System.out.println("File not found"); }
tagged with: filesystems
has comment: http://stackoverflow.com/comment/75483886
has comment: http://stackoverflow.com/comment/36982943
answer count: 1
tagged with: hdfs
accepted answer: http://stackoverflow.com/a/24038277
linked to: http://stackoverflow.com/q/22997137

http://stackoverflow.com/comment/37135587
has text: Oh no. It's really my problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/24080145
score: 0
type: Comment

http://stackoverflow.com/comment/37085457
type: AnswerComment
type: Comment
has text: Can you elaborate your answer with some example.So,I can understand it properly and thanks in advance.
comment on: http://stackoverflow.com/a/24052766
score: 0

http://stackoverflow.com/comment/37053960
comment on: http://stackoverflow.com/a/24036077
type: AnswerComment
score: 0
has text: Thank you for the information. Application can have the same names , but it should differ from the package. Got it.
type: Comment

http://stackoverflow.com/q/24015198
tagged with: mysql
type: Question
tagged with: null
has title: Method returns NULL value for object list
tagged with: jsp
has body: I am attempting to learn Java JBDC by developing a web application using jsp and servlet files. Currently I want to return a list of Category objects, where these Objects represent a row in the ResultSet. Each row should contain cat_id and cat_name. The crm_categories table looks like this in the MySQL database. In the index.jsp file I instantiate a JDBC and call the getCategories() method like so: dbCon conn = new dbCon(); List&lt;Object&gt; catList; // get a list of all categories catList = conn.getCategories(); The following is the dbCon class which I have simplified: @WebServlet(description = "Handles connection to MySql database", urlPatterns = { "/dbh" }) public class dbCon extends HttpServlet { private static final long serialVersionUID = 1L; private static Connection conn; private static final String driver = "com.mysql.jdbc.Driver", host = "jdbc:mysql://hostname/", dbName = "dbname", username = "name", password = "pow"; String sql; ResultSet rs; PreparedStatement prep; Post post; Category cat; List&lt;Object&gt; catList; /** * @see HttpServlet#HttpServlet() */ public dbCon() { try{ rs = null; prep = null; conn = getConnection(); } catch (Exception e){ e.printStackTrace(); } } public static Connection getConnection() throws Exception { try{ Class.forName(driver); Connection conn = (Connection) DriverManager.getConnection(host + dbName, username, password); return conn; } catch(Exception e){ e.printStackTrace(); } return conn; } public List&lt;Object&gt; getCategories() throws Exception{ try{ this.catList = new ArrayList&lt;Object&gt;(); sql = "SELECT cat_id, cat_name FROM crm_categories"; prep = conn.prepareStatement(sql); rs = prep.executeQuery(); while(rs.next()){ cat = new Category(); cat.setAttributes(rs.getInt("cat_id"), rs.getString("cat_name")); catList.add(cat); } } catch(Exception e){ e.printStackTrace(); } return catList; } Category Class: @WebServlet("/Category") public class Category extends HttpServlet { private static final long serialVersionUI…
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/24015498
tagged with: java

http://stackoverflow.com/q/24042095
accepted answer: http://stackoverflow.com/a/24047063
has body: I have a stored Files @ Oracle DB at LONG type column. Now i need to open it without making the same file. How it can be done ? Sample code who makes the file at Eclipse workplace. How to adjust it do not making File at file system ? Thanks for answers! The right answers guaranteed! session.doWork(new Work() { public void execute(Connection connection) throws SQLException { String sql = (" SELECT failas,aprasymas,ispletimas FROM ZALA.claims_additional_doc_v where id = ? "); PreparedStatement stmt = null; ResultSet rs = null; try { stmt = connection.prepareStatement(sql); stmt.setLong(1, papId); rs = stmt.executeQuery(); if (rs.next()) { byte[] bytes = rs.getBytes(1); String fileName = rs.getString(2); // String fileType = rs.getString(3); FileOutputStream fileO = null; String userHomeFolder = System.getProperty("user.home") + "\\Downloads"; try { fileO = new FileOutputStream(userHomeFolder + "\\" + fileName); fileO.write(bytes); fileO.close(); File file = new File(userHomeFolder + "\\" + fileName); if (Desktop.isDesktopSupported()) { try { if (file.toString().endsWith(".pdf")) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file); else { Desktop desktop = Desktop.getDesktop(); desktop.open(file); } } catch (IOException ex) { log.debug("err @ runtime" + ex.getMessage()); } } } catch (Exception e) { String err = e.toString(); log.debug("err @ stream" + err); } finally { if (fileO != null) { fileO.close(); } } } } catch (Exception e) { e.printStackTrace(); new DisnetErrorHandler().handleError(e); } SaveUtility.closeRsAndStmt(rs, stmt); } });
has comment: http://stackoverflow.com/comment/37065435
has comment: http://stackoverflow.com/comment/37065498
score: 0
has comment: http://stackoverflow.com/comment/37065630
tagged with: file-io
linked to: http://stackoverflow.com/q/4317035
answer count: 1
tagged with: file-upload
has comment: http://stackoverflow.com/comment/37066270
has comment: http://stackoverflow.com/comment/37065670
has answer: http://stackoverflow.com/a/24047063
has comment: http://stackoverflow.com/comment/37072817
type: AnsweredQuestion
tagged with: java
tagged with: file
has title: How to open a File (image,pdf, utc...) without making it
type: Question

http://stackoverflow.com/comment/37148563
type: AnswerComment
type: Comment
has text: I will accept it once I try it on Tuesday (holiday on monday here in Germany). Thanks for all the help!
score: 0
comment on: http://stackoverflow.com/a/24083747

http://stackoverflow.com/comment/37039331
comment on: http://stackoverflow.com/q/24027827
type: Comment
score: 0
type: QuestionComment
has text: I think you need `for (List<String> list : map.values()) {` - note that I've changed the name of your `Map` from `list` (which it isn't) to `map` (which it is).

http://stackoverflow.com/comment/68578364
type: AnswerComment
comment on: http://stackoverflow.com/a/23992070
has text: According to the definition of big O. O(2N) = O(3N+1) = O(N), which is why it's canonical to write O(N). I'm not arguing that O(2N) is faster/slower than O(N). Some discussions on SO: http://stackoverflow.com/questions/25777714/which-algorithm-is-faster-on-or-o2n , Quora (https://www.quora.com/In-big-O-notations-why-O-2n-is-equal-to-O-n) etc.
score: 0
type: Comment

http://stackoverflow.com/q/23942763
answer count: 1
type: UnansweredQuestion
tagged with: cdata
has comment: http://stackoverflow.com/comment/39175959
tagged with: http://stackoverflow.com/tag/xml
has title: Java CDATA extract xml
has answer: http://stackoverflow.com/a/25162794
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/4314342
linked to: http://stackoverflow.com/q/20489560
type: Question
linked to: http://stackoverflow.com/q/967420
has body: For some reason someone changed the webService xml response that I needed. So now, the imformation I need to fetch is inside a CDATA tag. The thing is that all "<" and ">" characters have been replaced with "<" and ">". Example how it should look like: <MapAAAResult><!CDATA[ http://tstgis.xxxxxxx.xxx/gis_n/WebService1/Users/Image/xxxxxbinkor4.png|vialcap:2 234 <nbrProcess>97` .... And this is how I am receiving it: <MapAAAResult> <mapa>http://tstgis.xxxxxxx.xxx/gis_n/WebService1/Users/Image/xxxxxxxxbi542m4.png|vialcap:1 234 <nbrProcess>97 ..... How can I do to get the information back to its original form? More exactly how can I transform that information back to an xml? Any ideas? Thanks!!

http://stackoverflow.com/comment/36916236
type: Comment
type: QuestionComment
has text: Please elaborate what you have already tried and where you are struggeling to solve the issue with your own recommendation to use `ArrayList`.
comment on: http://stackoverflow.com/q/23962074
score: 0

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/24058913
type: Tag

http://stackoverflow.com/comment/36973229
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23992741
has text: See my extended answer.
score: 0

http://stackoverflow.com/a/24238219
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: Xtend is a general purpose language. You could call it a "better Java". This is especially true for templating, because Xtend has nice template expressions. So if you want your generator code to be more readable, you could replace some Java classes with Xtend classes. You don't need to rewrite everything, Xtend interoperates seamlessly with Java. Just rewrite the parts that benefit most from Xtend's rich language features.
accepted answer of: http://stackoverflow.com/q/24028903
answers question: http://stackoverflow.com/q/24028903
type: AcceptedAnswer

http://stackoverflow.com/q/24026633
has comment: http://stackoverflow.com/comment/37036896
score: 0
has answer: http://stackoverflow.com/a/24026989
has comment: http://stackoverflow.com/comment/37036864
has comment: http://stackoverflow.com/comment/37037082
answer count: 1
tagged with: user-interface
tagged with: frame
has comment: http://stackoverflow.com/comment/37036931
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37037038
tagged with: animation
has body: I'm trying to move a ball across a frame. I have the up, down, left, and right motion going fine. But when I try to move diagonally, it doesn't seem to work. Here is my code. First I declare some sets; pressed is the keys pressed, and the others are combinations of keys to move the ball up and left so on so forth; public Set&lt;Integer&gt; pressed = new HashSet&lt;&gt;(); public Set&lt;Integer&gt; upLeft, upRight, downLeft, downRight; Next, in my init method I start to add the integer values to the sets and add key listeners to my frame: private void myInit(){ ... // cut down code from above int[] a = new int[2]; a[0] = 38; a[1] = 37; upLeft = new HashSet(Arrays.asList(a)); a[1] = 39; upRight = new HashSet(Arrays.asList(a)); a[0] = 40; a[1] = 37; downLeft = new HashSet(Arrays.asList(a)); a[1] = 39; downRight = new HashSet(Arrays.asList(a)); addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { formKeyPressed(evt); } }); addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { formKeyReleased(evt); } }); } Now here are my methods to handle the key pressed and released: public synchronized void formKeyPressed(java.awt.event.KeyEvent evt) { pressed.add(evt.getKeyCode()); System.out.println("Added:"+evt.getKeyCode()); if(pressed.size() == 1) { System.out.println("Size is 1"); if(evt.getKeyCode() == evt.VK_UP) { if(y &lt;= 25) { y = 25; } else { y = y - yUpSpeed; } } if(evt.getKeyCode() == evt.VK_DOWN) { if(y &gt;= (500-25)) { y = (500-25); } else { y = y + yDownSpeed; } } if(evt.getKeyCode() == evt.VK_LEFT) { if(x &lt;= 0) { x = 0; } else { x = x - xLeftSpeed; } } if(evt.getKeyCode() == evt.VK_RIGHT) { if(x &gt;= (500-25)) { x = (500-25); } else { x = x + xRightSpeed; } } } else if(pressed.size() == 2) { System.out.println("Size is 2"); if(pressed.containsAll(upLeft)) { if(y &lt;= 25) { y = 25; } else { y = y - yUpSpeed; } if(x &lt;= 0) { x = 0; } else { x = x - xLeftSpeed; }…
has comment: http://stackoverflow.com/comment/37036911
has comment: http://stackoverflow.com/comment/37037026
tagged with: java
tagged with: set
has comment: http://stackoverflow.com/comment/37036877
type: Question
has title: Java multiple keys pressed
has comment: http://stackoverflow.com/comment/37036997
has comment: http://stackoverflow.com/comment/37037206
has comment: http://stackoverflow.com/comment/37036857

regex
tags question: http://stackoverflow.com/q/24030551
tags question: http://stackoverflow.com/q/24004038
tags question: http://stackoverflow.com/q/24006414
tags question: http://stackoverflow.com/q/23954194
tags question: http://stackoverflow.com/q/23967654
tags question: http://stackoverflow.com/q/24057901
tags question: http://stackoverflow.com/q/23974152
tag name: regex
tags question: http://stackoverflow.com/q/24095832
tags question: http://stackoverflow.com/q/24042516
tags question: http://stackoverflow.com/q/23996609
tags question: http://stackoverflow.com/q/23974982
tags question: http://stackoverflow.com/q/24061474
tags question: http://stackoverflow.com/q/24040293
tags question: http://stackoverflow.com/q/24008946
tags question: http://stackoverflow.com/q/24079425
tags question: http://stackoverflow.com/q/24055158
tags question: http://stackoverflow.com/q/23989811
tags question: http://stackoverflow.com/q/23965410
tags question: http://stackoverflow.com/q/24041809
tags question: http://stackoverflow.com/q/24021344
tags question: http://stackoverflow.com/q/24062782
tags question: http://stackoverflow.com/q/24007441
tags question: http://stackoverflow.com/q/24078662
tags question: http://stackoverflow.com/q/24065020
tags question: http://stackoverflow.com/q/23961684
tags question: http://stackoverflow.com/q/23975600
tags question: http://stackoverflow.com/q/24015575
tags question: http://stackoverflow.com/q/23958550
tags question: http://stackoverflow.com/q/24033679
tags question: http://stackoverflow.com/q/24090264
tags question: http://stackoverflow.com/q/23964430
tags question: http://stackoverflow.com/q/24074650
tags question: http://stackoverflow.com/q/23954218
tags question: http://stackoverflow.com/q/23961935
tags question: http://stackoverflow.com/q/24064630
tags question: http://stackoverflow.com/q/24048308
tags question: http://stackoverflow.com/q/23956734
tags question: http://stackoverflow.com/q/24008657
tags question: http://stackoverflow.com/q/23975716
tags question: http://stackoverflow.com/q/24086126
tags question: http://stackoverflow.com/q/24001821
tags question: http://stackoverflow.com/q/23991984
tags question: http://stackoverflow.com/q/24012522
tags question: http://stackoverflow.com/q/23996539
tags question: http://stackoverflow.com/q/24063818
tags question: http://stackoverflow.com/q/24102835
tags question: http://stackoverflow.com/q/24054132
tags question: http://stackoverflow.com/q/24087556
tags question: http://stackoverflow.com/q/23967997
tags question: http://stackoverflow.com/q/24076167
tags question: http://stackoverflow.com/q/24051150
tags question: http://stackoverflow.com/q/24015662
tags question: http://stackoverflow.com/q/24095516
tags question: http://stackoverflow.com/q/24033995
tags question: http://stackoverflow.com/q/23949338
tags question: http://stackoverflow.com/q/24032554
tags question: http://stackoverflow.com/q/23960479
tags question: http://stackoverflow.com/q/23991281
tags question: http://stackoverflow.com/q/24006192
tags question: http://stackoverflow.com/q/24022752
tags question: http://stackoverflow.com/q/23996352
tags question: http://stackoverflow.com/q/23966149
tags question: http://stackoverflow.com/q/23999582
tags question: http://stackoverflow.com/q/24015314
tags question: http://stackoverflow.com/q/24027699
tags question: http://stackoverflow.com/q/24081118
tags question: http://stackoverflow.com/q/24084339
tags question: http://stackoverflow.com/q/23994364
tags question: http://stackoverflow.com/q/24093549
tags question: http://stackoverflow.com/q/24099607
tags question: http://stackoverflow.com/q/24030892
type: Tag
tags question: http://stackoverflow.com/q/24033274
tags question: http://stackoverflow.com/q/24011997

http://stackoverflow.com/comment/37123416
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24073352
type: Comment
has text: I would use a String.split ("-"); and go from there.

http://stackoverflow.com/q/24083973
has comment: http://stackoverflow.com/comment/37142683
has comment: http://stackoverflow.com/comment/37144838
answer count: 0
type: UnansweredQuestion
has body: I'll make it short and quick. I have an enum that represents "commands", the commands are sent of the net so they're translate from chars to bytes - public static enum Command { EXIT('E'), PLAY('P'), OK('O'), ROTATE('R'), FORWARD('W'), BACKWARD('S'), LIFT('L'), TURRET('T'), FIRE('F'); private final byte command; private Command(char command) { this.command = ((byte) (command &amp; 0xFF)); } public byte asByte() { return command; } public char asChar() { return (char) command; } } But, for some reason I'm getting the following error while trying to "switch" them - constant expression required Here is the switch statement: public void readData(byte[] data) { switch (data[0]) { case Command.PLAY.asByte(): sendCommand(new byte[]{Command.OK.asByte(), 0}); break; } } The switch isn't complete due to the error. Any help would be welcomed.
tagged with: java
tagged with: switch-statement
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/37143939
has title: Using enums inside a switch statement Java
score: 0
duplicate of: http://stackoverflow.com/q/3827393
has comment: http://stackoverflow.com/comment/37142872
linked to: http://stackoverflow.com/q/3827393

http://stackoverflow.com/comment/37038993
comment on: http://stackoverflow.com/q/24011258
score: 1
type: Comment
has text: What is the connectivity to the database? A socket read timeout /can/ indicate that the socket connection was silently terminated. This is more common when a vpn and/or firewalls are in play.
type: QuestionComment

http://stackoverflow.com/a/23943816
score: 0
accepted answer of: http://stackoverflow.com/q/23943592
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23943592
type: Answer
has body: Don't know if it was intentional or not, but in your for loop you seem to be incrementing the wrong value (i instead of j)... for (i = 0; i &lt; File_1.length-1; i++) { for(int j=0;j&lt; File_2.length; j++) { if(File_1[i].ID != null &amp;&amp; File_2[j].ID != null &amp;&amp; File_1[i].Relation != null &amp;&amp; File_2[j].Relation !=null) { if(File_1[i].ID.equals(File_2[j].ID) &amp;&amp; File_1[i].Relation.equals(File_2[j].Relation)) { if(!(File_1[i].Result.equals(File_2[j].Result))) { System.out.println(File_1[i].ID); System.out.println(File_1[i].Relation); System.out.println(File_1[i].Result); if(File_1[i].Comment != null) System.out.println(File_1[i].Comment); } } } } }

stack-overflow
tags question: http://stackoverflow.com/q/24043145
tags question: http://stackoverflow.com/q/23995856
tag name: stack-overflow
tags question: http://stackoverflow.com/q/23976579
type: Tag
tags question: http://stackoverflow.com/q/24055397

http://stackoverflow.com/comment/37113709
type: QuestionComment
has text: So, do you have an executable `/usr/local/java/jre1.7.0_60/bin/java` or not? Post `ls` or something.
comment on: http://stackoverflow.com/q/24067858
score: 0
type: Comment

http://stackoverflow.com/comment/37047557
score: 0
type: Comment
type: QuestionComment
has text: What's the stack trace for the assertion error? And are you sure that the arguments to `getValidationDate` are the same ones your real code will be passing?
comment on: http://stackoverflow.com/q/24031861

http://stackoverflow.com/a/23941964
upvote count: 8
type: AcceptedAnswer
type: Answer
score: 8
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23941868
has body: You are performing integer arithmetic when you are multiplying all those characters' numeric values together. With high digits, and 13 of them, it is likely that such a product would overflow an int, whose max value is about 2 billion (10 digits). The Character.getNumericValue method returns an int. Cast the first return value as a long to force long math. long sum = (long) Character.getNumericValue(num.charAt(i))* Character.getNumericValue(num.charAt(i+1))* ... Incidentally, even though you have greatestProduct already, for some reason you defined this variable as sum. Just for semantics' sake, I would name it product.
answers question: http://stackoverflow.com/q/23941868

http://stackoverflow.com/comment/36932577
has text: Well it's not that hard to learn but it takes quite alot of time since you have what are all the numbers for the first time :) Like Jan Bodnar says it's a matter of preference.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23970109
type: Comment

http://stackoverflow.com/q/23959072
accepted answer: http://stackoverflow.com/a/23959176
upvote count: 1
type: Question
has body: I'm having some issues with removing files after moving them to an ftp site. In a previous process I am generating files and putting them in a folder. This process should upload every file to the ftp site and then delete the local copy. For reasons I can't figure out the delete is failing but I'm not getting any sort of error message or exception. Originally I had the file.delete() call right after the ftp.put() but I moved it to it's current location thinking that maybe the file was locked by jsch and putting the call there would fix it. That doesn't seem to be the case. Ideally the call would go back there so I don't need to have two "for" loops. If you also happen to know why the overwrite is not working that would be a bonus. When i look at the files uploaded through an actual FTP program the rights are rw-rw-rw. The existing files on the server were already uploaded through this process. Here is the code: JSch jsch = new JSch(); Session session = null; try { File sourceDir = new File(certSourceFolder); if (!sourceDir.exists()) { sourceDir.mkdirs(); } session = jsch.getSession(ftpUser, ftpServer, 22); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword(ftpPassword); session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp ftp = (ChannelSftp) channel; ftp.cd(certDestFolder); for (File file : sourceDir.listFiles()) { if (file.isFile()) { try { ftp.put(new FileInputStream(file), file.getName(), ChannelSftp.OVERWRITE); } catch (SftpException ex) { //The overwrite is not working. For now I'm just going to trap the error and move on. This really shouldn't happen ever since I delete the file once uploaded. if (!ex.getMessage().equalsIgnoreCase("Permission denied")) throw ex; } } } ftp.exit(); session.disconnect(); //TODO: this is not working. figure out why. If possible get rid of this and move the file.delete up to after ftp.put for (File file : sourceDir.listFiles()) { if (file.isFile()) { file.delete(); } } }…
tagged with: file-io
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23959176
tagged with: jsch
favorite count: 0
has title: Java: Can't delete local file after jsch.put
tagged with: ftp
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/24034817
answer count: 2
has comment: http://stackoverflow.com/comment/46259988
downvote count: 1
has answer: http://stackoverflow.com/a/35697370
has comment: http://stackoverflow.com/comment/37051869
has comment: http://stackoverflow.com/comment/37052010
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
upvote count: 0
has comment: http://stackoverflow.com/comment/37051771
has title: Reloading a fragment Error [android.view.InflateException]
has comment: http://stackoverflow.com/comment/37051753
type: Question
has body: Hi i am creating a map in a fragment and i'm calling the map and below i'm calling a listview and gridview. The first time the map is displaying and i'm getting a listview but when i go to different fragment and come back to a same fragment i'm getting this error 06-04 15:35:32.360: E/AndroidRuntime(22282): FATAL EXCEPTION: main 06-04 15:35:32.360: E/AndroidRuntime(22282): android.view.InflateException: Binary XML file line #12: Error inflating class fragment 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 06-04 15:35:32.360: E/AndroidRuntime(22282): at com.dext.shoply.fragment.MapFragmentTest.onCreateView(MapFragmentTest.java:61) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478) 06-04 15:35:32.360: E/AndroidRuntime(22282): at android.support.v4.app.Fragme…
has answer: http://stackoverflow.com/a/24035050
has comment: http://stackoverflow.com/comment/37051966
tagged with: android-fragments
linked to: http://stackoverflow.com/q/28554054
has comment: http://stackoverflow.com/comment/37051843
tagged with: java
score: -1
tagged with: listview

http://stackoverflow.com/comment/36905781
comment on: http://stackoverflow.com/q/23956824
type: Comment
has text: Post your admin calss
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36885966
score: 0
has text: Awesome. I'll give this a shot in the next few days. You should your comment as an answer so that I can pick it, assuming your suggestion works.
comment on: http://stackoverflow.com/q/23945037
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24051618
has body: why not put the deletion in a finally block? } catch (Exception e) { e.printStackTrace(); } finally { if (file.exists()) { file.delete(); } } After discussion with the OP, an approach was investigated to use Apache FileCleaningTracker whereby the File is tracked and then deleted after a Monitored Object has been GC'd.
has comment: http://stackoverflow.com/comment/37083416
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37084387
has comment: http://stackoverflow.com/comment/37085242
has comment: http://stackoverflow.com/comment/37083485
has comment: http://stackoverflow.com/comment/37084758
has comment: http://stackoverflow.com/comment/37083904
has comment: http://stackoverflow.com/comment/37085132
has comment: http://stackoverflow.com/comment/37084292
answers question: http://stackoverflow.com/q/24051538
has comment: http://stackoverflow.com/comment/37126233
has comment: http://stackoverflow.com/comment/37121679
upvote count: 2
has comment: http://stackoverflow.com/comment/37083354
accepted answer of: http://stackoverflow.com/q/24051538
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37084191
has comment: http://stackoverflow.com/comment/37088405
has comment: http://stackoverflow.com/comment/37094421
has comment: http://stackoverflow.com/comment/37084527
has comment: http://stackoverflow.com/comment/37084716
type: Answer

http://stackoverflow.com/q/23985235
possible better answer: http://stackoverflow.com/a/23985263
has title: test junit in command line
has body: I try to test a junit class from the command line. I compile with this command javac -d $ROOT/bin -extdirs $ROOT/jacorb-3.4/lib test/*.java Now the .class are in the folder bin. I try this command pwd /Users/alex/Documents/assignment03/implementation noname:implementation alexi$ ls README.txt jacorb-3.4 runServer.sh bin jacorb.env runTest.sh build.sh junit.jar src buildTests.sh out test.log idl repo.ior implementation.iml runClient.sh noname:implementation alex$ java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore bin.TestSII JUnit version 4.10 Could not find class: bin.TestSII Time: 0,002 OK (0 tests) and still get Could not find class UPDATE /Users/alex/Documents/assignment03/implementation/bin/test noname:test alex$ cd .. noname:bin alex$ ls client repo.ior test hamcrest-core-1.3.jar server test.log junit-4.11.jar stock noname:bin alex$ pwd /Users/alex/Documents/assignment03/implementation/bin noname:bin alex$ ls client repo.ior test hamcrest-core-1.3.jar server test.log junit-4.11.jar stock noname:bin alex$ cd .. noname:implementation alex$ ls README.txt jacorb-3.4 runServer.sh bin jacorb.env runTest.sh build.sh junit.jar src buildTests.sh out test.log idl repo.ior implementation.iml runClient.sh noname:implementation alex$ java -cp /usr/share/java/junit.jar:bin org.junit.runner.JUnitCore TestSII JUnit version 4.10 Could not find class: TestSII Time: 0,001 OK (0 tests) UPDATE 2 /Users/alex/Documents/assignment03/implementation noname:implementation alex$ ls README.txt jacorb-3.4 runServer.sh bin jacorb.env runTest.sh build.sh junit.jar src buildTests.sh out test.log idl repo.ior implementation.iml runClient.sh noname:implementation alex$ cd bin noname:bin alex$ ls client repo.ior test hamcrest-core-1.3.jar server test.log junit-4.11.jar stock noname:bin alex$ cd test noname:test alex$ ls TestAMI.class TestCBK.class TestDII.class TestSII.class noname:test alex$
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24079847
accepted answer: http://stackoverflow.com/a/24079847
has answer: http://stackoverflow.com/a/23985263
score: 0
answer count: 2
tagged with: junit

http://stackoverflow.com/q/24011485
linked to: http://stackoverflow.com/q/409784
has body: [after edit 1] I have seen the other answers here in SO, and from looking at my code, I find that I am adhering to the principle of Java's pass-by-value-of-reference. But still my array is not getting sorted. Please can someone point out any errors I am making in my code? [after edit 2] Found the problem. It was nothing to do with array passing. In my merge method, it should be if (end-start&lt;=0) not the other way round! I am trying to implement mergesort. However, I am unable to display values of my array and am unsure of how to pass my arrays in Java such that the original array can be modified. How can I modify my current code to display the values of the sorted array? I understand java passes the copy of the array's reference around, but doesnt this mean that the original array gets modified? CODE: I am calling mergesort method from my main method. public static void main(String[] args) { int[] qn = {10,22,33,4,5,6,1}; qn= mergesort(qn,0,qn.length-1); for (int i=0;i&lt;qn.length;i++){ //print to see values if sorted/not System.out.print(qn[i]+ " "); } } public static int[] mergesort(int[] arr,int start,int end){ int mid = (end+start)/2; if (end - start&lt;=0){ return arr; } else if (end-start&gt;=1){ arr=mergesort(arr,start,mid); arr=mergesort(arr,mid+1,end); } arr=merge(arr,start,end); for (int i=0;i&lt;arr.length;i++){ System.out.print(arr[i]+ " "); } System.out.println(); return arr; } public static int[] merge(int[] arr,int start,int end){ int mid= (start+end)/2; if(start-end&lt;=0){ return arr; } int a= start; int b = mid+1; while (a&lt;=mid &amp;&amp; b &lt;=end){ if (arr[b]&lt;arr[a]){ int tmp = arr[b++]; for(int i=++mid;i&gt;a;i--){ arr[i]=arr[i-1]; } arr[a++]=tmp; } else if (arr[b]&gt;arr[a]){ a++; } else{ //arr[b]=arr[a] if(a==mid &amp;&amp; b == end){ break; //all between mid and end will be equal too } int tmp= arr[b++]; a++; for (int i=++mid;i&gt;a;i--){ arr[i]=arr[i-1]; } arr[a++]=tmp; //a++; //b++; } } return arr; } } modified my answer based on…
score: -1
has answer: http://stackoverflow.com/a/24011634
has comment: http://stackoverflow.com/comment/37038255
has comment: http://stackoverflow.com/comment/37010488
duplicate of: http://stackoverflow.com/q/409784
upvote count: 0
answer count: 1
tagged with: arrays
tagged with: mergesort
has title: Displaying values of array
has comment: http://stackoverflow.com/comment/37008744
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37008843
has comment: http://stackoverflow.com/comment/37010662
has comment: http://stackoverflow.com/comment/37008734
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/37008686
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/37315766
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24098892
type: AnswerComment
has text: `In short I want a restriction such that user can't enter anything other than alphabets.` - then you should be using a `JFormattedTextField` or a `DocumentFilter`, which will prevent the typed character from being entered into the text field. This approach does the edit AFTER the character has already been entered, which means the user will now have to delete the character.

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/23959760
type: Tag

http://stackoverflow.com/a/23953554
has comment: http://stackoverflow.com/comment/36899602
answers question: http://stackoverflow.com/q/23953553
has comment: http://stackoverflow.com/comment/36899549
score: -1
has comment: http://stackoverflow.com/comment/36899531
upvote count: 0
has comment: http://stackoverflow.com/comment/36899886
has body: Well. The point is, that the lifecycle of a String is a little bit special. All Strings are stored in a String Pool. When the reference is lost (dereferencing) for example when you say String = null; the String is still alive in the internal string pool (and can be accessed in a kind of way I don't know). That's the reason why passwords are stored in char[]. Since these objects are 'normal'.
type: Answer
downvote count: 1

http://stackoverflow.com/a/23987991
has comment: http://stackoverflow.com/comment/36965136
has body: Please understand that your code is fine. You may check it by printing dt.getTimeZone before printing time. The catch is that dt.toString will again convert the time to the machine's timezone on which your code is running. It happens because .toString() is implemented in such a way. Check the APIs and implement it in a way like Date inputDate = new Date(); Calendar dt = Calendar.getInstance(); dt.setTimeInMillis(inputDate.getTime()); dt.set(Calendar.MILLISECOND, 0); inputDate = dt.getTime(); SimpleDateFormat format = new SimpleDateFormat(); format.setTimeZone(TimeZone.getTimeZone("GMT-0.00")); System.out.println(format.format(dt.getTime()));
type: Answer
answers question: http://stackoverflow.com/q/23987752
score: 0

http://stackoverflow.com/comment/101143163
has text: @lsnow2017 Can you tell me how you fixed the issue, me too facing the same issue. If you could provide little more detail I can try it out, I have the same code as you had. Thanks.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23987490
type: AnswerComment

http://stackoverflow.com/q/24030235
answer count: 1
type: UnansweredQuestion
tagged with: rapidminer
tagged with: nlp
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24030864
has body: I want to generate a mapping of ( word-stemmed word ) which il need for my project. I am trying to generate the mapping this way 1.i took a text ( in file 1),used rapid miner to stem all the words and saved the resulting text in another file say file 2. 2.i wrote a java program which will take file1 and file 2 as parameters,scan a word from file1 and a word from file2 and store them as a pair in a HAshset. Will this method work perfectly? Is there any other better method to do this task.
has title: Mapping of words to stemmed words (Stem dictionary)
tagged with: stemming
score: 0

http://stackoverflow.com/a/24020659
has body: Not every node is an element. You should cast children to OMNode and check, if they are elements, Whitespaces count as text nodes
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24015924
has comment: http://stackoverflow.com/comment/37026663
type: Answer

http://stackoverflow.com/comment/37143345
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24084140
has text: If you saved p2, there is no longer p1 - it was overwritten.
type: Comment

http://stackoverflow.com/comment/36970305
has text: @PeterLawrey: Re `(43 / 7) * 7`, I called out using scale and rounding modes in the original answer, but I've expanded that to make the point more firmly.
type: Comment
comment on: http://stackoverflow.com/a/23990875
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37126351
comment on: http://stackoverflow.com/a/24037302
score: 0
type: AnswerComment
type: Comment
has text: @BillShannon: Agreed with you!! But my answer is with respect of my question.

http://stackoverflow.com/comment/80062790
has text: What if one does want to configure the datasource on runtime?
score: 0
comment on: http://stackoverflow.com/a/24086178
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36943590
score: 0
type: Comment
has text: That does not help too. :(
comment on: http://stackoverflow.com/a/23976997
type: AnswerComment

http://stackoverflow.com/comment/36970073
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23991299
has text: Ok. I remove flag. Sorry for that.
score: 0

http://stackoverflow.com/q/24093544
tagged with: java
type: Question
has title: How to add new entries to string array in android/java?
has comment: http://stackoverflow.com/comment/37161361
has comment: http://stackoverflow.com/comment/37161374
has body: String newwords="hi pls solve this"; mStrings[]= {"abc","def","ghi"}; mStrings = mStrings+newwords.split(" "); //wrong I know this code is wrong, but am expecting content in mStrings as {"abc","def","ghi","hi","pls","solve","this"}. Is there any operation to make this? Thanks.
score: 0
has answer: http://stackoverflow.com/a/24093555
answer count: 3
has answer: http://stackoverflow.com/a/24093575
tagged with: android
has comment: http://stackoverflow.com/comment/37162948
has answer: http://stackoverflow.com/a/24093623
type: UnansweredQuestion

http://stackoverflow.com/a/23986551
accepted answer of: http://stackoverflow.com/q/23986514
answers question: http://stackoverflow.com/q/23986514
upvote count: 3
has comment: http://stackoverflow.com/comment/36961739
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
has body: You can interpret the possible alternatives as bit masks and use &amp;, the bit-wise and operator with the "total" value to test if one alternative was chosen: if ((total &amp; 1) != 0) System.out.println("Alternative 01 was selected"); if ((total &amp; 2) != 0) System.out.println("Alternative 02 was selected"); if ((total &amp; 4) != 0) System.out.println("Alternative 04 was selected"); if ((total &amp; 8) != 0) System.out.println("Alternative 08 was selected"); if ((total &amp; 16) != 0) System.out.println("Alternative 16 was selected"); The above code will tell you that 1, 2, 4 and 16 were selected. To visualize what's happening, let's convert the total value into binary representation, so 23 becomes: 10111 // 23 And let's apply each of the bit masks in turn: 10111 // 23 &amp; 00001 // 1 ------- 00001 // 1 was selected The above tells us that in fact the 1 option was selected. Similarly for the others: 10111 // 23 &amp; 00010 // 2 ------- 00010 // 2 was selected 10111 // 23 &amp; 00100 // 4 ------- 00100 // 4 was selected 10111 // 23 &amp; 01000 // 8 ------- 00000 // 8 was NOT selected 10111 // 23 &amp; 10000 // 16 ------- 10000 // 16 was selected

http://stackoverflow.com/q/24000709
has answer: http://stackoverflow.com/a/24000852
score: 0
has comment: http://stackoverflow.com/comment/36988577
has comment: http://stackoverflow.com/comment/36988619
tagged with: android
accepted answer: http://stackoverflow.com/a/24000926
tagged with: android-asynctask
has title: Displaying Toast message in PostExecute method of an AsyncTask Android App
has comment: http://stackoverflow.com/comment/36988395
has body: Ok, so I have an AsyncTask that is adding items to a ListView. On PreExecute, I am displaying a message "Starting" and on PostExecute I am displaying "Done". The "Starting" message is displayed but for some reason, when the listing is done, the "Done" message is NOT displayed. Does anyone have any ideas on why the message is not displaying in the PostExecute section of this Task? Thank you Code: class FillLocations extends AsyncTask&lt;Integer, Void, Void&gt; { public FillLocations() { } protected void onPreExecute() { Toast.makeText(getApplicationContext(), "Starting", Toast.LENGTH_LONG).show(); } // Decode image in background. @Override protected Void doInBackground(Integer... params) { String result = ""; InputStream isr = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://myscript/"); // YOUR // PHP // SCRIPT // ADDRESS HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); isr = entity.getContent(); // resultView.setText("connected"); } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); } // convert response to string try { BufferedReader reader = new BufferedReader( new InputStreamReader(isr, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } isr.close(); result = sb.toString(); } catch (Exception e) { Log.e("log_tag", "Error converting result " + e.toString()); } // parse json data try { JSONArray jArray = new JSONArray(result); for (int i = 0; i &lt; jArray.length(); i++) { final JSONObject json = jArray.getJSONObject(i); runOnUiThread(new Runnable() { @Override public void run() { try { BitmapWorkerTask myTask = new BitmapWorkerTask( json.getInt("ID"), json); myTask.execute(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } } catch (Exception e) { // TODO: handle exception Log.e("log_tag", "E…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36988448
has answer: http://stackoverflow.com/a/24000926
tagged with: listview
type: Question
possible better answer: http://stackoverflow.com/a/24000852
answer count: 2

http://stackoverflow.com/comment/36900929
comment on: http://stackoverflow.com/q/23954218
score: 0
type: Comment
type: QuestionComment
has text: Your question is unclear. You should post some examples of input and expected results with explanation why such results are expected (why they are correct/incorrect)?

http://stackoverflow.com/comment/36990709
comment on: http://stackoverflow.com/a/24001712
score: 0
type: AnswerComment
has text: Nice catch. I tend to use for(int i = 0; i < x.size(); i++) { if(removable == true) { x.remove(x.get(i); i--; } } for this type of thing. I can't tell if that's better than the iterator, probably not.
type: Comment

http://stackoverflow.com/a/24044731
has comment: http://stackoverflow.com/comment/37071530
has comment: http://stackoverflow.com/comment/37074457
score: 0
has comment: http://stackoverflow.com/comment/37072815
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24043894
has body: Edit based on question update. In this new code the issue is with your iterator. You initialized the iterator and then modified the collection and then trying to use the dirty iterator. That is the cause of concurrent modification exception. So the fix for this issue is simple. Just move Iterator&lt;Long&gt; iter = managersId.iterator(); after for loop. Try public void fillTree() throws SystemException, PortalException { TreeNode nodeParent; TreeNode nodeFils; Set&lt;Long&gt; managersId = new HashSet&lt;Long&gt;(); UserVO user = new UserVO(); collabs = CollabLocalServiceUtil.getCollabs(-1, -1); long id; for (int i = 0; i &lt; collabs.size(); i++) { id = collabs.get(i).getManagerId(); synchronized (managersId) { managersId.add((Long) id); System.out.println(id); } } Iterator&lt;Long&gt; iter = managersId.iterator(); // Getting the new iterator with latest value. while (iter.hasNext()) { id = iter.next();//Now this wont throw exeption user = getUserById(id); nodeParent = new DefaultTreeNode(user.getFullName(), root); for (int j = 0; j &lt; collabs.size(); j++) { if (collabs.get(j).getManagerId() == user.getUserId()) { nodeFils = new DefaultTreeNode(getUserById( collabs.get(j).getUserId()).getFullName(), nodeParent); } } } } OLD ANSWER Firstly from your logic I think you are trying to get unique manager id as list. In this case you could use a Set. As for your current problem if its executing in a multi thread environment you could use synchronized block like List&lt;Long&gt; managersId = new ArrayList&lt;Long&gt;(); collabs = CollabLocalServiceUtil.getCollabs(-1, -1); long id; for (int i = 0; i &lt; collabs.size(); i++) { id = collabs.get(i).getManagerId(); synchronized (managersId) { if (!managersId.contains(id)) { managersId.add((Long) id); } } } Or else you could use java.util.concurrent.CopyOnWriteArrayList for concurrent list operation. List&lt;Long&gt; managersId = new CopyOnWriteArrayList&lt;Long&gt;(); Also as a third option you can make a normal list synchron…
answers question: http://stackoverflow.com/q/24043894
type: Answer
has comment: http://stackoverflow.com/comment/37071627
has comment: http://stackoverflow.com/comment/37093109
has comment: http://stackoverflow.com/comment/37150759

http://stackoverflow.com/comment/36890599
score: 0
type: AnswerComment
has text: Thanks a lot!! :) u've been a great help :)
type: Comment
comment on: http://stackoverflow.com/a/23948045

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/24068124
tags question: http://stackoverflow.com/q/24040161
tags question: http://stackoverflow.com/q/24004539
type: Tag

http://stackoverflow.com/comment/36981622
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23958289
has text: I made it so it's: `x = (float) Math.cos(angle) * r * HEIGHT / WIDTH;` and it still is making an oval. Any ideas?
type: Comment

http://stackoverflow.com/q/24017853
answer count: 3
has body: I am getting constant error in main_activity. Error:- No resource identifier found for attribute 'textcolor' in package 'android' The code for main activity is this <?xml version="1.0" encoding="utf-8"?>
favorite count: 0
tagged with: android
has title: No resource identifier found for attribute 'textcolor' in package 'android'
has answer: http://stackoverflow.com/a/24017907
type: AnsweredQuestion
upvote count: 3
score: 0
downvote count: 3
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/24017976
has answer: http://stackoverflow.com/a/24018086
has answer: http://stackoverflow.com/a/24017976
accepted answer: http://stackoverflow.com/a/24017907
tagged with: eclipse

http://stackoverflow.com/q/24061834
has answer: http://stackoverflow.com/a/72664445
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/24202564
has title: how to see the query generated by spring ldapTemplate
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/81184665
favorite count: 0
type: Question
answer count: 2
score: 5
has body: I am using spring ldapTemplate version 1.3.2 to query results from active directory. We would like to be able to see the query generated by ldapTemplate.search() and similar methods in order to debug deployments of our product to clients. So far we have tried looking in the docs to see if there's a "toString" method that would provide this but didn't find anything. We also changed the debug level in log4j.properties file:log4j.logger.org.springframework.security=DEBUG. This seems to give us more verbose output but doesn't actually display the full ldap query string. Any help would be appreciated.
tagged with: ldap
has comment: http://stackoverflow.com/comment/37112638
tagged with: spring
tagged with: spring-ldap

http://stackoverflow.com/q/23967491
has comment: http://stackoverflow.com/comment/36927107
has comment: http://stackoverflow.com/comment/36926151
has comment: http://stackoverflow.com/comment/36926268
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/23967610
accepted answer: http://stackoverflow.com/a/23967610
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/36926742
tagged with: out-of-memory
linked to: http://stackoverflow.com/q/37335
has body: I'm trying to send a byte array containing 16 items over sockets using DataOutputStream on the client and DataInputStream on the server. These are the methods I am using for sending/receiving. public void sendBytes(byte[] myByteArray) throws IOException { sendBytes(myByteArray, 0, myByteArray.length); } public void sendBytes(byte[] myByteArray, int start, int len) throws IOException { if (len &lt; 0) throw new IllegalArgumentException("Negative length not allowed"); if (start &lt; 0 || start &gt;= myByteArray.length) throw new IndexOutOfBoundsException("Out of bounds: " + start); dOutput.writeInt(len); if (len &gt; 0) { dOutput.write(myByteArray, start, len); dOutput.flush(); } } public byte[] readBytes() throws IOException { int len = dInput.readInt(); System.out.println("Byte array length: " + len); //prints '16' byte[] data = new byte[len]; if (len &gt; 0) { dInput.readFully(data); } return data; } It all works fine, and I can print the byte array length, byte array (ciphertext), and then decrypt the byte array and print out the original plaintext I sent, but immediately after it prints in the console, the program crashes with a OutOfMemoryError: Java heap space. I have read this is usually because of not flushing the DataOutputStream, but I am calling it inside the sendBytes method so it should clear it after every array is sent. The compiler is telling me the error is occuring inside readBytes on the line byte[] data = new byte[len]; and also where I call readBytes() in the main method. Any help will be greatly appreciated! Edit I am actually getting some unexpected results. 17:50:14 Server waiting for Clients on port 1500. Thread trying to create Object Input/Output Streams 17:50:16 Client[0.7757499147242042] just connected. 17:50:16 Server waiting for Clients on port 1500. Byte array length: 16 Server recieved ciphertext: 27 10 -49 -83 127 127 84 -81 48 -85 -57 -38 -13 -126 -88 6 Server decrypted ciphertext to: asd 17:50:19 Client[0.7757499147242042] Byte arr…
tagged with: datainputstream
has comment: http://stackoverflow.com/comment/36926355
has title: Java DataOutputStream / DataInputStream OutOfMemoryError
has comment: http://stackoverflow.com/comment/36926210
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: dataoutputstream
has comment: http://stackoverflow.com/comment/36926149
type: Question
has answer: http://stackoverflow.com/a/23967723
possible better answer: http://stackoverflow.com/a/23979648
has answer: http://stackoverflow.com/a/23979648

http://stackoverflow.com/a/23962921
upvote count: 1
score: 1
has body: If you're outside a method, you'll need an initializer block (or to use a constructor) - private stock s = new stock("name", "price", 22); private stock[] d = new stock[2]; { d[0] = s; d[1] = s; } If you're inside a method, you can do it like so - stock s = new stock("name", "price", 22); stock[] d = new stock[2]; d[0] = s; d[1] = s; // stock[] d = new stock[] { s, s }; // &lt;-- or like this
answers question: http://stackoverflow.com/q/23962852
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23962852
type: Answer

http://stackoverflow.com/q/24087240
has answer: http://stackoverflow.com/a/24087997
tagged with: hadoop
answer count: 2
tagged with: iterator
has body: I am a beginner with Hadoop and Java, and I am writing Map, Reduce functions to cluster a set of latitudes and longitudes together into groups based on proximity, and set a magnitude (Number of lat,long pairs in a cluster) and a representative lat,long pair (As of now, it's the first lat,long pair encountered.) Here's my code: package org.myorg; import java.io.IOException; import java.util.*; import org.apache.hadoop.fs.Path; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import util.hashing.*; public class LatLong { public static class Map extends Mapper&lt;Object, Text, Text, Text&gt; { //private final static IntWritable one = new IntWritable(1); public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); String[] longLatArray = line.split(","); double longi = Double.parseDouble(longLatArray[0]); double lat = Double.parseDouble(longLatArray[1]); //List&lt;Double&gt; origLatLong = new ArrayList&lt;Double&gt;(2); //origLatLong.add(lat); //origLatLong.add(longi); Geohash inst = Geohash.getInstance(); //encode is the library's encoding function String hash = inst.encode(lat,longi); //Using the first 5 characters just for testing purposes //Need to find the right one later int accuracy = 4; //hash of the thing is shortened to whatever I figure out //to be the right size of each tile Text shortenedHash = new Text(hash.substring(0,accuracy)); Text origHash = new Text(hash); context.write(shortenedHash, origHash); } } public static class Reduce extends Reducer&lt;Text, Text, Text, Text&gt; { private IntWritable totalTileElementCount = new IntWritable(); private Text latlongimag = new Text(); private …
downvote count: 0
linked to: http://stackoverflow.com/q/24089330
accepted answer: http://stackoverflow.com/a/24089305
tagged with: iterable
favorite count: 0
has comment: http://stackoverflow.com/comment/37150228
has comment: http://stackoverflow.com/comment/37150842
score: 2
has title: Null Pointer Exception - Hadoop Mapreduce job
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37150009
has answer: http://stackoverflow.com/a/24089305
type: Question
possible better answer: http://stackoverflow.com/a/24087997

http://stackoverflow.com/a/24006788
score: 0
has comment: http://stackoverflow.com/comment/36999826
type: Answer
answers question: http://stackoverflow.com/q/24006695
has comment: http://stackoverflow.com/comment/37014729
has body: Yeah, that was a really bad example they gave you. The factory pattern has less to do with polymorphism, and more to do with minimizing the use of the "new" keyword. Lets say I build a class called Manager. When I build it, it takes in a String and an int, because all it is managing is a Person object, with a name and age. But when I grow my application, I eventually want to operate on new types of data, like adding an occupation field to my person. I want my manager to be able to take in an Enum for Occupation in its constructor along with the String and int. Then a year later, my application has grown so much, I have subclasses of people, Data Access Objects, and all sorts of data I need to pass in to my manager. If I was not using factory, then ANYWHERE in the code where I instantiated a Manager class, I have to fix the constructor. If instead I have used a ManagerFactory class, with a method getManager() I only need to change the constructor inside my factory class, allowing all references to getManager() to still return a Manager, no change required.

http://stackoverflow.com/a/35074940
score: 2
answers question: http://stackoverflow.com/q/24009198
downvote count: 0
type: Answer
upvote count: 2
has body: It's being redirected to catalina.out because you have console log defined as an appender and these get redirected to catalina.out. However, we do need console logs for local development but don't want them to show in other environments. You can use ThresholdFilter along with configuration properties to console log only in local and not in other environments with the below sample code: <?xml version="1.0" encoding="UTF-8"?> error <PatternLayout pattern="%date{yyyy/MM/dd HH:mm:ss.SSS} %-5level [%t] [%logger{36}] %msg%n"/> <TimeBasedTriggeringPolicy interval="1" modulate="true"/> <PatternLayout pattern="%date{yyyy/MM/dd HH:mm:ss.SSS} %-5level [%t] [%logger{36}] %msg%n"/> <ThresholdFilter level="${sys:consoleLogLevel}" onMatch="ACCEPT" onMismatch="DENY"/> <AppenderRef ref="FileOut"/> <AppenderRef ref="Console"/> <AppenderRef ref="FileOut"/> <AppenderRef ref="Console"/> If you pass a -DconsoleLogLevel=debug in local you will see all logs from com.github.api being logged to console but in other environments if you don't pass any value it takes default of error and only shows error stack in catalina out.

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/24096237
tags question: http://stackoverflow.com/q/24028151

http://stackoverflow.com/q/24044426
possible better answer: http://stackoverflow.com/a/24044498
tagged with: eclipse
has answer: http://stackoverflow.com/a/24044498
type: Question
score: 0
answer count: 3
tagged with: ide
has answer: http://stackoverflow.com/a/24044524
has answer: http://stackoverflow.com/a/24055197
accepted answer: http://stackoverflow.com/a/24044524
has title: How to navigate to the type under the cursor in Eclipse?
type: AnsweredQuestion
has body: In Eclipse control + left click navigate to the place where the type is defined (also navigates to declaration of variable). How do I achieve the action same without the mouse when I am placed with cursor on the word? (Without using control + shift + T).
tagged with: java

http://stackoverflow.com/q/24076097
linked to: http://stackoverflow.com/q/176745
has comment: http://stackoverflow.com/comment/37128337
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37128223
has answer: http://stackoverflow.com/a/24076743
accepted answer: http://stackoverflow.com/a/24076743
has body: I was working on some code recently. Here's the gist - class Student { private String name; private List&lt;Performance&gt; performances; } class Performance { private Student student; private List&lt;Integer&gt; perfData; } Student &amp; Performance have a circular dependency. Is this bad? How do we prevent / break this up without losing the ability to find all performances of a Student and given a Performance map it back to a Student.
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/176745
has title: Are circular references in Java objects bad?
upvote count: 3
score: 1
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37128328
type: Question

http://stackoverflow.com/comment/37145292
comment on: http://stackoverflow.com/q/24084745
type: Comment
type: QuestionComment
has text: So I'm assuming that a maven install only actually installs the project jar, not the shaded jar?
score: 0

http://stackoverflow.com/comment/36937299
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23973833
has text: But the model just communicates by a getter method. So the controller gets it. And then another model class writes to a stream. Is this deprecated aswell ? I Though the whole point of MVC was that you could use the model by its own. Like calling the quickscan() Method from any other UserInterface or from the console? Or did I get this wrong ?

http://stackoverflow.com/comment/36909522
has text: which one is line 7 of your code & what is item(int) type?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23958607
type: Comment

apache-httpclient-4.x
tags question: http://stackoverflow.com/q/24076877
tags question: http://stackoverflow.com/q/24082081
tags question: http://stackoverflow.com/q/24049197
tag name: apache-httpclient-4.x
type: Tag
tags question: http://stackoverflow.com/q/23995274
tags question: http://stackoverflow.com/q/24067558
tags question: http://stackoverflow.com/q/24032353
tags question: http://stackoverflow.com/q/23966483

http://stackoverflow.com/comment/37024607
comment on: http://stackoverflow.com/a/24019752
score: 0
type: Comment
has text: @user3659691 please post the code where your DatabaseHelper object is being initialized.
type: AnswerComment

http://stackoverflow.com/comment/37060691
has text: Don't use regex to parse HTML (or XHTML). See [bobince's answer here](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) for *why*. Use a proper parser instead.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24039086
score: 0

http://stackoverflow.com/q/23950888
tagged with: java
has title: Instrumenting Android apps with Soot using a helper class
accepted answer: http://stackoverflow.com/a/24190528
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I am instrumenting Android applications using a helper class following the example for Java instrumentation in http://www.sable.mcgill.ca/soot/tutorial/profiler2/profiler2.html. In my BodyTransformer, I have a static block to load MyCounter class counterClass = Scene.v().loadClassAndSupport("MyCounter"); Since Soot.Main.main(args) that processes my args (in which I provide -android-jars) is not executed while it is loading MyCounter, Soot cannot find my android jar and gives the error: Caused by: java.lang.RuntimeException: You are analyzing an Android application but did not define android.jar. Options -android-jars or -force-android-jar should be used. at soot.Scene.defaultClassPath(Scene.java:455) at soot.Scene.getSootClassPath(Scene.java:224) at soot.SootResolver.&lt;init&gt;(SootResolver.java:81) at soot.Singletons.soot_SootResolver(Singletons.java:802) at soot.SootResolver.v(SootResolver.java:91) at soot.Scene.loadClass(Scene.java:667) at soot.Scene.loadClassAndSupport(Scene.java:653) at MyBodyTransformer.&lt;clinit&gt;(MyBodyTransformer.java:26) ... 1 more As a solution, I provided my command line arguments (android jars, soot classpath, prepend classpath and process directory) in my main class, before creating my BodyTransformer. Now, it works. I would like to ask whether there is a more proper way to solve this problem.
tagged with: soot
type: Question
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/24190528
upvote count: 1
answer count: 1

http://stackoverflow.com/q/23974970
favorite count: 0
has comment: http://stackoverflow.com/comment/36939470
tagged with: thread-exceptions
has body: this programme (optoesim ) is throwing a java.util.ConcurrentModificationException at the line for stats.put("jobTimesWithQueue", new LinkedHashMap(_jobTimesWithQueue));. This is an opensource program and I did'n change anything. Can someone please explain to me what it means, what causes it, and how can I avoid it. Exception in thread ConcurrentModificationException java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)** at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:744) at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:742) at java.util.HashMap.putMapEntries(HashMap.java:511) at java.util.LinkedHashMap.&lt;init&gt;(LinkedHashMap.java:384) at org.edg.data.replication.optorsim.SimpleComputingElement.getStatistics(SimpleComputingElement.java:164) at org.edg.data.replication.optorsim.GridDataThread.run(GridDataThread.java:95) public Statistics getStatistics() { Map stats = new HashMap(); // After remove see the result here. OptorSimParameters params = OptorSimParameters.getInstance(); float _usage = _time.getTimeMillis() - _startRunning == 0 ? 0 : 100 *_workingTime/(_time.getTimeMillis() - _startRunning); stats.put("usage", new Float(_usage)); stats.put("remoteReads", new Long(_remoteReads)); stats.put("localReads", new Long(_localReads)); if( params.outputStatistics() ==3) { stats.put("jobTimes", new LinkedHashMap( _jobTimes)); stats.put("jobTimesWithQueue", new LinkedHashMap(_jobTimesWithQueue)); stats.put("jobFiles", new LinkedHashMap(_jobFiles)); stats.put("numberOfJobs", new Integer(_jobsCompleted)); stats.put("workerNodes", new Integer(_workerNodes)); stats.put("status", new Boolean(_active)); stats.put("queueLength", new Integer(_inputJobHandler.getQueueSize())); stats.put("runnableStatus", new Boolean(_runnable)); } stats.put("totalJobTime", new Float(_totalJobTime/(float)1000)); long meanJobTime = 0; if (_jobsCompleted!=0) meanJobTime = _workingTime/_jobsCompleted; ///////////////////////////…
has answer: http://stackoverflow.com/a/23975008
type: UnansweredQuestion
tagged with: concurrentmodification
linked to: http://stackoverflow.com/q/602636
downvote count: 0
has comment: http://stackoverflow.com/comment/36939731
type: Question
score: 1
tagged with: java
has title: optorsim throws ConcurrentModificationException
tagged with: concurrency
has comment: http://stackoverflow.com/comment/36939742
upvote count: 1
answer count: 1

http://stackoverflow.com/a/24094557
upvote count: 2
has body: The problem is that this class it not a Servlet. It's just like a normal Java class. It should extend HttpServlet public class SomeServlet extends HttpServlet The class on which this annotation @WebServlet is declared MUST extend HttpServlet. Always try to use @Override annotation for overridden method to catch such type of errors at compile type itself.
answers question: http://stackoverflow.com/q/24094443
has comment: http://stackoverflow.com/comment/37170647
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/28556365
answers question: http://stackoverflow.com/q/24070655
type: Answer
has body: Adding this in the manifest worked for me: android.permission.READ_EXTERNAL_STORAGE
score: 3
has comment: http://stackoverflow.com/comment/49521062
downvote count: 0
upvote count: 3

exec-maven-plugin
tags question: http://stackoverflow.com/q/23966431
type: Tag
tag name: exec-maven-plugin

http://stackoverflow.com/comment/37065723
has text: Yes that works! It captures everything after the ERA-ddddd and before the first '<'. I actually want to include the 'ERA-ddddd' as part of the group. Can this be done as one group? I apologize for the new question.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24041848

http://stackoverflow.com/q/24006297
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/36998880
has title: Arraylist is null; I cannot access books in the arraylist
has comment: http://stackoverflow.com/comment/37015802
type: UnansweredQuestion
has body: I am a beginner-intermediate java programmer and I am getting a null pointer exception from my array-list. I am writing a bookstore program for APCS and when I add the book, it is supposed to add to the array-list in the inventory class. But when I call a method to search for a book (e.g. by title), it shows that there isn't anything in the array-list. //Here is my inventory class --> it has all methods for adding the book or searching for one The searching methods are in getBookByTitle, getBookByAuthor, and getBookByISBN and the method for adding a book is addBook package webbazonab; //Inventory Class //Bharath Senthil //Ansh Sikka import java.util.ArrayList; public class Inventory{ private ArrayList&lt;Book&gt; allBooks = new ArrayList&lt;Book&gt;(); private String bookTitles; private String bookAuthors; private String bookPrices; private String bookCopies; private String ISBNs; public Inventory() { } //@param double price, int copies, String bookTitle, String Author, String isbnNumber public void addBooks(Book addedBook){ allBooks.add(addedBook); } public boolean isAvailable(){ for(Book myBook : allBooks){ if(myBook.copiesLeft() == 0) return false; } return true; } public String populateTitle(){ for (Book titleBooks : allBooks){ bookTitles = titleBooks.getTitle() + "\n"; return bookTitles; } return bookTitles; } public String populateAuthor(){ for(Book authorBooks : allBooks){ bookAuthors = authorBooks.getAuthor() + "\n"; return bookAuthors; } return bookAuthors; } public String populatePrice(){ for (Book pricedBooks : allBooks){ bookPrices = String.valueOf(pricedBooks.getPrice()) + "\n"; } return "$" + bookPrices; } /** * * @return */ public String populateCopies(){ for (Book amtBooks : allBooks){ bookCopies = String.valueOf(amtBooks.copiesLeft()) + "\n"; return bookCopies; } return bookCopies; } public String populateISBN(){ for (Book isbnNums : allBooks){ ISBNs = isbnNums.getIsbn() + "\n"; return ISBNs; } return ISBNs; } @SuppressWarnings("empty-statement") pu…
tagged with: foreach
tagged with: java
has answer: http://stackoverflow.com/a/24006349
type: Question
has answer: http://stackoverflow.com/a/24006592
tagged with: null
tagged with: arraylist
score: 0
answer count: 2

http://stackoverflow.com/comment/36901169
has text: What is the question? Are looking for Map (HashMap for example)?
comment on: http://stackoverflow.com/q/23954453
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/37092230
comment on: http://stackoverflow.com/a/24055784
type: AnswerComment
score: 0
type: Comment
has text: @user3710223: You're welcome, and welcome to the site BTW. Given that you're new: do take the time to read through the _help_ section. Users are asked _not_ to post _"thank you"_-comments. Mark the answer that helped as accepted, instead. cf [What to do when someone answers](http://stackoverflow.com/help/someone-answers)

http://stackoverflow.com/comment/39509666
comment on: http://stackoverflow.com/q/23956154
type: QuestionComment
type: Comment
has text: How do you declare `array`?
score: 0

http://stackoverflow.com/a/23998548
has comment: http://stackoverflow.com/comment/40152166
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23949237
type: Answer
has comment: http://stackoverflow.com/comment/40092310
has body: After a lot of discussion, trial, error and logging we come tho these answers to fix the problems: Do not load channel.html from the internal assets folder. Then the url's don't match up anymore. (It is trying to post a message to the server at 'file://'+'/_ah/channel/jsapi', instead of 'http://server_adress:port'+'/_ah/channel/jsapi') After fixing that there was a problem with double slashes. appRTCSignalingParameters.gaeBaseHref contained a slash on the end, but appRTCSignalingParameters.postMessageUrl did that on the beginning so the program tried to post to server_adress:port//message which is incorrect. Simply removing the / from appRTCSignalingParameters.postMessageUrl fixed this. Old answer: Thanks for the logging. Now we know what goes wrong. The if doesn't trigger because signalingReady == 0. The reason it is zero is because of something I found on line 49: // Caller is always ready to create peerConnection. signalingReady = initiator; I have no idea why this is there, and what it does. Also, the only way to make it true happens on line 311, which is inside the function onChannelMessage. There is no log from that function, and also the console.trace doesn't show anything from onChannelMessage, as right on line 312 it should call maybeStart(). So to temporary avoid it won't work, because there is no signalling done. So what I think would solve the solution is to set initiator to 1 somewhere. You can do this for instance in the function that creates a new room, so the script directly knows that you are the initiator and not joining anyone. I hope this solves your problem, and please keep me updated on further results and problems. (As this is a demo from the site, I also suggest you to try and understand how an RTC connection is established, and write everything from the ground up. This will make your knowledge a lot better and debugging will be much easier, as it is your own code which you understand).
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23949237

http://stackoverflow.com/comment/36927164
type: AnswerComment
comment on: http://stackoverflow.com/a/23968034
score: 0
type: Comment
has text: @BoristheSpider I was assuming he wanted to capture the digits, thus the capture brackets

http://stackoverflow.com/q/24030551
upvote count: 5
tagged with: regex
has comment: http://stackoverflow.com/comment/37044246
type: AnsweredQuestion
tagged with: java
type: Question
has title: Java string and regex matching
has comment: http://stackoverflow.com/comment/37044447
has body: I want to search a string(formed by concatenation of string and a regex) in another string.If the 1st string is present in the second string then i want to get the starting and ending addresses of matched phrase. For in the following code I want to search "baby accessories India" in "baby_NN accessories_NNS India_NNP is_VBZ an_DT online_JJ shopping_NN portal_NN " and want to get "baby_NN accessories_NNS India_NNP" as result. import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexMatching { public static void main(String aaa[])throws IOException { String line="baby accessories India"; String []str=line.split("\\ "); String temp=""; int i,j; j=0; String regEx1 = "([A-Z]+)[$]?"; for(i=0;i&lt;str.length;i++) temp=temp+str[i]+"_"+regEx1+" "; String para2="baby_NN accessories_NNS India_NNP is_VBZ an_DT online_JJ shopping_NN portal_NN "; Pattern pattern1 = Pattern.compile(temp); Matcher matcher1 = pattern1.matcher(para2); if (para2.matches(temp)) { i = matcher1.start(); j = matcher1.end(); String temp1=para2.substring(i,j); System.out.println(temp1); } else { System.out.println("Error"); } } }
score: 4
has answer: http://stackoverflow.com/a/24031164
accepted answer: http://stackoverflow.com/a/24031164
downvote count: 1
answer count: 1
tagged with: string
favorite count: 0

http://stackoverflow.com/q/24093402
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37161128
tagged with: java
has body: I have a method that returns a character element from a two dimensional array of strings based on the input coordinate parameters. public BattleShips(GameConfiguration config, Player player1, Player player2) { this.player1 = player1; this.player2 = player2; this.config = config; this.myBoardPlayer1= new char[20][20]; this.myBoardPlayer2= new char[20][20]; } protected char getCellState(int player, int x, int y) { if (isValidCoordinate(x,y) == true){ if (player == 0){ return this.myBoardPlayer1[x][y]; } else if (player == 1){ return this.myBoardPlayer2[x][y]; } } else { return (char) -1; } } The problem is that the above code results in eclipse telling me the method getCellState() isn't returning a result of type char even when i have initialized the instance variables, myBoardPlayer1 and myBoardPlayer2 as char[20][20] in the constructor. So my question: is this correct the return method for a character element in an array? Alternatively, is this.myBoardPlayer1[x][y] not considered a character? If not how can I change my code so that getCellState() returns whatever character value this.myBoardPlayer1[x][y] has?
type: Question
has answer: http://stackoverflow.com/a/24093426
tagged with: arrays
score: 0
tagged with: element
answer count: 1
accepted answer: http://stackoverflow.com/a/24093426
tagged with: character
tagged with: return
has title: Returning a character element from a two dimensional array

http://stackoverflow.com/q/23983465
linked to: http://stackoverflow.com/q/18124364
has comment: http://stackoverflow.com/comment/36968886
type: UnansweredQuestion
tagged with: css
tagged with: paint
has answer: http://stackoverflow.com/a/23991549
score: 1
tagged with: java
tagged with: javafx
has title: Is there a "fill" function for arbitrary shapes in javafx?
has comment: http://stackoverflow.com/comment/37016536
type: Question
has answer: http://stackoverflow.com/a/25467333
has comment: http://stackoverflow.com/comment/36963525
has body: I need to know in which way I can color the following image (PNG) by using JavaFX. This image is currently included in a ImageView of JavaFX: I want to color region 1 blue, the second one red, and the last two purple. How can I do this in JavaFX? Isn't there some kind of function as in Windows Paint? (You know, the painting bucket that fills a certain area with a color between borders).
tagged with: javafx-8
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24079841
has title: Decode UDP message (from Erlang to Java)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24081041
accepted answer: http://stackoverflow.com/a/24081041
has body: I just tried to send a message by UDP from an Erlang server to a Java client. Now I am wondering how I should do to interpret this message to something useful. Here is what I wrote in Erlang: {ok, Socket} = gen_udp:open(8789, [binary, {active, true}]). gen_udp:send(Socket, {127,0,0,1},11001, "yeah!"). And here is my Java code: public class Server { private DatagramSocket socket; private byte[] buffer; public Server() { try { socket = new DatagramSocket(11001); } catch (SocketException e) { e.printStackTrace(); } buffer = new byte[65508]; } public void receivePackage() { try { DatagramPacket packet = new DatagramPacket(buffer, buffer.length); socket.receive(packet); byte[] buffer = packet.getData(); System.out.println(buffer); } catch (IOException e) { e.printStackTrace(); } } } How do I handle the byte buffer and translate it to something that I can output in the Java console?
type: Question
tagged with: java
tagged with: erlang
score: 0
tagged with: udp
answer count: 1

http://stackoverflow.com/comment/37089673
has text: 2. Akka comes with lots of cool built in features that simplify your life - e.g. swappable actor behavior using become(), supervision hierarchies, custom mailboxes etc. The bottom line is: you get the primitives to build your communication the way you like it. And it is you who decides the failure scenarios you want to handle and the ones you don't care about.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24042674
type: AnswerComment

http://stackoverflow.com/q/24049748
type: Question
has comment: http://stackoverflow.com/comment/37081437
has title: Garbage in TCP message - C++/Java communication
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24052311
has comment: http://stackoverflow.com/comment/37081357
has comment: http://stackoverflow.com/comment/37080186
has comment: http://stackoverflow.com/comment/37081836
upvote count: 1
answer count: 1
favorite count: 0
tagged with: sockets
tagged with: send
has comment: http://stackoverflow.com/comment/37080286
tagged with: c++
downvote count: 0
has body: I'm having a slight problem in my C++ client - Java server application. Sockets successfully connect, and transmit several messages, but then comes this part: msgBuilder&lt;&lt;"TASK?\n"; mymsg = msgBuilder.str(); send(tcp_sock,mymsg.c_str(),8,0); msgBuilder.str(""); msgBuilder.clear(); The java side reads msg = in.readLine(); while(!(msg.equals("TASK?"))){ System.out.println("Got "+msg+" expected TASK?"); msg = in.readLine(); } Problem is, it reads two of what I assume are null characters which I cannot paste here, for some reason. I can get over it by switching to "contains" I guess, but I am interested in what's causing this?
tagged with: tcp
type: UnansweredQuestion

http://stackoverflow.com/q/24082209
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/24082259
has body: I am trying to populate an array (probCount) using a SecureRandom object (index) to determine probabilities. I have a for loop to run this about 100 million times: probCount[index.nextInt(probCount.length)]++; When I print the array, all my elements are populated correctly. How does this line does not throw an out of bounds exception? I had it like: probCount.length - 1 This, however, never populated my last element. I am a bit confused.
score: 0
tagged with: random
answer count: 2
has title: Populating array with SecureRandom: Why not out of bounds?
has comment: http://stackoverflow.com/comment/37139535
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37139297
type: Question
has answer: http://stackoverflow.com/a/24082260
accepted answer: http://stackoverflow.com/a/24082260
possible better answer: http://stackoverflow.com/a/24082259
tagged with: arrays

http://stackoverflow.com/comment/36999349
comment on: http://stackoverflow.com/a/24006450
type: AnswerComment
has text: What do you mean by `why I need to catch things that I dont need?`? You don't have to catch any exception, the exception is thrown always if you don't invoke `matches()` before `group()`, regardless if there is a match or not
score: 0
type: Comment

http://stackoverflow.com/q/24007966
linked to: http://stackoverflow.com/q/7565143
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24008510
has answer: http://stackoverflow.com/a/24008510
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24015881
duplicate of: http://stackoverflow.com/q/7565143
tagged with: mysql
type: Question
has title: Connection Timeout when application is Idle
answer count: 2
accepted answer: http://stackoverflow.com/a/24015881
score: 0
has body: I am not able to connect to the database when it my application remains idle for some time. My database is Mysql and server is Tomcat. Application is built using Spring-Hibernate. My connection settings in persistance.xml are like this- <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/application_db_name"/> <property name="hibernate.connection.username" value="***"/> <property name="hibernate.connection.password" value="***"/> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.use_sql_comments" value="true" /> <property name="hibernate.connection.zeroDateTimeBehavior" value="convertToNull"/> But if I try after some time, it connects to the database successfully. Mysql variables are set like this ------------------------------------- Variable_name Value ------------------------------------- connect_timeout 10 delayed_insert_timeout 300 innodb_lock_wait_timeout 50 innodb_rollback_on_timeout OFF interactive_timeout 28800 lock_wait_timeout 31536000 log_output FILE net_read_timeout 30 net_write_timeout 60 slave_net_timeout 3600 wait_timeout 28800 -------------------------------------- What can be the reason? how can I solve this.
tagged with: spring

http://stackoverflow.com/a/24054567
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37090115
has comment: http://stackoverflow.com/comment/37089366
score: 2
answers question: http://stackoverflow.com/q/24054517
has body: You need a migration production script that does an: RENAME TABLE .... You modify the entity table mappings to match the new table names You do a production update that does both 1) and 2)
has comment: http://stackoverflow.com/comment/37091768
has comment: http://stackoverflow.com/comment/37089084

http://stackoverflow.com/q/23961417
has comment: http://stackoverflow.com/comment/36919201
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36914885
upvote count: 1
has comment: http://stackoverflow.com/comment/36915399
score: 1
tagged with: java
type: Question
has title: How to move point on arc?
downvote count: 0
has comment: http://stackoverflow.com/comment/36915081
has body: I am writing an app that is simulating RobotArm movement. What I want to achieve, and where I have couple of problems is moving a Point on arc (180degree) that is arm range of movement. I am moving an arm by grabbing with mouse end of arm (Elbow, the Point I was talking about), robot can have multiple arms with diffrent arm lenghts. If u can help me with this part, I'd be grateful. This is what I have so far, drawing function: public void draw(Graphics graph) { Graphics2D g2d = (Graphics2D) graph.create(); graph.setColor(color); graph.fillOval(location.x - 4, location.y - 4, point.width, point.height); //Draws elbow if (parentLocation != null) { graph.setColor(Color.black); graph.drawLine(location.x, location.y, parentLocation.x, parentLocation.y); //Connects to parent if (arc == null) { angle = new Double(90 - getAngle(parentInitLocation)); arc = new Arc2D.Double(parentLocation.x - (parentDistance * 2 / 2), parentLocation.y - (parentDistance * 2 / 2), parentDistance * 2, parentDistance * 2, 90 - getAngle(parentInitLocation), 180, Arc2D.OPEN); //Draws an arc if not drawed yet. } else if (angle != null) //if parent is moved, angle is moved also { arc = new Arc2D.Double(parentLocation.x - (parentDistance * 2 / 2), parentLocation.y - (parentDistance * 2 / 2), parentDistance * 2, parentDistance * 2, angle, 180, Arc2D.OPEN); } g2d.draw(arc); } if (spacePanel.getElbows().size() &gt; level + 1) {//updates all childElbows position updateChild(graph); } } I just do not know how to prevent moving Point moving outside of arc line. It can not be inside or outside arc, just on it. Here I wanted to put a screenshot, sadly I don't have enough rep. Am I allowed to put link to this? Maybe you got other ways how to achieve this kind of thing. Here is the image: Red circle is actual state, and green one is what I want to do. EDIT2: As requested, repo link: https://github.com/dspoko/RobotArm
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/36914882
has comment: http://stackoverflow.com/comment/36915251
has comment: http://stackoverflow.com/comment/36919128

http://stackoverflow.com/a/23973170
score: 1
has comment: http://stackoverflow.com/comment/36936929
upvote count: 2
answers question: http://stackoverflow.com/q/23973100
has body: What you have done in your entire code is you have mis-typed as count=+1; Also, the count variable must be declared as a class attribute as public static int count=0; Also, you are incrementing count after calling the CallPane() method, because of which it is never able to get incremented! This is the error,and hence being reset every-time! Replace this statement everywhere with count+=1; Moreover, also declare count as static to be updated by incrementing from anywhere within the class. It'll work fine! I have shown it below :- public class JavaApplication5 { public static int count=0; public static void main(String[] args) { Random rand = new Random(); int randomnumber = rand.nextInt(50); System.out.println("The random number is "+randomnumber); int machine = GuessMachine(Integer.parseInt(JOptionPane.showInputDialog("Guess a number :- ")), randomnumber); } public static int CallPane(int Value, int rndNumber) { int X1; X1 = Integer.parseInt(JOptionPane.showInputDialog("Guess a number :- ")); int machine = GuessMachine(X1, rndNumber); return X1; } public static int GuessMachine(int InputNumber, int rndNumber) { int value = InputNumber; int randomNumber = rndNumber; if(InputNumber == randomNumber) { count +=1;//error 1 JOptionPane.showMessageDialog(null, "Well! You did it "+count+" times." ); int Response = JOptionPane.showConfirmDialog(null, "Play again", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (Response == JOptionPane.NO_OPTION) { JOptionPane.showMessageDialog(null, "See you later!"); } else if (Response == JOptionPane.YES_OPTION) { Random rand = new Random(); int randomnumber = rand.nextInt(50); //callpane int machine = GuessMachine(Integer.parseInt(JOptionPane.showInputDialog("Guess a number :- ")), randomnumber); } } else if (InputNumber &lt; randomNumber) { JOptionPane.showMessageDialog(null, "Insufficient!"); count+=1;//error 2 int PaneInput = CallPane(value, randomNumber); } else if (InputNumber &gt; randomNumber) { // JOptionP…
has comment: http://stackoverflow.com/comment/36935964
type: Answer
downvote count: 1

http://stackoverflow.com/comment/37165562
type: AnswerComment
has text: OK Now just make one change in the pattern. Its very simple.
type: Comment
comment on: http://stackoverflow.com/a/24095858
score: 0

http://stackoverflow.com/a/23999350
accepted answer of: http://stackoverflow.com/q/23998937
answers question: http://stackoverflow.com/q/23998937
has body: You need to change your application manifest tag as follows: &lt;application android:name="full.package.name.GamePlannerFriendPickerApplication" In your manifest right now you are declaring the class "IntegratingFacebookTutorialApplication", so when you get an application reference and try to cast it to your GamePlannerFriendPickerApplication is throwing the exception, because the instance is of type "IntegratingFacebookTutorialApplication", just make sure to set the proper Application name (GamePlannerFriendPickerApplication) and your class cast exception should be gone... Regards!
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/37145635
type: QuestionComment
comment on: http://stackoverflow.com/q/24084973
score: 1
has text: Could you use the `<test>` element instead of the `<batchtest>`? It allows you to specify a dedicated test-result-file (attribute: `outfile`) and even allows you to select the test-methods to be executed (attribute: `methods`)
type: Comment

jnlp
tags question: http://stackoverflow.com/q/23995099
tag name: jnlp
type: Tag

http://stackoverflow.com/q/24030724
has body: I am doing a toy program that asks user to input "username" and "fullname" on an html form, the form will be submitted by AJAX to the following method in Spark framework (see here for Spark: post("/admin/user/signup", "application/json", (request, response) -&gt; { String username = request.queryParams("username"); String fullname = request.queryParams("fullname"); System.out.println("username is: " + username +", full name is: " + fullname); Map&lt;String, Object&gt; registerResults = new HashMap&lt;String, Object&gt;(); registerResults.put("success", "successfully registered " + username); return new MyMessage("successful registration!"); }, new JsonTransformer()); And the following is my AJAX code that supposedly submits and receives the response from the above post() method: &lt;script&gt; $(document).ready(function() { $('#registerForm').submit(function() { var formData = $('#registerForm').serialize(); /* capture the form data*/ $.getJSON('/admin/user/signup', formData, registerResults); // $.post('/admin/user/signup', formData, registerResults); /* get JSON back from the post method */ }); function registerResults(data) { $('#registerForm').fadeOut(); $('.starter-template').html(data.message); } // end of registerResults }); // end of ready &lt;/script&gt; However, the AJAX code cannot receive the JSON object, instead the JSON object is simply printed on the web page /admin/user/signup: {"message":"successful registration!"} So I am asking for help how to return the JSON object to AJAX request in Spark? thanks
has title: respond to AJAX request with JSON object?
type: Question
has answer: http://stackoverflow.com/a/24030805
tagged with: spark-java
score: 0
answer count: 3
tagged with: ajax
accepted answer: http://stackoverflow.com/a/24030805
possible better answer: http://stackoverflow.com/a/24031752
has answer: http://stackoverflow.com/a/24031752
has answer: http://stackoverflow.com/a/24030882
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

selenium-webdriver
tags question: http://stackoverflow.com/q/24056419
tags question: http://stackoverflow.com/q/24029576
tags question: http://stackoverflow.com/q/23949972
tags question: http://stackoverflow.com/q/23993829
tags question: http://stackoverflow.com/q/24052200
tags question: http://stackoverflow.com/q/24084573
tags question: http://stackoverflow.com/q/23958414
tags question: http://stackoverflow.com/q/24092257
tags question: http://stackoverflow.com/q/24029998
tags question: http://stackoverflow.com/q/23988281
tags question: http://stackoverflow.com/q/23942241
tags question: http://stackoverflow.com/q/24067577
tags question: http://stackoverflow.com/q/24058030
tags question: http://stackoverflow.com/q/23955430
tags question: http://stackoverflow.com/q/23978464
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/23982496
tags question: http://stackoverflow.com/q/24075808
tags question: http://stackoverflow.com/q/23959890
tags question: http://stackoverflow.com/q/23997701
tags question: http://stackoverflow.com/q/24025436
tags question: http://stackoverflow.com/q/23978952
tags question: http://stackoverflow.com/q/24008676
type: Tag
tags question: http://stackoverflow.com/q/24026147
tags question: http://stackoverflow.com/q/24073014
tags question: http://stackoverflow.com/q/24031417
tags question: http://stackoverflow.com/q/24049929
tags question: http://stackoverflow.com/q/24003199
tags question: http://stackoverflow.com/q/23949547

http://stackoverflow.com/a/25662367
type: Answer
has comment: http://stackoverflow.com/comment/40109485
answers question: http://stackoverflow.com/q/24000699
has comment: http://stackoverflow.com/comment/40118859
score: 0
has body: I am experiencing this exact issue. I am using JDK 7u67. Eclipse does not recognize javax.json, even though Oracle (the previous link: docs.oracle.com/javaee/7/tutorial/doc/jsonp002.htm#BABDFHHD) indicates that these classes are part of 7. I've been unable to find an answer. I did grab the .jar and put it in jre/lib/ext and eclipse was happy after a restart.

http://stackoverflow.com/comment/57923633
type: Comment
has text: @TagirValeev thanks, i've seen this lib few places, on habrahabr also, i'm gonna check it out for sure, seems like a good tool
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/34621495

http://stackoverflow.com/comment/53581420
score: 5
type: AnswerComment
type: Comment
has text: This is not a real solution. H2 will not permanently save data as far as I'm aware.
comment on: http://stackoverflow.com/a/25340415

http://stackoverflow.com/a/24102190
type: Answer
answers question: http://stackoverflow.com/q/24102020
score: 0
has body: Here is an outline of a solution start application get user input if user wants to create, create item and add the item to inventory else if user wants to see all items, show all items else if user wants to edit item, edit item else if user wants to exist, exit application For actual code, I suggest using an ArrayList of ProductItems, ie ArrayList&lt;ProductItem&gt; inventory=..., and having the user pass in parameters. Like if the user typed create shirt param1 param2 param3 then a shirt would be created with the given parameters and added to inventory, ie inventory.add(new ProductShirt(param1,param2,param3)); Check out the String.split method for more infomation on how to accomplish this

http://stackoverflow.com/q/23969712
favorite count: 0
tagged with: google-maps-android-api-2
tagged with: android
type: AnsweredQuestion
has title: google map implemenyation java.lang.RuntimeException: Unable to start activity
has answer: http://stackoverflow.com/a/23970768
upvote count: 1
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23970768
downvote count: 0
answer count: 1
has body: i keep on geting this exeption 05-31 07:42:01.640: E/AndroidRuntime(4133): FATAL EXCEPTION: main 05-31 07:42:01.640: E/AndroidRuntime(4133): Process: com.start.littldeamone, PID: 4133 05-31 07:42:01.640: E/AndroidRuntime(4133): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.start.littldeamone/com.start.littldeamone.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.os.Handler.dispatchMessage(Handler.java:102) 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.os.Looper.loop(Looper.java:136) 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.app.ActivityThread.main(ActivityThread.java:5017) 05-31 07:42:01.640: E/AndroidRuntime(4133): at java.lang.reflect.Method.invokeNative(Native Method) 05-31 07:42:01.640: E/AndroidRuntime(4133): at java.lang.reflect.Method.invoke(Method.java:515) 05-31 07:42:01.640: E/AndroidRuntime(4133): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 05-31 07:42:01.640: E/AndroidRuntime(4133): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 05-31 07:42:01.640: E/AndroidRuntime(4133): at dalvik.system.NativeStart.main(Native Method) 05-31 07:42:01.640: E/AndroidRuntime(4133): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 05-31 07:42:01.640: E/AndroidRuntime(4133): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713) 05-31 07:42:…

http://stackoverflow.com/q/24054272
tagged with: zk
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24055103
has body: I got a problem that is taking me days! I have a applet class that import classes in a external JAR. import com.github.sarxos.webcam.Webcam; import com.github.sarxos.webcam.WebcamPanel; import com.github.sarxos.webcam.WebcamResolution; public class AppletTela extends JApplet { private static final long serialVersionUID = 3517366452510566924L; private Dimension size = WebcamResolution.QVGA.getSize(); private Webcam webcam = null; private WebcamPanel panel = null; I export my applet project for a .Jar file, and try to use it in a web project. So in my .Zul file, I put the following coding &lt;applet code="AppletTela" codebase="." archive="teste.jar" codemsg="ZK is Simple and Rich!" id="ticker" width="400px" style="border: 1px" /&gt; and my teste.jar is under my WebContent folder. And Im getting the java.lang.NoClassDefFoundError for the WebcamPanel. Help me guys.!
type: Question
has title: java.lang.NoClassDefFoundError in applet class using ZK
tagged with: applet
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24055103

http://stackoverflow.com/q/24083816
favorite count: 0
tagged with: javafx-2
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: I'm looking to make an auto complete combo box in javafx by using a combo box. I have it being able to filter items, but one of the issues I'm having is that if the user uses the arrow keys to go through the filtered list, the combo box editor gets populated with that item, even if they actually don't want to select that item. Does anyone know how to disable this functionality from a combo box or will I have to make my own custom component. Here's what I have so far. public abstract class AutoComplete&lt;T&gt; extends ComboBox&lt;T&gt; { public AutoComplete() { setEditable(true); getEditor().setOnKeyReleased(this::handleKeyPressed); } private void handleKeyPressed(KeyEvent event) { event.consume(); if (event.getCode().isArrowKey()) { moveCaretToEnd(); show(); } else if (event.getCode().isLetterKey() &amp;&amp; !event.isControlDown()) { moveCaretToEnd(); show(); handleTextInputChanged(); } else if (getItems().size() == 0) { hide(); } else if (event.getCode() == KeyCode.ESCAPE) { hide(); } else if (event.getCode() == KeyCode.BACK_SPACE) { show(); handleTextInputChanged(); } } private void moveCaretToEnd(){ getEditor().positionCaret(getText().length()); } protected void handleTextInputChanged(){ } protected abstract String display(T item); } Any help in disabling this functionality in combo box would be greatly appreciated.
type: Question
has title: JavaFX ComboBox auto fills editor text when using arrow keys
has answer: http://stackoverflow.com/a/24088585
tagged with: javafx-8
accepted answer: http://stackoverflow.com/a/24088585
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23982878
has answer: http://stackoverflow.com/a/23983224
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23983091
has title: How to get my program to start over when the user hits "y" on
tagged with: java
has body: So I've used System.out.print("Enter more test scores? (y/n): "); yet when I run it and all the scores are summarizes the user isn't given the chance to do it again here is my code. Do you guys think I may have put it in the wrong place. public class TestScoreApp { public static void main(String[] args) { // display operational messages System.out.println("Please enter the number of test scores to be entered"); System.out.println("To end the program enter 999."); System.out.println(); // print a blank line int scoreTotal = 0; int scoreCount = 0; int testScore = 0; int min = 100; int max = 0; int counter = 0; int setNumber = 0; String userAnswer = "n"; Scanner sc = new Scanner(System.in); // get a series of test scores from the user outerLoop: do { // user enters number of test scores to be entered System.out.print("Enter the number of test scores to be entered: "); setNumber = sc.nextInt(); if (setNumber &gt; 0 &amp;&amp; setNumber != 999) { while (setNumber &gt; 0) { // user enters test scores System.out.print("Enter score: "); testScore = sc.nextInt(); // accumulate score count and score total if (testScore &lt;= 100) { scoreCount += 1; scoreTotal += testScore; setNumber --; } //Added for Exercise 2-2, #4 modified if statement else if (testScore &gt; 100 || testScore &lt; 0) { System.out.println("Invalid entry, score not counted"); } else if (testScore == 999) { System.out.println("Average test score complete"); } if (testScore &gt; max &amp;&amp; testScore &lt;= 100) { max = testScore; } if (testScore &lt; min &amp;&amp; testScore &gt;= 0) { min = testScore; } if (setNumber == counter) { break outerLoop; } //End of test scores while loop } userAnswer = sc.next(); } }// end of do loop while(userAnswer.compareTo("y") == 0 ); System.out.print("Enter more test scores? (y/n): "); // display the score count, score total, and average score // Added casting from int ot double Exercise 3-2 #5 double averageScore = (double) scoreTotal / (double) scoreCount; // Added number…
tagged with: loops
downvote count: 1
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/23983224
score: -1
has comment: http://stackoverflow.com/comment/36954836
answer count: 3
tagged with: system.out
favorite count: 0
possible better answer: http://stackoverflow.com/a/23983630
has answer: http://stackoverflow.com/a/23983630

http://stackoverflow.com/a/34127267
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24096331
has body: Try downloading javafx scene builder from the link: http://www.oracle.com/technetwork/java/javafxscenebuilder-1x-archive-2199384.html Then integrate it with your ide by Window>preferences and add a file adssociation as an external program to it.
score: 1

japplet
tags question: http://stackoverflow.com/q/23964967
tags question: http://stackoverflow.com/q/23980853
tags question: http://stackoverflow.com/q/24052807
tag name: japplet
tags question: http://stackoverflow.com/q/24072852
type: Tag

http://stackoverflow.com/comment/37149764
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24087459
has text: I don't know what string transformation is. Can you please give some explamples of some strings that are/aren't transformations of each other (and why)? Also you compare strings using `==`, you udefinetly want to change that to `.equals()`, see http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
score: 1

http://stackoverflow.com/comment/37005077
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23991623
has text: Could you post your involved tables?
score: 0

http://stackoverflow.com/q/23957393
has answer: http://stackoverflow.com/a/23957725
accepted answer: http://stackoverflow.com/a/23957725
favorite count: 0
has answer: http://stackoverflow.com/a/23957466
type: AnsweredQuestion
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/36906925
has title: sorting objects from different classes java
score: 1
tagged with: java
has body: I hava below task. I stuck on the problem a). Create classes, which describe employees with hourly wage and fixed payment. Give your suggestions about relations between classes. Implement method for calculating the average monthly salary. For employees with hourly wage use next formula: “average monthly salary= 20.8*8* hourly rate”, for employees with fixed payment – “average monthly salary= fixed monthly payment”. Write well commented code for solving next problems a) Sort the collection of employees in descending order by the average monthly salary. In the case of equal salary – by the name. Write ID, name and monthly salary for all employees from collection. b) Write information about first five employees from collection (problem a). c) Write ID of three last employees from collection (problem b). d) Write code for reading and writing collection of these objects from (into) file. e) Write code for handling the incorrect format of incoming file. I have created below classes, but I have no idea how to sort different objects from different classes. Please help me!!!! import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub List&lt;EmployeeFixedPayment&gt; coll = new ArrayList&lt;Employee&gt;(); EmployeeHourlyWage a = new EmployeeHourlyWage("Edd", "Goo", 23, 4); EmployeeHourlyWage b = new EmployeeHourlyWage("Tedd", "Foo", 2, 5); EmployeeHourlyWage c = new EmployeeHourlyWage("Bob", "Bee", 4, 2); EmployeeHourlyWage d = new EmployeeHourlyWage("Kate", "See", 2, 5); EmployeeFixedPayment e = new EmployeeFixedPayment("Lisa", "Lee", 7, 500); EmployeeFixedPayment f = new EmployeeFixedPayment("Mike", "Ree", 10, 450); EmployeeFixedPayment g = new EmployeeFixedPayment("Izia", "Kurz", 13, 1000); EmployeeFixedPayment j = new EmployeeFixedPayment("Aisha", "Moore", 20, 800); coll.add(a); coll.add(b); coll.add(c); coll.add(d); coll.add(e); coll.add(f); coll.add(g); coll.add(j); Collections.sort(coll); // System.out.println(co…
tagged with: class
possible better answer: http://stackoverflow.com/a/23957466
upvote count: 2
answer count: 2
downvote count: 1
tagged with: sorting

http://stackoverflow.com/q/24074888
tagged with: java
tagged with: javafx
has title: Preload a JavaFX stage before show()
has body: In JavaFX I'm switching from one stage to another with stage1.hide(); stage2.show(); However, stage2 is quite big and contains a whole bunch of elements. So when I show() it, when it pops up for the first time, there is a 400-millisecond period of time where the whole stage is empty and grey. Then all the elements appear. It's horribly ugly. This is on an i7 with a really good GPU. I have noticed that if I show it, then hide it, then show it again, the final show will look perfect from the moment it appears on screen. However there is a flashing when I hide() then show() the stage for the first time, so that won't work. Is it somehow possible to achieve what I described in the above paragraph without having to have the stage appear on screen beforehand? This is on Java 8u5 with the new Modena theme. It is worth noting that with JavaFX 2.2 this issue is not present. Thankyou!
has comment: http://stackoverflow.com/comment/37209056
type: Question
has comment: http://stackoverflow.com/comment/37127210
has comment: http://stackoverflow.com/comment/37208018
accepted answer: http://stackoverflow.com/a/24128094
has comment: http://stackoverflow.com/comment/37207608
has comment: http://stackoverflow.com/comment/37126486
tagged with: javafx-8
score: 2
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24128094
type: AnsweredQuestion

http://stackoverflow.com/comment/36952697
has text: Yes I have edited my post but that is the another issue that will be encountered once this issue is resolved. In JPS `apis/Test` is used in form as `action` and url-pattern `/test` is defiend in `web.xml`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23981716
type: Comment

http://stackoverflow.com/comment/37035514
comment on: http://stackoverflow.com/q/24025806
score: 0
type: QuestionComment
has text: The `rolling` works fine, the day `logfile.log` disappears, the last modification time is `00:00` as expected.
type: Comment

http://stackoverflow.com/comment/37110791
type: QuestionComment
has text: @developerwjk that's not a great idea, it will fire two requests to the server: 1) GET request for the page, 2) GET request for the servlet.
score: 0
comment on: http://stackoverflow.com/q/24066367
type: Comment

http://stackoverflow.com/q/24066740
tagged with: jakarta-mail
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/117099074
linked to: http://stackoverflow.com/q/66234054
accepted answer: http://stackoverflow.com/a/24075785
tagged with: smtp
type: Question
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24075785
answer count: 1
has body: I have an Outlook.com email account. I want my Java app to be able to send emails from that email account using JavaMail. To do that, I've granted my app access via OAuth. I have been able to successfully connect via IMAP using the wonderful sample app available in msgshow.java. However, I'm trying to send an email through my Outlook.com email account via SMTP and I'm not having any luck. I've tried using both the msgsend.java and smtpsend.java apps. However, I haven't had any luck. I tried: java -Dmail.smtp.starttls.enable=true msgsend -d -M smtp-mail.outlook.com -U myAddress@outlook.com -P [oauthAccessToken] recipient@domain.com which returned: 550 5.7.3 Requested action aborted; user not authenticated DEBUG SMTP: got response code 550, with response: 550 5.7.3 Requested action aborted; user not authenticated RSET DEBUG SMTP: EOF: [EOF] DEBUG SMTP: MessagingException while sending, THROW: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.3 Requested action aborted; user not authenticated ; nested exception is: com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.3 Requested action aborted; user not authenticated at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2202) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1693) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1194) at javax.mail.Transport.send0(Transport.java:254) at javax.mail.Transport.send(Transport.java:124) at msgsend.main(msgsend.java:188) Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.3 Requested action aborted; user not authenticated at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1700) ... 4 more I also tried: java -Dmail.smtp.starttls.enable=true smtpsend -d -A -M smtp-mail.outlook.com -U myAddress@outlook.com -P [oauthAccessToken] recipient@domain.com I got: DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM DEBUG SMTP: AUTH LOGIN command trace suppressed DEBUG SMTP: AUTH LOGIN f…
has title: Sending an email with OAuth and JavaMail

http://stackoverflow.com/q/24042963
has comment: http://stackoverflow.com/comment/37067895
favorite count: 0
has comment: http://stackoverflow.com/comment/37067214
has comment: http://stackoverflow.com/comment/37067629
has comment: http://stackoverflow.com/comment/37067792
has comment: http://stackoverflow.com/comment/37067023
has comment: http://stackoverflow.com/comment/37068423
has answer: http://stackoverflow.com/a/24043051
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37069427
upvote count: 1
has comment: http://stackoverflow.com/comment/37067943
has comment: http://stackoverflow.com/comment/37067463
has comment: http://stackoverflow.com/comment/37068608
has comment: http://stackoverflow.com/comment/37067168
has comment: http://stackoverflow.com/comment/37069017
has comment: http://stackoverflow.com/comment/37067831
has comment: http://stackoverflow.com/comment/37067697
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37068662
tagged with: loops
tagged with: memory
has comment: http://stackoverflow.com/comment/37067547
type: Question
tagged with: crash
has title: how to empty all variables in a long for loop to avoid the program to run out of memory?
answer count: 2
has comment: http://stackoverflow.com/comment/37067316
tagged with: for-loop
has answer: http://stackoverflow.com/a/24043097
has body: I have a for loop that runs 20.000 times with a for loop inside it that runs 20.000 times as well which adds up to a total of 400 million. in the for loop it adds 20.000 numbers to a string and then writes this string into a txt file. after the writing the string is being set empty like this :String Name = ""; so i will get a total of 20.000 text files with each 20.000 numbers in it. now if the for loop has created about 200 files it starts to run out of memory and crashes eventually. how can i avoid this? -- here is the code -- public static void mapScanner() { String content = ""; for(int z = -10000; z &lt; 10000; z++) { Util.CreateFile(z); for(int x = -10000; x &lt; 10000; x++) { Block block = Bukkit.getServer().getWorld("world").getBlockAt(x, Bukkit.getServer().getWorld("world").getHighestBlockYAt(x, z) -1, z); if(block.getType() != Material.AIR) { content += Blocks.blockID(block.getType()); } } try { File file = new File("plugins/Map/" + z + ".txt"); System.out.println(content); FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); content = ""; System.out.println("The file : " + z + ".txt has been created and written."); } catch (IOException e) { e.printStackTrace(); } } } block.getType() just returns a number. General code : for(int x = 0; x &lt; 20000; x++) { String content = ""; CreateFile(x); for(int z = 0; z &lt; 20000; z++) { content += "1"; } try { File file = new File("Map/" + x + ".txt"); FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); //System.out.println("The file : " + x + ".txt has been created and written."); } catch (IOException e) { e.printStackTrace(); } } public static void CreateFile(int z) { File file = new File("Map/" + z + ".txt"); boolean fileCreated = false; try { fileCreated = file.createNewFile(); } catch (IOException ioe) { //System.out.println("Error while creating empty file…
downvote count: 0

http://stackoverflow.com/comment/37051333
type: Comment
has text: yes change the value of field according to array length or value.
comment on: http://stackoverflow.com/q/24034636
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37038005
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24021377
has text: Can't you just use a OCR library for Java?

http://stackoverflow.com/a/23964790
upvote count: 1
has comment: http://stackoverflow.com/comment/36922366
downvote count: 0
type: Answer
score: 1
has body: I'm afraid you're misinterpreting what the author is saying: int hour = 11; int minute = 59; printTime(int hour, int minute); // WRONG! In Java, you do have to specify the type of each variable you use, but you only do so once - when you declare it initially, which is what is being done in the first two lines of the code above. int hour = 11; int minute = 59; printTime(hour, minute); // RIGHT! Thereafter, whenever Java encounters one of these variables, it looks back to its initial declaration to determine its type. This is done automatically: You do not have to re-specify a variable's type each time you use it - and indeed, as you've discovered, you cannot, as doing so results in a syntactical error that will prevent your code from compiling. (Note that this paradigm holds true in all strongly typed languages, of which Java is one of many). I wonder if you're confused after having seen things like this void printTime(int hour, int minute){ } which is correct. The key difference, of course, is that here we are looking at a method declaration: In this context, (int hour, int minute) is not analogous to the third line of the code above but rather to the first two lines: It is declaring two variables of type int named hour and minute in the context of that method. What's different is that, in the code above, the variables are being declared and initialized in one step, but note that: int hour; //variables DECLARED (given a name and type) int minute; hour = 11; //variables INITIALIZED (set to an initial value) minute = 59; is valid as well, and this is essentially what's happening in our method declaration: (int hour, int minute) declares two int variables named hour and minute, but they don't get initialized until the method is called, at which point they're set to the values passed in as parameters. Update: That being said, I'm merely speculating here about the source of your confusion, which is ultimately about how to invoke methods rather than with how to declare th…
has comment: http://stackoverflow.com/comment/36923664
has comment: http://stackoverflow.com/comment/36923461
has comment: http://stackoverflow.com/comment/36923582
has comment: http://stackoverflow.com/comment/36923650
has comment: http://stackoverflow.com/comment/36923884
has comment: http://stackoverflow.com/comment/36923313
answers question: http://stackoverflow.com/q/23964666

http://stackoverflow.com/comment/36965707
comment on: http://stackoverflow.com/a/23970411
has text: The problem is that, due date is different for every task so direct calculation don't work as expected, i guess calculation should be done within query
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24003525
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24440805
type: Question
answer count: 1
downvote count: 0
has title: Stop keyboard from opening up when enter button is pressed?
favorite count: 0
has body: I have an activity with a numeric EditText sitting above a button. I have noticed that if you click in the edit text and use the hard keyboard to type some numbers then press the hard enter, that it shifts the focus to the button below the edit text and a QWERTY keyboard appears. How do I stop this from happening? I have tried to control the enter key with the following: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activityEnterAmt); final EditText editText = (EditText) findViewById(R.id.editTextEnterAmt); editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((event != null &amp;&amp; (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { Log.i("Tag", "Enter pressed or IME Action Submit pressed"); saveButtonClick(editText); } return false; } }); } But I really want to stop it from opening up the keyboard when you press enter. I don't really understand why it is doing this? Thanks
tagged with: android
tagged with: android-studio
score: 2
has answer: http://stackoverflow.com/a/24440805
upvote count: 2

http://stackoverflow.com/comment/37040815
type: Comment
has text: I'm not sure how helpful a single thread dump will be... Perhaps a profiler would work better?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24028755

http://stackoverflow.com/a/24044145
answers question: http://stackoverflow.com/q/24043980
has body: Given the information you've provided, you could try this copying your code into an already existing file that works fine and run it. If this works then look at your file creation again... if not, give a more detailed description of your problem.
type: Answer
has comment: http://stackoverflow.com/comment/37070051
score: 0

maven
tags question: http://stackoverflow.com/q/24078820
tags question: http://stackoverflow.com/q/24034404
tags question: http://stackoverflow.com/q/24002081
tags question: http://stackoverflow.com/q/23952257
tags question: http://stackoverflow.com/q/24000880
tags question: http://stackoverflow.com/q/23968713
type: Tag
tags question: http://stackoverflow.com/q/24021953
tags question: http://stackoverflow.com/q/24017685
tags question: http://stackoverflow.com/q/23976264
tags question: http://stackoverflow.com/q/24025277
tags question: http://stackoverflow.com/q/24037409
tags question: http://stackoverflow.com/q/24061891
tags question: http://stackoverflow.com/q/24067440
tags question: http://stackoverflow.com/q/24099350
tags question: http://stackoverflow.com/q/23990663
tags question: http://stackoverflow.com/q/24023155
tags question: http://stackoverflow.com/q/23979578
tags question: http://stackoverflow.com/q/23967353
tags question: http://stackoverflow.com/q/23947767
tags question: http://stackoverflow.com/q/23993805
tags question: http://stackoverflow.com/q/23975272
tags question: http://stackoverflow.com/q/24081388
tags question: http://stackoverflow.com/q/24062982
tags question: http://stackoverflow.com/q/23973131
tags question: http://stackoverflow.com/q/23976398
tags question: http://stackoverflow.com/q/24035743
tags question: http://stackoverflow.com/q/23975966
tags question: http://stackoverflow.com/q/24065678
tags question: http://stackoverflow.com/q/24011169
tags question: http://stackoverflow.com/q/24077826
tags question: http://stackoverflow.com/q/23974610
tags question: http://stackoverflow.com/q/24033804
tags question: http://stackoverflow.com/q/23959995
tags question: http://stackoverflow.com/q/24102137
tags question: http://stackoverflow.com/q/23986331
tags question: http://stackoverflow.com/q/23991614
tags question: http://stackoverflow.com/q/24064260
tags question: http://stackoverflow.com/q/24012216
tags question: http://stackoverflow.com/q/24049177
tags question: http://stackoverflow.com/q/24077970
tags question: http://stackoverflow.com/q/24086252
tags question: http://stackoverflow.com/q/24082427
tags question: http://stackoverflow.com/q/23981281
tags question: http://stackoverflow.com/q/24069464
tags question: http://stackoverflow.com/q/23993633
tags question: http://stackoverflow.com/q/24087342
tags question: http://stackoverflow.com/q/24084745
tags question: http://stackoverflow.com/q/24029349
tags question: http://stackoverflow.com/q/24093789
tags question: http://stackoverflow.com/q/24086163
tags question: http://stackoverflow.com/q/24067295
tags question: http://stackoverflow.com/q/23943455
tags question: http://stackoverflow.com/q/24078223
tags question: http://stackoverflow.com/q/23974207
tags question: http://stackoverflow.com/q/24094174
tags question: http://stackoverflow.com/q/24063581
tags question: http://stackoverflow.com/q/24038356
tags question: http://stackoverflow.com/q/24081636
tags question: http://stackoverflow.com/q/23960202
tags question: http://stackoverflow.com/q/24077477
tags question: http://stackoverflow.com/q/23975000
tags question: http://stackoverflow.com/q/24042224
tags question: http://stackoverflow.com/q/24065120
tags question: http://stackoverflow.com/q/23951547
tags question: http://stackoverflow.com/q/24065450
tags question: http://stackoverflow.com/q/24058573
tags question: http://stackoverflow.com/q/24095451
tags question: http://stackoverflow.com/q/24047499
tags question: http://stackoverflow.com/q/24065807
tags question: http://stackoverflow.com/q/24086380
tags question: http://stackoverflow.com/q/24017638
tags question: http://stackoverflow.com/q/24081499
tags question: http://stackoverflow.com/q/24051476
tags question: http://stackoverflow.com/q/23987633
tags question: http://stackoverflow.com/q/24013736
tags question: http://stackoverflow.com/q/24049175
tags question: http://stackoverflow.com/q/24014883
tags question: http://stackoverflow.com/q/23969219
tags question: http://stackoverflow.com/q/24104819

http://stackoverflow.com/q/24058419
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37095640
has body: I have the error ArrayIndexOutofBounds. Please help me I am newbie to java. class Sum{ int a,b,c; void assign (int x, int y){ a=x; b=y; } void add(){ c=a+b; } void disp(){ System.out.println("Sum of"+a+"and"+b+"is ="+c); } } class SumDemo{ public static void main(String k[]){ int x=Integer.parseInt (k [0]); int y=Integer.parseInt (k [1]); Sum s0=new Sum(); s0.assign(x,y); s0.add(); s0.disp(); } } this is the code. please help me . why this error is occurring?
tagged with: java
has comment: http://stackoverflow.com/comment/37095617
has answer: http://stackoverflow.com/a/24058517
upvote count: 1
has comment: http://stackoverflow.com/comment/37095605
type: Question
has answer: http://stackoverflow.com/a/24058556
has title: Exception in thread "main" java.lang.ArrayIndexOutofBounds Exception : 0 at runtime
downvote count: 4
has comment: http://stackoverflow.com/comment/37095720
accepted answer: http://stackoverflow.com/a/24058517
has comment: http://stackoverflow.com/comment/37095607
favorite count: 0
has answer: http://stackoverflow.com/a/24058591
has comment: http://stackoverflow.com/comment/37095714
has comment: http://stackoverflow.com/comment/37095684
has answer: http://stackoverflow.com/a/24058518
score: -3
answer count: 4
possible better answer: http://stackoverflow.com/a/24058518

http://stackoverflow.com/q/24015327
answer count: 2
tagged with: interop
downvote count: 0
has answer: http://stackoverflow.com/a/24141541
favorite count: 0
has body: This seems to be a bug but I would like to know if there is a way to get around this problem. I have a class defined as follows (ns myns.myext.anotherext.client (:gen-class :implements [myns.myext.core.client] :prefix - :init init :state state ) (:require [myns.myext.core]) ) I don't know if it is obvious but the myns.myext.core.client is a definterface in myns.myext.core as follows... (ns myns.myext.core) (definterface client (^void foo []) ) This is a library that has no main but it will not compile. It is getting a class not found exception because it is trying to compile the myns.myext.core.client before the myns.myext.core . Is there any hack I can use to force liningen to compile these in the correct order? The project definition is using :aot :all . There is no problem with the code because if I comment out the implements in the gen class, compile, uncomment the implements and recompile it works fine. End users can't be expected to be altering code just to get libraries to compile. Version: Leiningen 2.3.4 on Java 1.7.0_55 Java HotSpot(TM) 64-Bit Server VM
tagged with: clojure
score: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24021343
type: Question
has title: How can you make leiningen evaluate requires before implements?
tagged with: leiningen
upvote count: 2

http://stackoverflow.com/a/24107540
has body: I figured out my issue. There were a couple of issues. With all my testing, i have been attempting to sign in the whole time. And was successful sometimes. Somehow, i was remaining authenticated even though my app was not signed in. I added the ability to sign out and revoke access. After revoking access and attempting to sign in again, the Activity would launch to resolve any errors. I was also having the issue that is being discussed here. My host Activity was consuming my onActivityResult(...) from my connectionResult.startResolutionForResult(...);. So, after some trial and error i finally found a solution to that issue as well. The question linked helped but did not fully solve the issue. Please view my answer to that question for how i solved the problem. Lesson, make sure that you are signing out and revoking access while testing. If you are having these issues, try revoking access and then signing back in.
type: AcceptedAnswer
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24041462
downvote count: 0
answers question: http://stackoverflow.com/q/24041462
score: 4

http://stackoverflow.com/comment/36933085
score: 0
type: AnswerComment
has text: @Braj I know. That is another problem I mentioned in answer.
type: Comment
comment on: http://stackoverflow.com/a/23971194

http://stackoverflow.com/a/48492304
type: Answer
score: 0
has body: tl;dr LocalDate.now() .getDayOfMonth() …and… YearMonth.from( LocalDate.now() ).lengthOfMonth() // .getMonthValue() .getYear() java.time The modern approach uses the industry-leading java.time classes. LocalDate The LocalDate class represents a date-only value without time-of-day and without time zone. A time zone is crucial in determining a date. For any given moment, the date varies around the globe by zone. For example, a few minutes after midnight in Paris France is a new day while still “yesterday” in Montréal Québec. If no time zone is specified, the JVM implicitly applies its current default time zone. That default may change at any moment, so your results may vary. Better to specify your desired/expected time zone explicitly as an argument. Specify a proper time zone name in the format of continent/region, such as America/Montreal, Africa/Casablanca, or Pacific/Auckland. Never use the 3-4 letter abbreviation such as EST or IST as they are not true time zones, not standardized, and not even unique(!). ZoneId z = ZoneId.of( "America/Montreal" ) ; LocalDate today = LocalDate.now( z ) ; If you want to use the JVM’s current default time zone, ask for it and pass as an argument. If omitted, the JVM’s current default is applied implicitly. Better to be explicit. ZoneId z = ZoneId.systemDefault() ; // Get JVM’s current default time zone. Or specify a date. You may set the month by a number, with sane numbering 1-12 for January-December. LocalDate ld = LocalDate.of( 1986 , 2 , 23 ) ; // Years use sane direct numbering (1986 means year 1986). Months use sane numbering, 1-12 for January-December. Or, better, use the Month enum objects pre-defined, one for each month of the year. Tip: Use these Month objects throughout your codebase rather than a mere integer number to make your code more self-documenting, ensure valid values, and provide type-safety. LocalDate ld = LocalDate.of( 1986 , Month.FEBRUARY , 23 ) ; Parts Interrogate for the parts as needed. int dayOfMonth = l…
answers question: http://stackoverflow.com/q/24100603

http://stackoverflow.com/q/23986789
has comment: http://stackoverflow.com/comment/36962008
score: 0
has comment: http://stackoverflow.com/comment/36962038
answer count: 1
type: UnansweredQuestion
tagged with: interface
tagged with: java
has title: Java interface code error
has comment: http://stackoverflow.com/comment/36961997
has answer: http://stackoverflow.com/a/23986816
type: Question
has body: I can't understand why I'm getting an error on the line indicated below. if there is a specific topic which covers it please provide a line (or an explanation). public interface Button { void press(); } public class Bomb implements Button { public void press() { System.out.println("Doesn't work"); } void boom() { System.out.println("Exploded"); } } public class Test { public static void main(String[] args) { Button redButton = new Bomb(); redButton.press(); redButton.boom(); // &lt;-- Error is on this line. } }
has comment: http://stackoverflow.com/comment/36962025

http://stackoverflow.com/a/48640678
has body: findify/s3mock - an in-process, Java S3 server aimed at testing. Didn't test it - just stumbled upon it. Needs no docker, which might be an advantage. HTH! :)
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23991694
has comment: http://stackoverflow.com/comment/99158254
downvote count: 0

http://stackoverflow.com/a/23954573
type: Answer
has comment: http://stackoverflow.com/comment/36905662
answers question: http://stackoverflow.com/q/23954329
has body: You may have to run Maven clean install command, and restart your server
score: 0

http://stackoverflow.com/a/23976908
has comment: http://stackoverflow.com/comment/36943474
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23976811
has body: The Java versions are as follows. J2SE 8 = 52, J2SE 7 = 51, J2SE 6.0 = 50, J2SE 5.0 = 49, JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45 As per package description it seems that it is your class(you have written the src). The exception reported by you generally thrown when you compiled source file with higher/lower version of jdk then the version you are using in runtime. To fix this problem you have to use same version in compiling(JDK) and running (JVM). To check the version of compiler and JVM use following commands. Compiler javac -version JVM javac -version

late-binding
type: Tag
tag name: late-binding
tags question: http://stackoverflow.com/q/23976797

http://stackoverflow.com/comment/36989418
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24000926
has text: The documentation indeed states that it will be called after doInBackground is done. After all, it will get the returned value of doInBackground passed as its parameter. It won't be called if the doInBackground is cancelled.
type: AnswerComment

http://stackoverflow.com/comment/37050261
comment on: http://stackoverflow.com/q/24033787
has text: No, happens before is only for array access, not for the references inside it imho.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24064985
type: Answer
has body: Add your listener from an IInitializer, i.e. add wicket.properties and your implementation to your test class folder.
score: 0
has comment: http://stackoverflow.com/comment/37131673
answers question: http://stackoverflow.com/q/24053384

http://stackoverflow.com/q/24036108
has title: Autowire @Component bean in a XML bean
has comment: http://stackoverflow.com/comment/37058586
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37070070
has comment: http://stackoverflow.com/comment/37055147
linked to: http://stackoverflow.com/q/4549034
upvote count: 1
tagged with: spring
has body: I'd like to autowire a bean annotated with @Component in a bean declared in the xml config. XML &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="test" /&gt; &lt;bean id="testClass" class="test.TestClass"/&gt; TestClass.java public class TestClass { @Autowired LocaleProvider locale; public void test() { locale.getMessage("test"); } } LocaleProvider.java @Component public class LocaleProvider { ... public String getMessage(String key, Object... args) throws NoSuchMessageException { return ...; } }) TestController.java @Controller public class TestController { @Autowired TestClass test; @RequestMapping("/") public Object handle() { test.test(); } } The xml bean is correctly created but the variable locale is always null... Stacktrace java.lang.NullPointerException at test.TestClass.test(TestClass.java:16) // = locale.getMessage("test"); at test.TestController.handle(TestController.java:23) Log 14:38:23,982 | INFO | DefaultListableBeanFactory:577 | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1ef6144: defining beans [org.springframework.context.annotation.CommonAnnotationBeanPostProcessor#0,_jsonConfigMapEditorConfigurer,_hibernateSerializationConfigPostProcessor,**testClass**,org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.DefaultSecurityFilterChain#0,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.PortResolverImpl#0,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.s…
has comment: http://stackoverflow.com/comment/37058229
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37053975
has comment: http://stackoverflow.com/comment/37057322
linked to: http://stackoverflow.com/q/24034667
type: Question
has comment: http://stackoverflow.com/comment/37055858
downvote count: 0
tagged with: javabeans
has comment: http://stackoverflow.com/comment/37055564
favorite count: 0
has comment: http://stackoverflow.com/comment/37055639
has comment: http://stackoverflow.com/comment/37065000
has comment: http://stackoverflow.com/comment/37056061
has comment: http://stackoverflow.com/comment/37056470

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/23965900
type: Tag

apache-axis
tags question: http://stackoverflow.com/q/24058867
tags question: http://stackoverflow.com/q/24057512
tags question: http://stackoverflow.com/q/24078142
tags question: http://stackoverflow.com/q/24042555
tag name: apache-axis
tags question: http://stackoverflow.com/q/24038981
tags question: http://stackoverflow.com/q/23952879
tags question: http://stackoverflow.com/q/24041700
type: Tag

http://stackoverflow.com/comment/36970322
has text: The encoded representation of the - character is \u002d , \u0096 seems to be a control START OF GUARDED AREA .
comment on: http://stackoverflow.com/q/23991289
type: Comment
type: QuestionComment
score: 1

swing
tags question: http://stackoverflow.com/q/23976481
tags question: http://stackoverflow.com/q/23966177
tags question: http://stackoverflow.com/q/24027348
tags question: http://stackoverflow.com/q/24055105
tags question: http://stackoverflow.com/q/24035898
tags question: http://stackoverflow.com/q/24080680
tags question: http://stackoverflow.com/q/24036650
tags question: http://stackoverflow.com/q/24041441
tags question: http://stackoverflow.com/q/24043471
tags question: http://stackoverflow.com/q/24030049
tags question: http://stackoverflow.com/q/24098137
tags question: http://stackoverflow.com/q/23949962
tags question: http://stackoverflow.com/q/24098386
tags question: http://stackoverflow.com/q/24064824
tags question: http://stackoverflow.com/q/24090470
tags question: http://stackoverflow.com/q/24064653
tags question: http://stackoverflow.com/q/23947811
tags question: http://stackoverflow.com/q/23976620
tags question: http://stackoverflow.com/q/24029893
tags question: http://stackoverflow.com/q/24086607
tags question: http://stackoverflow.com/q/24104875
tags question: http://stackoverflow.com/q/24027629
tags question: http://stackoverflow.com/q/24008582
tags question: http://stackoverflow.com/q/24092621
tags question: http://stackoverflow.com/q/23976945
tags question: http://stackoverflow.com/q/24003518
tags question: http://stackoverflow.com/q/24003210
tags question: http://stackoverflow.com/q/24018880
tags question: http://stackoverflow.com/q/23981472
tags question: http://stackoverflow.com/q/24100599
tags question: http://stackoverflow.com/q/23975531
tags question: http://stackoverflow.com/q/24005558
tags question: http://stackoverflow.com/q/23946171
tags question: http://stackoverflow.com/q/23955520
tags question: http://stackoverflow.com/q/23948257
tags question: http://stackoverflow.com/q/23981623
tags question: http://stackoverflow.com/q/24012321
tags question: http://stackoverflow.com/q/24094045
tags question: http://stackoverflow.com/q/24060751
tags question: http://stackoverflow.com/q/24101799
tags question: http://stackoverflow.com/q/24090152
tags question: http://stackoverflow.com/q/23978767
tags question: http://stackoverflow.com/q/24085019
tags question: http://stackoverflow.com/q/24055502
tags question: http://stackoverflow.com/q/24028481
tags question: http://stackoverflow.com/q/24045580
tags question: http://stackoverflow.com/q/23986441
tags question: http://stackoverflow.com/q/23954284
tags question: http://stackoverflow.com/q/23969578
tags question: http://stackoverflow.com/q/24000615
tags question: http://stackoverflow.com/q/24062494
tags question: http://stackoverflow.com/q/24017029
tags question: http://stackoverflow.com/q/24076612
tags question: http://stackoverflow.com/q/23945921
tags question: http://stackoverflow.com/q/24034926
tags question: http://stackoverflow.com/q/24081941
tags question: http://stackoverflow.com/q/24013420
tags question: http://stackoverflow.com/q/24091730
tags question: http://stackoverflow.com/q/24025938
tags question: http://stackoverflow.com/q/23983339
tags question: http://stackoverflow.com/q/24071180
tags question: http://stackoverflow.com/q/23957596
tags question: http://stackoverflow.com/q/24022647
tags question: http://stackoverflow.com/q/24020700
tags question: http://stackoverflow.com/q/23975076
tags question: http://stackoverflow.com/q/23958570
tags question: http://stackoverflow.com/q/24056600
tags question: http://stackoverflow.com/q/23977350
tags question: http://stackoverflow.com/q/24102646
tags question: http://stackoverflow.com/q/24069229
tags question: http://stackoverflow.com/q/24018612
tags question: http://stackoverflow.com/q/24097948
tags question: http://stackoverflow.com/q/23975200
tags question: http://stackoverflow.com/q/23990131
tags question: http://stackoverflow.com/q/24000962
tags question: http://stackoverflow.com/q/24095964
tags question: http://stackoverflow.com/q/23980423
tags question: http://stackoverflow.com/q/24096543
tags question: http://stackoverflow.com/q/23981877
tags question: http://stackoverflow.com/q/24020553

http://stackoverflow.com/a/24012296
has comment: http://stackoverflow.com/comment/37012063
has comment: http://stackoverflow.com/comment/37010695
upvote count: 1
has comment: http://stackoverflow.com/comment/37011781
has comment: http://stackoverflow.com/comment/37009853
has comment: http://stackoverflow.com/comment/37048325
type: Answer
has comment: http://stackoverflow.com/comment/37051186
has comment: http://stackoverflow.com/comment/37011918
answers question: http://stackoverflow.com/q/24011698
has comment: http://stackoverflow.com/comment/37024995
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37010027
has comment: http://stackoverflow.com/comment/37026328
accepted answer of: http://stackoverflow.com/q/24011698
has comment: http://stackoverflow.com/comment/37046451
has comment: http://stackoverflow.com/comment/37012238
has body: You need a cell renderer for your table. Something like this public class PriorityCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); if (Integer.valueOf(1).equals(table.getValueAt(row, 1))) { setForeground(Color.RED); // or background } return this; } } Installing of renderer: table.setDefaultRenderer(Object.class, new PriorityCellRenderer());
type: AcceptedAnswer

http://stackoverflow.com/comment/36941328
type: Comment
type: QuestionComment
has text: Well, it looks like you got past the first problem. The "unchecked" problem is because you're using `List` and `LinkedList` with no type parameter. Those should be avoided--Java allows them only for backward compatibility. Use `List<Guitar2>` and `LinkedList<Guitar2>`.
score: 0
comment on: http://stackoverflow.com/q/23965023

http://stackoverflow.com/comment/51003064
score: 1
type: AnswerComment
type: Comment
has text: This appears to be the only solution that has worked for me. +1
comment on: http://stackoverflow.com/a/26941179

http://stackoverflow.com/q/23962769
has comment: http://stackoverflow.com/comment/36919781
has comment: http://stackoverflow.com/comment/36919352
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36918699
favorite count: 0
score: 8
upvote count: 8
accepted answer: http://stackoverflow.com/a/24074771
tagged with: android
linked to: http://stackoverflow.com/q/27372638
has title: Android GPS incorrect location data on query
linked to: http://stackoverflow.com/q/6181704
has answer: http://stackoverflow.com/a/24078329
tagged with: gps
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24078329
type: Question
has body: I am not using mock locations for this... In fact the code was working fine just last week. I have an app that gathers GPS data and spits out a google maps link using X,Y coordinates generated by the application itself. I am not 100% sure why its not working the way it should be but when I request the app to make a google maps link based on the GPS location provided by the phone it tells me I am 5 - 6 blocks away from my point of origin (Where I actually am at the time) Not quite what I want it to do Knowns: I have the proper permissions set up All of the code worked last week just fine Here is the code to gather the GPS info: Toast.makeText(context, "Gathering GPS Data...", Toast.LENGTH_SHORT).show(); gps = new gpsTracker(Settings.this); if(gps.canGetLocation()){ try{ gps.getLocation(); lon = gps.getLongitude(); lat = gps.getLatitude(); Toast.makeText(getApplicationContext(), "Your location is - \nlat: " + lat + "\nlon: " + lon, Toast.LENGTH_LONG).show(); } catch(Exception e){} } else{ gps.showSettingsAlert(); } The class all of the above is pulling from: import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.provider.Settings; import android.util.Log; public class gpsTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters // The minimum time between updates in milli…
has comment: http://stackoverflow.com/comment/36918450
has answer: http://stackoverflow.com/a/24074771

http://stackoverflow.com/comment/36920134
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23964070
has text: Edit your question and insert the images.

http://stackoverflow.com/a/23949825
type: Answer
has body: Why don't you acquire the location in an AsyncTask and set a variable of the class foundLocation=true in PostExecute of the AsycTask, and pause your main thread with a while(!foundLocation){ // do something like a loading bar or something }
answers question: http://stackoverflow.com/q/23949438
score: 0

http://stackoverflow.com/q/24104642
has body: I was reading CyclicBarrier in the following link http://java-latte.blogspot.in/2013/10/cyclicbarrier-in-java-concurrency.html. In the example 1, CyclicRaceDemo.java main method, CyclicBarrier is being reused without calling reset method. I ran the example and it worked fine. So, I am wondering what's the use of reset method. When should it be called? Or do we need to call it at all?
accepted answer: http://stackoverflow.com/a/24104734
score: 11
type: AnsweredQuestion
tagged with: java
tagged with: concurrency
tagged with: java.util.concurrent
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24104734
has title: When to reset CyclicBarrier in java multithreading
has comment: http://stackoverflow.com/comment/113903361
upvote count: 11
favorite count: 0
tagged with: cyclicbarrier
tagged with: multithreading

http://stackoverflow.com/comment/37183887
has text: thanks that did the trick, I did like as follow `string rm="ASPECT"; Object objstr = rm; Object [] s = sentence.toArray(); for (int i = 0; i < s.Length; i++) { string com = s[i].ToString(); if (com == "ASPECT") { sentence.remove(i); } }` but I think this will take time for my average document that will have 90k words each....anyway thanks a lot
comment on: http://stackoverflow.com/a/24104810
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37107845
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24064635
has text: Do these two methods use different transaction managers?
score: 0

http://stackoverflow.com/comment/36944560
has text: +1 for the JLS reference.
type: Comment
comment on: http://stackoverflow.com/a/23977551
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36972423
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23983737
has text: I decided to use LESS which is an extension of CSS. A less parser will build CSS from values stored in the DB and template.less. Then a controller will return the result. I hope it will work...

http://stackoverflow.com/comment/37082219
comment on: http://stackoverflow.com/a/24050743
score: 0
type: Comment
has text: It's true that I can read it with specidied encoding again, but I just wonder if there is a way I can recover the string without having to specify the encoding. I found the string getting from sqlite have something like "锟斤拷" which is U+FFFD REPLACEMENT CHARACTER.
type: AnswerComment

http://stackoverflow.com/comment/36939908
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23975093
has text: @Pshemo http://pastebin.com/nuAsH857 is in the main post
score: 0

http://stackoverflow.com/a/24040804
type: Answer
upvote count: 1
score: 1
has body: An abstract class can not be instantiated with new. That's the whole point of the abstract keyword. The official Java tutorial reads: An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. When you want to create instances of a class which are exactly that class and none of its subclasses, then do not declare it as abstract. When you would like to keep your Cell class abstract for some reason, you could create an additional class SimpleCell extends Cell (or another appropriate name) and use this to represent the diagonals in your table.
answers question: http://stackoverflow.com/q/24040681
downvote count: 0

http://stackoverflow.com/q/24032453
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24032691
has answer: http://stackoverflow.com/a/24050303
tagged with: design-patterns
linked to: http://stackoverflow.com/q/616796
tagged with: factory-method
tagged with: abstract-factory
tagged with: java
has title: What is this Design Pattern?
downvote count: 1
type: Question
has body: I read the Wikipedia articles on FactoryMethod and AbstractFactory but the following code doesn't seem to fit anywhere. Can someone explain to me what the following pattern is or if it is an anti-pattern? interace PaymentGateway{ void makePayment(); } class PaypalPaymentGateway implements PaymentGateway { public void makePayment() { //some implementation } } class AuthorizeNetPaymentGateway implements PaymentGateway { public void makePayment() { //some implementation } } class PaymentGatewayFactory{ PaymentGateway createPaymentGateway(int gatewayId) { if(gatewayId == 1) return PaypalPaymentGateway(); else if(gatewayId == 2) return AuthorizeNetPaymentGateway(); } } Let's say the user selects the payment method using a radio button on an html page and the gatewayId is derived from the radio button value. I have seen code like this and thought it was the AbstractFactory pattern but after reading the Wikipedia article, I'm having doubts.
score: 3
upvote count: 4
has comment: http://stackoverflow.com/comment/37047616
has comment: http://stackoverflow.com/comment/37047432
answer count: 3
has answer: http://stackoverflow.com/a/24044806

http://stackoverflow.com/a/24021561
type: Answer
has body: Try: public void changeLocationCard() { new Thread(new Runnable() { public void run() { for(int i = 0; i &lt; 300; i++) { SwingUtilities.invokeLater(new Runnable() { public void run () { runCard(); } }); pause(500); } } }).start(); } Or check out TimerTask from the Swing-Api for a more API-based approach.
answers question: http://stackoverflow.com/q/24021319
score: 0

http://stackoverflow.com/q/24055380
has body: when starting my hibernate/spring application I am getting the following exception: 815 [main] WARN org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator - HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections 846 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect 871 [main] INFO org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000422: Disabling contextual LOB creation as connection was null 886 [main] INFO org.hibernate.engine.transaction.internal.TransactionFactoryInitiator - HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory 891 [main] INFO org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 1153 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update 1153 [main] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000102: Fetching database metadata 1153 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000299: Could not complete schema update java.lang.UnsupportedOperationException: The application must supply JDBC connections at org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:62) at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:505) at org.hibernate.cfg.Configuration.buildSessionFactor…
has comment: http://stackoverflow.com/comment/37090143
has title: UnsupportedOperationException - The application must supply JDBC connections
downvote count: 0
answer count: 1
tagged with: hsqldb
favorite count: 0
has answer: http://stackoverflow.com/a/24055960
has comment: http://stackoverflow.com/comment/37090337
has comment: http://stackoverflow.com/comment/37090933
tagged with: jdbc
tagged with: spring
accepted answer: http://stackoverflow.com/a/24055960
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37090250
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37090810
upvote count: 1
has comment: http://stackoverflow.com/comment/37090299
type: Question

http://stackoverflow.com/comment/37142701
comment on: http://stackoverflow.com/q/24083788
has text: @CyberneticTwerkGuruOrc u can see
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24080678
tagged with: ftp
type: UnansweredQuestion
has title: Difference between ftp apache setDefaultimeout() , setSoTimeout() and setDataTimeout()
score: 7
tagged with: java
tagged with: timeout
upvote count: 7
type: Question
tagged with: apache
has answer: http://stackoverflow.com/a/27028937
has body: The following blog explains about the ftp apache commens net libaray's different timeout viz setDefaultTimeout(),setSoTimeout(),setDataTimeout(). http://sudhirvn.blogspot.in/2007/05/ftpclient-timeout-values.html But please clarify my following doubts WRT the above mentioned timeouts? a)Does setSoTimeout() sets timeout only for ftp control connnetion and not data connection ? b)Does setDataTimeout() sets timeout only for ftp data connection and not control connection ?(I am asking this because it uses the underlying java.net.Socket.setSoTimeout() ) c)If we set setDefaultTimeout() ,then we dont need set/use setSoTimeout() and setDataTimeout() ?since the blog says that 'setDefaultTimeout() is used default for all connections made using this FTPClient instance.' d)Also do we need set connection timeout ? if we dont set it ,will the program rely on opearting system connection timeouts ? Thanks in advance :)
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24059188
answers question: http://stackoverflow.com/q/24058850
has body: What you said is possible in language like PHP as $s = 'stack'; ${$s} = 'hello there'; echo $stack; // hello there But it is not possible in strongly typed langauge like Java, C# etc.
type: Answer
score: 0

http://stackoverflow.com/q/23971641
has answer: http://stackoverflow.com/a/23974726
answer count: 1
tagged with: jsp
tagged with: tomcat
has body: I am trying to run a jsp file (test1.jsp) on tomcat server and it gives error!! test1.jsp: Hello World Hello World! <%@ page import="neww.*" %> <% Simple demo = new Simple(); out.println("Current date : " + demo.retur());%> <% out.println("Your IP address is " + request.getRemoteAddr()); %> Simple.java: package neww; import static com.hp.hpl.jena.query.ReadWrite.READ ; import static com.hp.hpl.jena.query.ReadWrite.WRITE ; import com.hp.hpl.jena.query.ReadWrite ; import com.hp.hpl.jena.query.Dataset ; import com.hp.hpl.jena.query.Query ; import com.hp.hpl.jena.query.QueryExecution ; import com.hp.hpl.jena.query.QueryExecutionFactory ; import com.hp.hpl.jena.query.QueryFactory ; import com.hp.hpl.jena.query.QuerySolution ; import com.hp.hpl.jena.query.ResultSet ; import com.hp.hpl.jena.tdb.TDBFactory ; import com.hp.hpl.jena.query.ResultSetFormatter; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.vocabulary.*; import java.util.Iterator; import java.util.Scanner; import com.hp.hpl.jena.sparql.sse.SSE ; import com.hp.hpl.jena.update.* ; import java.util.*; public class Simple{ public String retur(){ /*String query1; query1="hjcooljohny75@gmail.com"; //query1 = (String)(subjectentry.getText()); String s="SELECT ?x WHERE { ?x <TO:> '"+query1+"'}"; // subjectoutput.setText(s); String directory = "MYDATABASES/DATA2" ; Dataset ds = TDBFactory.createDataset(directory) ; Model model = ds.getDefaultModel() ; ds.begin(ReadWrite.READ) ; QueryExecution qExec = QueryExecutionFactory.create(s, ds) ; ResultSet rs = qExec.execSelect() ; String x=rs.toString(); String[] arr = null; while (rs.hasNext()) { QuerySolution qs = rs.next(); String rds = qs.get("x").toString(); // String em = (String)rs.getString(0); //arr = em.split("\n"); //for (int i =0; i < arr.length; i++){ return rds; } //if(rs==null) */ //subjectoutput.setText("sorry!!"); String s="hi"; return s; } } my directory structure is : /check/WEB-INF/classes//neww/Simple.java …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36934058
has comment: http://stackoverflow.com/comment/36942132
has title: error in running jsp file in tomcat?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2603288
has comment: http://stackoverflow.com/comment/36938233
score: 0

http://stackoverflow.com/q/24015502
has answer: http://stackoverflow.com/a/41301897
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/24015624
has answer: http://stackoverflow.com/a/78955232
has answer: http://stackoverflow.com/a/73753039
answer count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/37015933
has answer: http://stackoverflow.com/a/79103506
type: UnansweredQuestion
tagged with: tomcat7
upvote count: 7
has body: I have a Java web application that I have been working on 6 months ago and when I last worked on it, it would run perfectly. When I ran it again 6 months later I got this error "Can't find catalina.jar". I'm using IntelliJ 13.0 and tomcat 7.0.34. Can anybody help me with this problem?
has answer: http://stackoverflow.com/a/41611252
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/37479521
type: Question
has title: Error running Tomcat 7.0.34: Can't find catalina.jar

http://stackoverflow.com/q/24026003
has title: Is Annotation the best approach ? If so, how to persist it?
type: Question
has answer: http://stackoverflow.com/a/24028619
tagged with: java
accepted answer: http://stackoverflow.com/a/24028619
tagged with: eclipse
has body: I am working on an eclipse plug-in where some warnings are displayed to the developer, but some of them may be false positives. My idea is to provide an option where the developer can "ignore" the warning so that future verifications won't flag that code again. I found the code below and it works, but every time I close the file, the annotation gets deleted. public static void addInvisibleAnnotation(ASTNode node) { IAnnotationModel model = getAnnotationModel(getPath(getCompilationUnit(node))); if (null != model) { Annotation annotation = new Annotation(Constant.INVISIBLE_ANNOTATION, true, null); int offset = node.getStartPosition(); int length = node.getLength(); Position position = new Position(offset, length); model.addAnnotation(annotation, position); } There is a flag "isPersistent" and it is set to true. So I have some questions: 01 - Is Annotation the best approach ? 02 - Do I need a marker for the annotation ? 03 - How can I persist it ? Thank you!
score: 0
upvote count: 1
downvote count: 1
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
type: AnsweredQuestion
tagged with: annotations

http://stackoverflow.com/q/24006030
type: Question
linked to: http://stackoverflow.com/q/5621338
tagged with: layout-manager
duplicate of: http://stackoverflow.com/q/5621338
tagged with: jtable
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36998347
has title: Cant get JTable to appear on GUI.. what am I missing?
has body: I am trying to add a table to my GUI but when I change the layout of the frame from GridLayout to NULL it goes missing from the GUI? Code below for creation of the GUI: public SalariedEmployeeGUI() { setLayout(null); getContentPane().setBackground(Color.WHITE); JPanel salariedEmpTablePanel = new JPanel(); salariedEmpTablePanel.setLayout(null); salariedEmpTablePanel.setLocation(60,110); salariedEmpTablePanel.setSize(550,390); salariedEmpTablePanel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.BLUE, Color.DARK_GRAY), "Salaried Employee Table")); salariedEmpTablePanel.setBackground(Color.WHITE); sEmpTable = new JTable(); sEmpTable.setPreferredScrollableViewportSize(new Dimension(550, 390)); JScrollPane scrollPane = new JScrollPane(sEmpTable); salariedEmpTablePanel.add(sEmpTable); add(salariedEmpTablePanel); setupTable(); loadTable(); The setupTable and loadTable methods are below.. but I think they work fine: private void setupTable() { payrollQueries = new PayrollQueries(); tableModel = new DefaultTableModel(); tableModel.setColumnCount(5); tableModel.setColumnIdentifiers(new String[]{"First Name", "Last Name", "Type", "SSN", "Weekly Salary"}); sEmpTable.setModel(tableModel); } private void loadTable() { entries = payrollQueries.getSalariedEmployee(); int tableRow = 0; tableModel.setNumRows(entries.size()); System.out.println("number of salaries employees: " + entries.size()); for (SalariedEmployee se : entries) { tableModel.setValueAt(se.getFirstName(), tableRow, 0); tableModel.setValueAt(se.getLastName(), tableRow, 1); tableModel.setValueAt(se.getSocialSecurityNumber(), tableRow, 2); tableModel.setValueAt(se.geteType(), tableRow, 3); tableModel.setValueAt(se.getWeeklySalary(), tableRow, 4); tableRow++; } }
type: UnansweredQuestion
tagged with: swing
tagged with: null-layout-manager
tagged with: java
has answer: http://stackoverflow.com/a/24006040

dependency-injection
tags question: http://stackoverflow.com/q/24066512
type: Tag
tags question: http://stackoverflow.com/q/24040049
tags question: http://stackoverflow.com/q/24030609
tags question: http://stackoverflow.com/q/24067708
tags question: http://stackoverflow.com/q/24059636
tags question: http://stackoverflow.com/q/24048990
tags question: http://stackoverflow.com/q/24056328
tags question: http://stackoverflow.com/q/24022070
tag name: dependency-injection
tags question: http://stackoverflow.com/q/24001849
tags question: http://stackoverflow.com/q/24087342

http://stackoverflow.com/comment/37164385
has text: You cannot follow in in this case, you can only show its invocation. If there is no invocation and no specification, why would you model it in the sequence? You can then only model it in the claas diagram, it signature/declaration. That's the info you have.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24084201

http://stackoverflow.com/comment/87742416
has text: Hi, You can use following code. public class RandomCodeGenarator { public int getRandomCode() { return new Random().nextInt(1000000) + 0; } }
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23954453
type: Comment

http://stackoverflow.com/comment/50832909
type: Comment
score: 13
has text: No, turning lint off will not cause any side effects on the application. Lint is a code-analysis tool and the error mentioned here caused by setting the debuggable property can be viewed in detail in the "lint-results-release-fatal.html" file in the build/outputs folder.
type: AnswerComment
comment on: http://stackoverflow.com/a/24336042

http://stackoverflow.com/q/23978629
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Primefaces 5 <p:ajaxExceptionHandler /> java.lang.Exception handling
tagged with: jsf
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36946681
tagged with: primefaces
has answer: http://stackoverflow.com/a/24003917
score: 4
has body: When using &lt;p:ajaxExceptionHandler type="java.lang.Exception" &gt; or &lt;p:ajaxExceptionHandler type="java.lang.Throwable" &gt; the primefaces' exceptions handling mecanismm seems not working !! My question is how can i use primefaces ajaxExceptionHandler to handle all the inhereted exceptions, no matter what exactely it is (NullPointerException, OutOfBoundException..etc) ? i just have to mention that the &lt;p:ajaxExceptionHandler&gt; works fine when i use it with javax.ejb.EJBException, java.lang.NullPointerException or other custom Exceptions.
upvote count: 4
tagged with: jsf-2

http://stackoverflow.com/comment/36962623
score: 0
type: AnswerComment
has text: That makes sense. So why is the Date object returning -14830974000000ms which is the wrong Gregorian ms, or why is the asInstant function not accounting for the base calendar of the Date object? More importantly for me, how do I tell the date object to return the ms to the correct Gregorian date?
type: Comment
comment on: http://stackoverflow.com/a/23978037

http://stackoverflow.com/q/24103328
has body: slash screen tutorial By following the above tutorial i did the following things step1: created a new project named SplashScreenTest step2: include the gif file named laoding.gif in the project step3: added a new JFrameForm to project with the name StartGUI.java step4: rightclick the form->properties->code->form size policy->generate resize code generate position ->untick generate size ->untick generate center ->tick step5: replaces "Nimbus" with "Windows" inside step6: right click SplashScreenTest->properties->VMoptions -splash:src/AppPackage/loading.gif step7 : open Manifest.mf write "SplashScreen-Image: AppPackage/loading.gif" step8: set main class to AppPackage.StartGUI Now as soon as i hit the clean and build button it returns an error "existing manifest file is invalid" May I know what is the correct way to achieve my objective?Maybe this question too basic, but i did't find any suitable solution.Please Help me out.
tagged with: java
has answer: http://stackoverflow.com/a/24103860
type: Question
has title: splashscreeen not working in netbeans IDE for java?
tagged with: manifest
score: 0
answer count: 1
tagged with: splash-screen
type: UnansweredQuestion

http://stackoverflow.com/q/24067571
has title: Cannot iterate list inside JSP
answer count: 1
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/24067726
favorite count: 0
type: AnsweredQuestion
score: 2
upvote count: 2
has body: I am trying to answer a question using expression language in JSP. I tried some code, but it is not working properly. Can someone please help me ? Question - Source = How to call servlet on jsp page load I want to call a servlet 'latest_products' on load of index.jsp page.This servlet has records in List. I want to pass this List to index.jsp. but i don't want to display the name of servlet in url. is there any way by which i can do this. Expected output - Heading plus list of three product names. Actual output - Heading only. What I tried - Servlet: public class ProductList extends HttpServlet { private static final long serialVersionUID = 1L; public ProductList() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<String> products = new ArrayList<String>(); products.add("Car"); products.add("Gun"); products.add("Shades"); request.setAttribute("productsList", products); } } JSP: <%@ page language="java" contentType="blah..."%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <c:import url="/ProductList" /> <c:set var="myProducts" scope="request" value="${param.productsList}"/> List of products from servlet <c:forEach var="product" items= "${myProducts}" varStatus="i"> ${product} </c:forEach> One small question besides this, why do I get an error Encountered illegal body of tag "c:set" tag, given its attributes when I enclose the c:set tag with a </c:set> after the </c:foreach> tag ? I thought the c:set was like a block of code with a scope. But, it does not seem to be. Thanks.
type: Question
tagged with: jakarta-ee
tagged with: java
accepted answer: http://stackoverflow.com/a/24067726
tagged with: servlets

http://stackoverflow.com/a/56929031
has body: You must write a wrapper class for Runtime, because it's system class. public class AppShell { public Process exec(String command) { return Runtime.getRuntime().exec(command); } } Then in unit test, use @PrepareForTest(AppShell.class) instead of @PrepareForTest(Runtime.class) @RunWith(PowerMockRunner.class) @PrepareForTest(AppShell.class) public class AppShellTest { @Mock private Runtime mockRuntime; @Test public void test() { PowerMockito.mockStatic(Runtime.class); when(Runtime.getRuntime()).thenReturn(mockRuntime); when(mockRuntime.exec()).thenReturn("whatever you want"); // do the rest of your test } } See PowerMock - Mocking system classes
score: 0
answers question: http://stackoverflow.com/q/24039184
type: Answer

http://stackoverflow.com/a/73753039
has comment: http://stackoverflow.com/comment/130320921
type: Answer
score: 2
has body: This problem may have occurred because Tomcat was loaded into the Program Files directory. Intellij IDEA cannot read files from Tomcat/lib inside program files. It can be decide: to run the IDEA with administrator rights or download Tomcat to another directory.
upvote count: 2
answers question: http://stackoverflow.com/q/24015502
has comment: http://stackoverflow.com/comment/140144410
downvote count: 0

http://stackoverflow.com/comment/37117032
type: AnswerComment
comment on: http://stackoverflow.com/a/24069428
score: 0
has text: One also needs tables that support transactions as well.
type: Comment

http://stackoverflow.com/q/23994504
favorite count: 0
tagged with: javafx-2
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37047927
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37907222
has answer: http://stackoverflow.com/a/24032915
has comment: http://stackoverflow.com/comment/36981678
downvote count: 0
has title: JavaFX2: How to retrieve Task in Service's onFailed event?
has comment: http://stackoverflow.com/comment/37053076
answer count: 1
has body: I have a JavaFX Service and try to handle Task failure. For that I would like a reference to Task instance in handle method of OnFailed handler. In debug I can see that the WorkerStateEvent source holds a task reference, but I cannot find a way to get to it other than reflection which I would like to avoid. Am I missing something in here?

http://stackoverflow.com/comment/37174989
type: QuestionComment
has text: So, is this error occurs because of code using internal classes that are new to a jdk ? For example if I have class A in JDK 7 and I write code that runs fine on JDK 6 but uses that class A I'l get the UnsupportedClassVersionError although its just a class not found error ?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24100736

http://stackoverflow.com/comment/37160714
has text: I just wanted to be reaffirm whether I am correct . Never mind , that was really stupid from my end. Thanks a lot again for your explanation . ( Just a request : if you find my question valid , can you please upvote it )
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24067568

http://stackoverflow.com/q/24083880
has comment: http://stackoverflow.com/comment/37144514
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/37204863
score: 2
tagged with: java
tagged with: google-cloud-storage
tagged with: google-oauth
type: Question
has body: I am working on google cloud storage, i hv created bucket using java code, but when i insert object inside bucket i face the below problem. Uncaught exception from servlet com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 { "code" : 401, "errors" : [ { "domain" : "global", "location" : "Authorization", "locationType" : "header", "message" : "Invalid Credentials", "reason" : "authError" } ], "message" : "Invalid Credentials" } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at com.google.api.services.samples.storage.appengine.StorageSampleServlet.doGet(StorageSampleServlet.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at com.google.api.client.extensions.servlet.auth.oauth2.AbstractAuthorizationCodeServlet.service(AbstractAuthorizationCodeServlet.java:130) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.je…
tagged with: google-api-java-client
has title: Google cloud storage insert object returns Invalid Credentials 401
downvote count: 0

http://stackoverflow.com/comment/37056636
comment on: http://stackoverflow.com/q/24036958
score: 0
has text: @user3639852: No I mean with the classes. Your buttons definitely call different classes (if you haven't overrided them with some onClick in your xml, which I do not know). Thus, the location1 and location2 classes can have the same layout, which might confuse. Try to check if their layout is the same. If not, clean and rebuild :)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36912260
comment on: http://stackoverflow.com/a/23945792
type: AnswerComment
score: 27
type: Comment
has text: Sure, if all you need is seconds, not milliseconds.

http://stackoverflow.com/a/24090632
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37158557
has comment: http://stackoverflow.com/comment/37156132
downvote count: 0
answers question: http://stackoverflow.com/q/24090264
has comment: http://stackoverflow.com/comment/37155996
accepted answer of: http://stackoverflow.com/q/24090264
score: 2
has body: OK since no one yet explained your problem then I will try. Your current regex (^[a-zA-Z])(_\\d+_)([a-zA-Z]$) can match only strings with one letter at start, _, one or more digits, another _ and ends with one letter. What you need is regex which accept strings that [a-zA-Z]+(?:_[a-zA-Z]+)* - starts with one or more letters and can have optional sequences of _ and letters (not digits yet) _\\d+_ - have digits surrounded with _ after it [a-zA-Z]+ have one or more letters after it. You probably also want to end your regex with sequence which will match file extension, so you will need something like [.]jpg So try with ([a-z]+(?:_[a-z]+)*)_(\\d+)_([a-z]+)[.]jpg Demo: String[] data = { "ABC_1234_XL.jpg", "XYZ_7890_SM.jpg", "PQ_R_4567_LG.jpg", }; Pattern p = Pattern.compile( "([a-z]+(?:_[a-z]+)*)_(\\d+)_([a-z]+)[.]jpg", //group 1 ^^^^^^^^^^^^^^^^^^ //group 2 ^^^^ //group 3 ^^^^^^ Pattern.CASE_INSENSITIVE); for (String s : data) { Matcher m = p.matcher(s); if (m.matches()) System.out.println(m.group(1)+" : "+m.group(2)+" : "+m.group(3)); else System.out.println(s+" doesn't match pattern"); } Output: ABC : 1234 : XL XYZ : 7890 : SM PQ_R : 4567 : LG
type: AcceptedAnswer

http://stackoverflow.com/comment/128174491
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33248300
type: Comment
has text: @shareef I presume a usual log in SYSOUT or SYSERR. It doesn't matter. What one needs to take care of, is that you need to consume the SYSOUT and SYSERR streams or else the child process will wait until you do so (or unless killed by parent)

http://stackoverflow.com/comment/37063196
type: Comment
comment on: http://stackoverflow.com/a/24031582
has text: I know, but `loadBeans()` reads groovy file, it won't work with class files; when config files reside in src/groovy, it doesn't appear to work (just tested it)
score: 0
type: AnswerComment

worklight-adapters
tags question: http://stackoverflow.com/q/24032125
tags question: http://stackoverflow.com/q/23998472
type: Tag
tag name: worklight-adapters

http://stackoverflow.com/q/23954790
tagged with: criteria-api
has body: I am using criteria API in my project but the query which is created from hibernate is very slow. When I run the explain on the query I found that the required index is not being used. So I tried to use "use index()" clause provided by MYSQL and the query took only 5 sec. which was taking 70 sec. But the issue is I am using criteria API and wanted to know that is there any option to use "use index()" clause in criteria API
has answer: http://stackoverflow.com/a/23955471
type: Question
linked to: http://stackoverflow.com/q/46074676
has answer: http://stackoverflow.com/a/78344250
answer count: 2
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: How to use mysql's "use index()" clause in hibernate criteria?
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql

file
tags question: http://stackoverflow.com/q/23975640
type: Tag
tags question: http://stackoverflow.com/q/24060272
tags question: http://stackoverflow.com/q/24089677
tags question: http://stackoverflow.com/q/23971629
tags question: http://stackoverflow.com/q/24058330
tags question: http://stackoverflow.com/q/24042095
tag name: file
tags question: http://stackoverflow.com/q/24005223
tags question: http://stackoverflow.com/q/24052289
tags question: http://stackoverflow.com/q/24067134
tags question: http://stackoverflow.com/q/23955430
tags question: http://stackoverflow.com/q/24102907
tags question: http://stackoverflow.com/q/24075352
tags question: http://stackoverflow.com/q/23950060
tags question: http://stackoverflow.com/q/24022880
tags question: http://stackoverflow.com/q/23952445
tags question: http://stackoverflow.com/q/23973802
tags question: http://stackoverflow.com/q/23994118
tags question: http://stackoverflow.com/q/24071115
tags question: http://stackoverflow.com/q/24028869
tags question: http://stackoverflow.com/q/24011335
tags question: http://stackoverflow.com/q/24069232
tags question: http://stackoverflow.com/q/24027096
tags question: http://stackoverflow.com/q/24101110
tags question: http://stackoverflow.com/q/24033863
tags question: http://stackoverflow.com/q/23999900
tags question: http://stackoverflow.com/q/23967602
tags question: http://stackoverflow.com/q/24088540
tags question: http://stackoverflow.com/q/24094101
tags question: http://stackoverflow.com/q/24013819
tags question: http://stackoverflow.com/q/24034811
tags question: http://stackoverflow.com/q/24008831
tags question: http://stackoverflow.com/q/24001535
tags question: http://stackoverflow.com/q/24023405
tags question: http://stackoverflow.com/q/24076476
tags question: http://stackoverflow.com/q/23950954
tags question: http://stackoverflow.com/q/24032367
tags question: http://stackoverflow.com/q/23996666
tags question: http://stackoverflow.com/q/23960028

http://stackoverflow.com/a/24081456
type: Answer
has comment: http://stackoverflow.com/comment/37139231
has comment: http://stackoverflow.com/comment/37139737
has comment: http://stackoverflow.com/comment/37139412
has comment: http://stackoverflow.com/comment/37138968
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24079221
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24079221
has body: Even if it would be better to use a CLOB column to store text, it is perfectly possible to use a BLOB column as well. Since the BLOB column stores binary data (as opposed to CLOB, which stores text), you have to agree on an encoding. Assuming that you will use UTF-8 to encode your text, you can use a PreparedStatement and set the new value and selection criteria using the setter methods like this: PreparedStatement pstat = conn.prepareStatement("UPDATE tbl_blob SET file_content=? WHERE file_name=?"); pstat.setBlob(1, new ByteArrayInputStream(new String(content).getBytes("UTF-8"))); pstat.setString(2, myFileName); pstat.executeUpdate();
has comment: http://stackoverflow.com/comment/37139489
has comment: http://stackoverflow.com/comment/37139329

http://stackoverflow.com/q/24037822
tagged with: mule
accepted answer: http://stackoverflow.com/a/24047253
score: 0
answer count: 1
has title: Create and set Connector dynamically for endpoint
has body: I have an outbound-endpoint, but I would like to create and set a connector dynamically for the endpoint using Java, before the endpoint actually sends a file. I have found an example on creating a connector dynamically, as in: As2Connector connector = new As2Connector(muleContext); connector.setName("TestAS2Connector"); connector.setPartnerId("mend"); connector.setKeystorePath("src/test/resources/keystoreTest.jks"); connector.setKeystorePassword("PASSWORD"); return connector; However, I do not know how to tie the connector with my existing endpoint. Is there a way to do this? Thank you,
has answer: http://stackoverflow.com/a/24047253
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37057264
type: Question
tagged with: mule-el

http://stackoverflow.com/comment/37079905
comment on: http://stackoverflow.com/q/24049608
score: 1
type: Comment
type: QuestionComment
has text: Great. So an example of each is when you need either of those behaviors.

dbpedia
tags question: http://stackoverflow.com/q/23983165
type: Tag
tag name: dbpedia

http://stackoverflow.com/comment/37175858
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24101142
has text: After running the code, I also get a segmentation fault with "java version "1.7.0_55" OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-2) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)".

http://stackoverflow.com/comment/36884665
score: 0
type: Comment
type: QuestionComment
has text: Apologies. I updated my post with a use case. I'll give an example of what I want to achieve momentarily (eating dinner).
comment on: http://stackoverflow.com/q/23945037

http://stackoverflow.com/a/24069008
answers question: http://stackoverflow.com/q/24047501
score: 1
has body: Here's an example of a Spring MVC controller that handles login without Spring Security: @Controller @SuppressWarnings("SpringJavaAutowiringInspection") public class LoginController { private static final Logger log = LoggerFactory.getLogger(LoginController.class); @Autowired private UserService userService; /** * Both display the login form and handle the form submission. */ @RequestMapping("/in.app") public String login(String account, String password, ModelMap model, HttpSession session) throws Exception { if (account == null) { log.debug("Displaying login form"); return "login/login"; } log.debug("Processing login for user {}", account); User user = userService.login(account, password); if (user == null) { model.put("error", "The supplied account or password is incorrect"); model.put("account", account); return "login/login"; } //Create the user and session session.setAttribute("user", user); return "forward:/frame.app"; } /** * Logout and invalidate the session. */ @RequestMapping("/out.app") public String logout(HttpSession session) throws Exception { session.invalidate(); return "login/login"; } And a Filter to guard the URL's for no session: /** * Check that a session exists and redirect to the login page if it doesn't. */ @WebFilter(filterName = "SessionFilter", urlPatterns = { "*.app" }) public class SessionFilter implements Filter { private static final Logger log = LoggerFactory.getLogger(SessionFilter.class); private static final int AUTHENTICATION_TIMEOUT = 419; @Override public void init(FilterConfig filterConfig) throws ServletException { log.debug("Initializing session filter"); } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { String path = ((HttpServletRequest) request).getServletPath(); HttpSession session = ((HttpServletRequest) request).getSession(false); if ((session != null &amp;&amp; session.getAttribute("user") != null) || path.endsWith("in.app"…
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/23942386
score: 1
has body: I'm trying to run java code using eclipse. I'm running this code: http://algs4.cs.princeton.edu/65reductions/Simplex.java.html I got error in line 317/ 319/ 322 as "StdRandom Cannot be resolved"
upvote count: 1
tagged with: operations-research
type: Question
duplicate of: http://stackoverflow.com/q/12770063
has comment: http://stackoverflow.com/comment/36879121
has answer: http://stackoverflow.com/a/23942468
tagged with: java
has title: Error in Java code StdRandom.uniform
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/12770063
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24098422
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/31927955
accepted answer: http://stackoverflow.com/a/31927955
type: Question
tagged with: ajp
tagged with: jboss
upvote count: 1
tagged with: apache
answer count: 1
favorite count: 0
tagged with: sql-server
has title: JBoss cluster with Apache, AJP change's date eventualy
has body: I'm having some problems with my JBoss cluster, today we have the following scenario: 4 JBoss (MSSQL Server, sqljdbc 4, JDK 1.6.43_b01) nodes accessed by a single apache acting as load balancing. Here, we're having a weird problem, a date field (just one field, that is recovered in our MSSQL, we have other field, but is filled always with a new Date() object - correctly generated) in a PDF returned by a GET request. In some requests the date (recovered by MSSQL) is subtracted by one day! I've tryed to access directly the nodes, but this issue not happens again. I'm suspecting that something in AJP protocol is acting as a something that changes the date in the response. Someone is having any issue like this?

http://stackoverflow.com/q/24041394
has comment: http://stackoverflow.com/comment/37064653
type: Question
tagged with: java
has title: Optimize performance when adding many views to layout
has body: I am using this library (https://github.com/gabrielemariotti/cardslib) to create my views and adding them to linearlayou with addView() method. My problem is that I have many views to add (sometimes even more than 200) and using addView() method is slow. I have already read some info about lazyloading listviews. But my parent layout is not listview, because my children views are quite different. Is there any way how to optimize performace of adding views to my parent linearlayout? Or any other approach? (loading items from database is effective and is not part of issue) Thanks.
tagged with: android
has comment: http://stackoverflow.com/comment/37065618
answer count: 0
score: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23976392
has comment: http://stackoverflow.com/comment/36942567
has comment: http://stackoverflow.com/comment/36942407
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/36942409
has comment: http://stackoverflow.com/comment/36942512
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23976327
has comment: http://stackoverflow.com/comment/36942398
type: Answer
answers question: http://stackoverflow.com/q/23976327
has body: The issue is that Arrays#asList() returns an ArrayList implementation that inherits remove() from AbstractList. The implementation of remove() in AbstractList is this: public E remove(int index) { throw new UnsupportedOperationException(); } And because the iterator uses the list's iterator to perform its remove() method, you end up with the exception. You have a few solutions here. You can either pass the result of Arrays#asList() to an ArrayList constructor: List&lt;String&gt; words = new ArrayList&lt;&gt;(Arrays.asList(keys)); Now, you can iterate over the resulting List and remove the elements you want. Or, asMadProgrammer stated, you can take the opposite approach and iterate over the array and add the elements you want to keep: List&lt;String&gt; words = new ArrayList&lt;&gt;(); for (String s : keys) { String currentWord = s.trim(); if (!currentWord.equals("")) { words.add(currentWord); } }

http://stackoverflow.com/comment/100998977
comment on: http://stackoverflow.com/a/51856857
type: AnswerComment
has text: @All, If you do not specify `@SequenceGenerator`, sequence name defaults(at least Hibernate) to a value which is specified for `generator` i.e., `id_sequence`.
score: 0
type: Comment

http://stackoverflow.com/q/24093694
has comment: http://stackoverflow.com/comment/37162041
has answer: http://stackoverflow.com/a/67205095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37725450
has answer: http://stackoverflow.com/a/64112453
has answer: http://stackoverflow.com/a/33573138
score: 3
has answer: http://stackoverflow.com/a/38808660
has answer: http://stackoverflow.com/a/58361262
downvote count: 1
has answer: http://stackoverflow.com/a/60241204
has answer: http://stackoverflow.com/a/47817500
type: Question
has body: The problem I am talking about is this Problem statment: Return a version of the given string, where for every star () in the string the star and the chars immediately to its left and right are gone. So "abcd" yields "ad" and "ab**cd" also yields "ad". starOut("ab*cd") → "ad" starOut("ab**cd") → "ad" starOut("sm*eilly") → "silly" The solution I got was a little messy I have used about 6 if statements and a handling for one particular case, looking for cleaner solutions with lesser ifs. Please do not use more than 1 loop and collections or regex. Below is my solution: public String starOut(String str) { String result=""; boolean currentFlag=false; if(str.length()==0) return result; for(int i=0;i+1<str.length();i++) { if(str.charAt(i)=='*') { i+=1; currentFlag=true; continue; } if(str.charAt(i+1)=='*') { i+=2; continue; } if((i>0)&&str.charAt(i-1)=='*') { continue; } result+=str.substring(i,i+1); currentFlag=false; } if(!(currentFlag)&&(str.length()==3)&&(str.charAt(1)=='*')) return ""; if((str.charAt(str.length()-1)!='*')&!(currentFlag)) return result+=str.charAt(str.length()-1); else return result; }
has comment: http://stackoverflow.com/comment/37161662
has answer: http://stackoverflow.com/a/26837065
tagged with: algorithm
tagged with: java
upvote count: 4
answer count: 14
has comment: http://stackoverflow.com/comment/37161650
has answer: http://stackoverflow.com/a/25640428
has answer: http://stackoverflow.com/a/26683528
has comment: http://stackoverflow.com/comment/37162463
has answer: http://stackoverflow.com/a/28975799
has answer: http://stackoverflow.com/a/24093945
has answer: http://stackoverflow.com/a/24094421
accepted answer: http://stackoverflow.com/a/24094421
favorite count: 0
has title: Efficient solution to codingBat riddle starOut in Java
possible better answer: http://stackoverflow.com/a/26837065
has answer: http://stackoverflow.com/a/36512443
has comment: http://stackoverflow.com/comment/37161924

http://stackoverflow.com/a/24104332
has comment: http://stackoverflow.com/comment/68447924
answers question: http://stackoverflow.com/q/24104313
score: 235
has comment: http://stackoverflow.com/comment/90685705
has body: Use Thread.sleep(1000); 1000 is the number of milliseconds that the program will pause. try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
type: Answer
upvote count: 239
has comment: http://stackoverflow.com/comment/132885948
has comment: http://stackoverflow.com/comment/131988717
has comment: http://stackoverflow.com/comment/94056224
downvote count: 4

http://stackoverflow.com/comment/36880911
type: QuestionComment
type: Comment
has text: As well as just researching, searching youtube, etc, I just haven't been able to find much about cleanly adding it into a Java application, maybe my search-fu is just week though
comment on: http://stackoverflow.com/q/23943152
score: 0

http://stackoverflow.com/comment/37175059
score: 0
type: Comment
type: QuestionComment
has text: Try with `dia.setLocationRelativeTo(null);` to show the `Window` in the center of the screen.
comment on: http://stackoverflow.com/q/24100758

http://stackoverflow.com/a/24039342
score: 1
has comment: http://stackoverflow.com/comment/37060625
has body: The only factor affecting the insertion beyond O(n) is the capacity growth. How fast does that grow? If your insert element by element the capacity is not adjusted on every insertion, but actually quite infrequently. You sacrifice space for efficiency. So if by inserting another element you hit the limit of capacity it will increase roughly by 1.5 times (in the Sun implementation). How many such adjustments would you need to do for 100K elements if you start with 10? About 25... Of these 25 only the last two resizes are comparable in size to N, so with a constant factor it is O(N). You did not, however, specify how you would insert those items. You could preset the capacity to hold your 100K elements or use addAll, which I hope would do the same. Still O(N)
downvote count: 0
answers question: http://stackoverflow.com/q/24038968
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37060535
has comment: http://stackoverflow.com/comment/37060253
has comment: http://stackoverflow.com/comment/37061088

http://stackoverflow.com/a/24044524
has body: button F3 . here is a good article about Eclipse Shortcuts
answers question: http://stackoverflow.com/q/24044426
accepted answer of: http://stackoverflow.com/q/24044426
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/36985635
score: 0
type: Comment
has text: @AdamYost Thanks a lot! I used your method.
comment on: http://stackoverflow.com/a/23999022
type: AnswerComment

http://stackoverflow.com/comment/37168474
type: AnswerComment
has text: Thanks I fixed it by replacing Main m = new Main(); m.text = opisTextField.getText(); with text = opisTextField.getText(); weird because It didn't worked before like that.
score: 0
comment on: http://stackoverflow.com/a/24097260
type: Comment

http://stackoverflow.com/a/24005954
has body: Quoted from Wikipedia: http://en.wikipedia.org/wiki/Bitwise_operation#OR A bitwise OR takes two bit patterns of equal length and performs the logical inclusive OR operation on each pair of corresponding bits. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1; otherwise, the result is 0. For example: 0101 (decimal 5) OR 0011 (decimal 3) = 0111 (decimal 7) So if getExtendedState() is returning a number made up of binary flags (ie. a bit field)... ORing it (using the pipe operator | ), is simply keeping ALL the existing flags in the object's state and also setting the bit/s that correspond to the state JFrame.MAXIMIZED_BOTH. This is because ORing sets a bit to 1 if it is 1 in either the first operand OR the second operand. Hope that helps explain it.
answers question: http://stackoverflow.com/q/24005853
score: 0
type: Answer

http://stackoverflow.com/a/23996713
has body: The first match finds "" to be okay because its looking ahead for any alpha character, which is called zero-width lookahead, so it doesn't need to actually match anything. So "s" at the beginning is alphanumeric, and it matches that at a probable spot. If you want the regex to match something always, use ".+(?=[a-z])"
score: 0
answers question: http://stackoverflow.com/q/23996609
type: Answer

http://stackoverflow.com/comment/37000476
has text: How can I make Rest service to display the date as Soap service is doing? Is there any configuration to change?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23997805
type: Comment

http://stackoverflow.com/comment/37169633
type: QuestionComment
comment on: http://stackoverflow.com/q/24098102
has text: I would guess that input is an instance of scanner. Maybe post your sample input.
score: 0
type: Comment

http://stackoverflow.com/a/26308645
accepted answer of: http://stackoverflow.com/q/24025352
answers question: http://stackoverflow.com/q/24025352
type: Answer
upvote count: 1
has body: Looks like this is a bug with Spring Boot 1.1.4. Check out https://github.com/spring-projects/spring-boot/issues/1343. Fixed in version 1.1.5.
has comment: http://stackoverflow.com/comment/43419782
type: AcceptedAnswer
downvote count: 0
score: 1

performance
tags question: http://stackoverflow.com/q/23975716
tags question: http://stackoverflow.com/q/24009708
tags question: http://stackoverflow.com/q/24038417
tags question: http://stackoverflow.com/q/24027247
tags question: http://stackoverflow.com/q/24070327
tags question: http://stackoverflow.com/q/24052000
tags question: http://stackoverflow.com/q/23945331
tags question: http://stackoverflow.com/q/23976603
tags question: http://stackoverflow.com/q/23965737
tags question: http://stackoverflow.com/q/24001747
tags question: http://stackoverflow.com/q/24082837
tags question: http://stackoverflow.com/q/24022694
tags question: http://stackoverflow.com/q/24017963
tags question: http://stackoverflow.com/q/24073765
tags question: http://stackoverflow.com/q/23991299
tags question: http://stackoverflow.com/q/24066935
tags question: http://stackoverflow.com/q/24085207
tags question: http://stackoverflow.com/q/23986135
tags question: http://stackoverflow.com/q/23947460
tags question: http://stackoverflow.com/q/24077635
tag name: performance
tags question: http://stackoverflow.com/q/24064723
tags question: http://stackoverflow.com/q/24004860
tags question: http://stackoverflow.com/q/24015375
tags question: http://stackoverflow.com/q/23984002
tags question: http://stackoverflow.com/q/24003674
type: Tag

http://stackoverflow.com/q/24022880
has comment: http://stackoverflow.com/comment/37029718
has title: Java filename searching
tagged with: filenames
tagged with: java
linked to: http://stackoverflow.com/q/4716503
downvote count: 2
tagged with: file
tagged with: flat-file
type: Question
score: -2
tagged with: database
has comment: http://stackoverflow.com/comment/37029599
has answer: http://stackoverflow.com/a/24023042
has comment: http://stackoverflow.com/comment/37029584
has body: I need to make a database for book storing. So what I want to do Is basically make a file for each book which I have done. Now I need to search books when I need them. In 2 functions I'll need to find the book and edit its information. I have no idea how to get the name of a file and assign it to a scanner\bufferwriter\ect. Can anyone help me?
has comment: http://stackoverflow.com/comment/37029865
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37161782
type: Comment
score: 0
type: AnswerComment
has text: @user1613360 And your initialization isn't part of the constructor.
comment on: http://stackoverflow.com/a/24093673

http://stackoverflow.com/a/24056720
has body: your actual problem is on below line replace setContentView(R.layout.activity_main); with setContentView(R.layout.drawer_layout); you bind wrong xml and you do not load fragment and drawer on same acivity also comment all map code in on create and put it on your new fragment class... and load map on fragment class not in activity class.
has comment: http://stackoverflow.com/comment/37099528
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37138004
has comment: http://stackoverflow.com/comment/37128830
answers question: http://stackoverflow.com/q/24056424
has comment: http://stackoverflow.com/comment/37138041
has comment: http://stackoverflow.com/comment/37136666

http://stackoverflow.com/comment/37193936
score: 0
type: Comment
type: QuestionComment
has text: not with `delphi` tag, where interested users may never find the way to that question if they do not know about vb.net language...
comment on: http://stackoverflow.com/q/24092731

http://stackoverflow.com/a/24047636
has body: If you're using Maven, try add the dependency as shown by SpringSource: javax.annotation com.springsource.javax.annotation 1.0.0 Based on the FAQ, you will need to configure the <repository> on your Maven POM and then add the dependency as shown above. Alternatively, you can download the JAR file directly from SpringSource. I hope this helps.
has comment: http://stackoverflow.com/comment/37077077
has comment: http://stackoverflow.com/comment/37076863
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24047499

http://stackoverflow.com/q/24071180
linked to: http://stackoverflow.com/q/22058738
type: Question
tagged with: graphics
score: 0
tagged with: printing
answer count: 1
has title: How to Print the entire JPanel in Java
linked to: http://stackoverflow.com/q/12764634
has body: I am trying to print a JPanel that is within an application, the JPanel inside the application is displayed below (Notice the horizontal and vertical scroll bars): When the application has run it's course, the height of the panel becomes very long, but when I print it, it does not print the entire width and height. Also the positioning of the panel in the paper is align to the left rather than center. The Image below shows how the panel appears on paper, this looks very bad so please I need help. 1) How can I print the entire panel? 2) How can I position it to be centralized on the paper? Here is my code: public void printWork() { PrinterJob pj = PrinterJob.getPrinterJob(); pj.setJobName(" Opt De Solver Printing "); pj.setPrintable(new Printable() { @Override public int print(Graphics pg, PageFormat pf, int pageNum) { if(pageNum &gt; 0) return Printable.NO_SUCH_PAGE; Graphics2D g2 = (Graphics2D)pg; g2.translate(pf.getImageableX(), pf.getImageableY()); MainAppPanel.this.paintAll(g2); /* I've tried the following commented codes but they don't work */ //MainAppPanel.this.printAll(g2); //MainAppPanel.this.print(g2); //MainAppPanel.this.print(g2); return Printable.PAGE_EXISTS; } }); if(pj.printDialog() == false) return; try { pj.print(); } catch(PrinterException xcp) { xcp.printStackTrace(System.err); } }
linked to: http://stackoverflow.com/q/22241711
has comment: http://stackoverflow.com/comment/37119686
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37119897
has comment: http://stackoverflow.com/comment/37119703
has comment: http://stackoverflow.com/comment/37119693
tagged with: java
has answer: http://stackoverflow.com/a/42963904
tagged with: swing
linked to: http://stackoverflow.com/q/17904518

http://stackoverflow.com/comment/36975206
comment on: http://stackoverflow.com/q/23993691
score: 0
type: QuestionComment
type: Comment
has text: I tried a lot but i am not getting what to change.... am getting the error at AlertDialog.Builder adb = new AlertDialog.Builder(mContext);

http://stackoverflow.com/q/24083788
downvote count: 1
has answer: http://stackoverflow.com/a/24084019
has comment: http://stackoverflow.com/comment/66973997
score: 8
upvote count: 9
has comment: http://stackoverflow.com/comment/37142500
accepted answer: http://stackoverflow.com/a/24084019
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37142560
has answer: http://stackoverflow.com/a/39506823
favorite count: 0
has comment: http://stackoverflow.com/comment/37142447
has body: There Activity inherits ActoinBarActivity, it describes the sidebar (NavigationDrawer), by clicking on its elements open fragments. In one of the fragments have listView, by clicking on the item which I want to open another fragment ( staff- a list of employees - employee data). But I is an error Incompatible types: Required: Android.app.Fragment Found:com.abc.app.EmployeeDetails public class MyEmployeeFragment extends Fragment { //some code @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { userList = new ArrayList&lt;User&gt;(); sAdapter = new CustomAdapter(getActivity(),userList); View rootView = inflater.inflate(R.layout.my_employe, container, false); ListView lv = (ListView)rootView.findViewById(R.id.list); lv.setAdapter(sAdapter); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Fragment f = new EmployeeDetails(); // ERROR FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.content_frame, f); ft.commit(); Log.i("TAG", "itemClick: position = " + position + ", id = " + id); } }); EmployeeDetails public class EmployeeDetails extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_employee_details, container, false); } } Answer is: All fragments must import android.app.Fragment; not android.support.v4.app.Fragment;
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/39506823
tagged with: android
has comment: http://stackoverflow.com/comment/37142701
tagged with: android-fragments
tagged with: java
has title: Fragments Incompatible types

http://stackoverflow.com/comment/37118641
has text: @GermannArlington the only time I use a debugger is for integration tests, generated over junit and Spring test, and for some small console applications I do in my spare time. I haven't worked in a solution for this problem since I have more work to accomplish =\
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24070395
score: 0

http://stackoverflow.com/comment/36911577
comment on: http://stackoverflow.com/q/23958028
score: 0
type: Comment
type: QuestionComment
has text: Are you using Eclipse?

http://stackoverflow.com/q/24087342
tagged with: eclipse
tagged with: import
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24088592
favorite count: 0
has comment: http://stackoverflow.com/comment/37150258
has answer: http://stackoverflow.com/a/24087771
downvote count: 0
has title: Manually installed maven dependencies not visible in Eclipse import
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/37151170
tagged with: dependency-injection
has body: I have installed maven dependency using the command below mvn install:install-file -Dfile=d2_lib.war -DgroupId=com.emc.d2fs -DartifactId=d2_lib -Dversion=1.0 -Dpackaging=war -DlocalRepositoryPath="C:\Users\kumarr23\.m2\repository" I have added this dependency in my root pom.xml as below com.emc.d2fs d2_lib 1.0 war runtime I can see when I do maven install the jars inside my final war, when i try importing these classes from eclipse these classes are not included, Is there some thing I am missing? I am new to maven and i am stuck here ! please advise
score: 1
tagged with: java

http://stackoverflow.com/comment/37200729
type: AnswerComment
has text: If you're extending [`perform`](http://javadoc.jenkins-ci.org/hudson/tasks/BuildStep.html) in your plugin, you can reach to `getLogger` through [BuildListener](http://javadoc.jenkins-ci.org/hudson/model/BuildListener.html)
type: Comment
comment on: http://stackoverflow.com/a/24076350
score: 0

http://stackoverflow.com/q/23966161
type: UnansweredQuestion
tagged with: mysql
type: Question
tagged with: java
tagged with: hibernate
has title: Communications link failure :MySql+JDBC+Spring Transaction+JSF
score: 0
has comment: http://stackoverflow.com/comment/36926175
has body: In my webapplication everything work fine even i am able to connect with database with fetch,insert or delete th record from Database but after few minute if i am browsing my website i am getting this exception May 31, 2014 12:32:59 AM org.apache.catalina.realm.JDBCRealm getPassword SEVERE: Exception performing authentication com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 443,431 milliseconds ago. The last packet sent successfully to the server was 24 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3715) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3604) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4155) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2212) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:555) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:408) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:355) at org.apache.catalina.authenticator.AuthenticatorBase.doLogin(AuthenticatorBase.java:849) at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:831) at org.apache.catalina.connec…
linked to: http://stackoverflow.com/q/2983248
tagged with: spring
answer count: 0
tagged with: jsf
has comment: http://stackoverflow.com/comment/36926128

http://stackoverflow.com/q/23999157
has comment: http://stackoverflow.com/comment/36985484
tagged with: arrays
tagged with: class
has body: I have a file thats lade out like so: Jim Smith, male, 12, 09/98/1992 Ben Todd, male, 12, 09/98/1992 I want to be able to read these lines into my person object, and place these objects into an array. Here is my code. Is it currently throwing a NullPointerException. Any ideas? public class Main { public static ArrayList&lt;String&gt; catagories = new ArrayList&lt;String&gt;(); public static void main(final String[] args) throws IOException { File file = new File("manipulate-data.txt"); System.out.println(file.getName() + " file exists = " + file.exists()); BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); int iteration = 0; String line; while ((line = bufferedReader.readLine()) != null) { if (iteration == 0) { String[] columns = line.split(","); for (String column : columns) { catagories.add(column); } iteration++; continue; } sortFile(line); } bufferedReader.close(); } private static void sortFile(String line) { String[] columns = line.split(","); Person[] newPerson = new Person[4]; int i = 0; for (String column : columns) { newPerson[i].setName(column); newPerson[i].setSex(column); newPerson[i].setAge(column); newPerson[i].setBirth(column); i++; } } }
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -1
tagged with: java
has title: Trying to read a file lines into an object array
has answer: http://stackoverflow.com/a/23999213
downvote count: 1
type: Question
tagged with: object

http://stackoverflow.com/q/24099383
has comment: http://stackoverflow.com/comment/37172452
type: UnansweredQuestion
tagged with: jdbc
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
has title: Which update query caused org.hibernate.StaleObjectStateException
has comment: http://stackoverflow.com/comment/37237443
score: 0
has body: I am getting org.hibernate.StaleObjectStateException and would like to know update of which entity caused the exception. All I get is exception with the entity name and Id, like this: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.sample.model.User#f5a3483a-625e-446c-a8a9-91e18c222220] Since there are multiple scenarios possible with this particular section, I would like to know which scenario this occurs, for which I need to know the query which caused it. How do I get it? I simply can't use show query because this only occurs in production.

http://stackoverflow.com/comment/37125127
comment on: http://stackoverflow.com/q/24074312
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis What do you mean they are not valid byte values? 0x44a48ac6 = 1151634118.

http://stackoverflow.com/q/24023098
tagged with: android-lifecycle
tagged with: android
tagged with: android-cursor
has comment: http://stackoverflow.com/comment/37030002
has title: Android: Run a thread in the background without delaying activity
has comment: http://stackoverflow.com/comment/37030227
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37030176
score: 1
has answer: http://stackoverflow.com/a/24023400
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37030100
has answer: http://stackoverflow.com/a/24023333
accepted answer: http://stackoverflow.com/a/24023333
has body: I have a process that pulls Contact info, and it takes a long time - 4 seconds. I do not want it to interfere with the user experience in my app. I have 2 questions: How can I run this in its own thread so it does not delay the activity from drawing on the screen Is there a way to speed this up? (Am I doing it inefficiently?) I've tried calling the getContacts() method below from onCreate, from onStart, and onResume, but in all cases the screen does not appear until after method has run completely. Here's the code: private void getContacts() { Thread thread = new Thread() { @Override public void run() { try { Log.d("ManageFriends","getContacts Start"); ContentResolver cr = getContentResolver(); String[] PROJECTION = new String[] { ContactsContract.CommonDataKinds.Email.CONTACT_ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.CommonDataKinds.Email.ADDRESS, ContactsContract.CommonDataKinds.Email.IS_PRIMARY, }; String filter = ContactsContract.CommonDataKinds.Email.ADDRESS + " NOT LIKE '' AND 1 == " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " AND " + ContactsContract.Contacts.DISPLAY_NAME + " NOT LIKE '%@%'"; Cursor cur = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, PROJECTION, filter, null, null); DBHelper.insertArrayList(db,"Contacts",DBHelper.cursorToArrayList(cur)); Log.d("ManageFriends","getContacts End"); } catch (Exception e) { e.printStackTrace(); } } }; thread.run(); } Note: I'm aware of the big reason this process is slow - I'm converting the cursor result to an ArrayList &lt; ArrayList &lt; String>> and then inserting it into a SQLite db. But if I could get it to work in the background I'd be happy.
answer count: 2
has comment: http://stackoverflow.com/comment/37030078
upvote count: 1
possible better answer: http://stackoverflow.com/a/24023400
has comment: http://stackoverflow.com/comment/37030047
favorite count: 0
has comment: http://stackoverflow.com/comment/37030510
tagged with: multithreading

http://stackoverflow.com/q/23975031
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23976117
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23975073
downvote count: 0
has title: Monitoring long running threads
favorite count: 0
possible better answer: http://stackoverflow.com/a/23975073
accepted answer: http://stackoverflow.com/a/23976117
has body: I've taken over a Java command line program that opens a zip file of documents and processes those documents using up to 8 threads (one thread per document) to process the documents and loads their data into the database (the instances of the Inserter class). The previous developer didn't code any way to manage those threads and I've been trying to find some performant way to monitor and cleanly shutdown the threads and the threadpool and the timer. I can monitor the threads in a continuous loop, but that uses up a lot of CPU and just seems wrong. But when I try to run a TimerTask to check the threads it seems to never exit even when all the work is done. As far as I can tell, this should work. What am I doing wrong? /* NOTES: timer is a java.util.Timer pool is a Executors.newFixedThreadPool(8); _listUncompressDirectories is a ConcurrentLinkedQueue&lt;List&lt;File&gt;&gt; inserters is a ConcurrentMap&lt;Integer, Inserter&gt; tasks is a ConcurrentMap&lt;Integer, Future&gt; */ // Code isolated from its method. for (int i = 0; i &lt;= 7; i++) { if (_listUncompressDirectories.isEmpty()) { break; } pool.submit(new Inserter()); inserters.put(i, new Inserter()); tasks.put(i, pool.submit(inserters.get(i))); } timer.schedule(new MonitorTask(), 90 * 1000); //delay in milliseconds /** * Thread pool monitor task. */ private class MonitorTask extends TimerTask { @Override public void run() { if (tasks.isEmpty()) { applicationShutdown(); } else { for (final int i : tasks.keySet()) { if (tasks.get(i).isDone()) { tasks.get(i).cancel(true); inserters.remove(i); tasks.remove(i); } } if (tasks.isEmpty()) { applicationShutdown(); } } } } private static void applicationShutdown () { pool.shutdownNow(); timer.cancel(); timer.purge(); System.exit(-1); }
tagged with: command-line
has comment: http://stackoverflow.com/comment/36940237
tagged with: multithreading

http://stackoverflow.com/comment/36899318
comment on: http://stackoverflow.com/q/23953396
has text: 1. disadvantage of NullLayout is that childs aren't resizable with container/parent, 2. disadvantage of NullLayout is that dynamic JComponents doesn't works propetly when they are the slave of setBounds
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/32452149
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24047613
has body: Maybe forceMergeDeletes solves the problem. You must use it after calling deleteDocuments.
upvote count: 1
type: Answer

http://stackoverflow.com/a/24022244
has comment: http://stackoverflow.com/comment/87074654
score: 1
has comment: http://stackoverflow.com/comment/138236765
has body: I found that on delete, the method getFrom() contains the starting index of deletion, and the method getRemovedSize() gives the number of deleted elements from that index. This information is enough to modify synched list.
has comment: http://stackoverflow.com/comment/138236773
downvote count: 0
answers question: http://stackoverflow.com/q/24013690
type: Answer
upvote count: 1

http://stackoverflow.com/q/24032779
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24033229
type: Question
has body: I'm working on a Client-Server program, and i need to start the client from the server, is there any idea to make this? Thank you for you answers. Regards.
tagged with: client-server
answer count: 1
tagged with: sockets
has comment: http://stackoverflow.com/comment/37047964
has title: Server triggers the client

http://stackoverflow.com/q/24046862
score: 0
tagged with: sqlite
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22624711
has body: So, I guess this should be really easy, but I started with Java just a week ago and have to finish a little team project this semester. I already have a program that creates databases, tables and adds data into it. That wasn't to hard since there are lots of tutorials on this topic. Now I have to write a program that is able to connect with my databases, get their data and merge it into a new larger database containing all the data from the other DBs. And I just can't find any help on that since 3 days... Someone told me the easiest way to to it, would be to get one Database into Java and copy the data to the second database and he wrote down a bit of code for me: package Databse; import java.sql.*; import java.util.HashMap; import java.util.Vector; import java.util.Map; /** * * @autho */ public class Join { public static void main( String args[] ) { Connection c; Statement stmt; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); stmt = c.createStatement(); Vector&lt;HashMap&lt;String, String&gt;&gt; alleDaten = new Vector&lt;HashMap&lt;String, String&gt;&gt;(); try (ResultSet rs = stmt.executeQuery( "SELECT * FROM FILE;" )) { while ( rs.next() ) { int id = rs.getInt("id"); String name = rs.getString("name"); String extension = rs.getString("extension"); String path = rs.getString("path"); String timeStamp = rs.getString("timeStamp"); HashMap&lt;String, String&gt; datensatz = new HashMap&lt;String, String&gt;(); datensatz.put("name", name); datensatz.put("extension", extension); datensatz.put("path", path ); datensatz.put("timestamp", timeStamp); alleDaten.add(datensatz); } } stmt.close(); c.close(); } catch ( ClassNotFoundException | SQLException e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); } System.out.println("Operation done successfully"); } He told me that I have to iterate through the vector now…
tagged with: jdbc
has answer: http://stackoverflow.com/a/24047751
tagged with: java
type: Question
tagged with: database
has title: Connecting with multiple Databases, getting Data and writing data to a new database

http://stackoverflow.com/a/23989778
answers question: http://stackoverflow.com/q/23989628
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Your method returns false due to the way you have constructed your loop. Below, I outline your method's runtime. i = 0; secondCount = 0; {1, 2, 1, 2, 3} {1, 2, 3} ^ ^ 1 == 1 ? true i = 1; secondCount = 1; {1, 2, 1, 2, 3} {1, 2, 3} ^ ^ 2 == 2 ? true i = 2; secondCount = 2; {1, 2, 1, 2, 3} {1, 2, 3} ^ ^ 1 == 3 ? false i = 3; secondCount = 0; {1, 2, 1, 2, 3} {1, 2, 3} ^ ^ 2 == 1 ? false i = 3; secondCount = 0; {1, 2, 1, 2, 3} {1, 2, 3} ^ ^ 3 == 1 ? false return false; The problem is that if the boolean equation first[i] == second[secondCount] is false, then secondCount is reset while i is still advanced. Thus, contains({1, 2, 1, 2, 3}, {1, 2, 3}); will always return false. Consider adding a continue to your code whenever first[i] == second[secondCount] fails to prevent i advancing.
accepted answer of: http://stackoverflow.com/q/23989628
type: Answer

http://stackoverflow.com/comment/36912672
score: 0
type: Comment
type: QuestionComment
has text: you may want to check that you got results before you obtain the 'id' - something like `while ( idResultSet.next() ) { // Read the next item idResultSet.getString("id"); }`
comment on: http://stackoverflow.com/q/23960212

http://stackoverflow.com/comment/36955982
type: Comment
has text: Well I can't reinstall the JRE because it is a work computer, I can try to reinstall it on my laptop and get it working. I will get back to you on that. The program works fine in the IDE but I will try it as a Jar and get back to you on that as well.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23983496

http://stackoverflow.com/comment/36950287
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23980554
score: 0
has text: whene i make it transparent they take no space in the panel?

http://stackoverflow.com/q/23948326
has answer: http://stackoverflow.com/a/23949095
score: 0
tagged with: java
upvote count: 1
downvote count: 1
tagged with: boxlayout
type: Question
tagged with: jpanel
has body: I am new to java swing, recently I try to create a swing app to format text. When I click the maximum button, the text panel's length does not resize, and the middle panel takes large space. And seems setResizable(false) does not work Code public class MainFrame extends JFrame { private static final long serialVersionUID = 7553142908344084288L; private JTextArea fromTextArea; private JTextArea toTextArea; public MainFrame() { super("jFormatter"); Panel mainPanel = new Panel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS)); setContentPane(mainPanel); fromTextArea = createTextArea(); lines.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, Color.LIGHT_GRAY)); lines.setEditable(false); Font f = new Font(Font.SANS_SERIF, Font.PLAIN, 16); lines.setFont(f); JScrollPane fromTextAreaScrollPanel = new JScrollPane(fromTextArea); fromTextAreaScrollPanel.setBorder(BorderFactory.createEmptyBorder(15, 5, 15, 5)); fromTextAreaScrollPanel.getViewport().add(fromTextArea); fromTextAreaScrollPanel.setRowHeaderView(lines); mainPanel.add(fromTextAreaScrollPanel); // control panel mainPanel.add(createCtrlPanel()); toTextArea = createTextArea(); mainPanel.add(createTextAreaPanel(toTextArea)); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setResizable(false); setVisible(true); setLocationRelativeTo(null); } private JPanel createCtrlPanel() { final JComboBox jComboBox = new JComboBox(formatters.keySet().toArray()); jComboBox.setBorder(BorderFactory.createTitledBorder("Text Format")); JButton fmtButton = new JButton("Format >>"); JPanel ctrPanel = new JPanel(new GridBagLayout()); ctrPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; ctrPanel.add(jComboBox, gbc); ctrPanel.add(Box.createRigidArea(new Dimension(50, 15)), gbc); //gbc.fill = GridBagConstraints.NONE; ctrPanel.add(fmtButton, gbc); return ctrPanel; } private JSc…
accepted answer: http://stackoverflow.com/a/23949095
answer count: 2
has comment: http://stackoverflow.com/comment/36890734
tagged with: preferredsize
has comment: http://stackoverflow.com/comment/36890898
favorite count: 0
has comment: http://stackoverflow.com/comment/37132808
tagged with: swing
possible better answer: http://stackoverflow.com/a/23948829
has title: How to resize JPanel when JFrame is maximized?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23948829

http://stackoverflow.com/q/24100075
has body: I work with Mongo and Java. Actually I use Criteria to make select . for example Criteria.where("customerType").is(customerType) (1) for me customerType is key in MongoDB. If I change it in future, my (1) query will be useless and more bad if I used it many times my code will be broken. I have googled ,but there is no result. My question is , are there any project or workaround for such problem?
type: UnansweredQuestion
has title: Mongo Queries in Java
has answer: http://stackoverflow.com/a/24100143
tagged with: java
type: Question
tagged with: mongodb
tagged with: criteria
tagged with: jquery
score: 0
answer count: 1

http://stackoverflow.com/comment/37126665
type: Comment
type: QuestionComment
has text: can you please post the stack trace ?
comment on: http://stackoverflow.com/q/24074750
score: 0

http://stackoverflow.com/comment/37052015
has text: @JonSkeet; when I tried using Install New Software, I could not browse for JUnit in the sub category "Testing". There I can find only "Jubula Function Testing", "Jubula Launch Support for Eclipse RCP" and "Jubula Launch Support for Java / Swings". Is it any ware related to JUnit. And I have browsed through all category as well, but no use.
comment on: http://stackoverflow.com/q/24030470
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24044810
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37071577
type: Question
tagged with: jodatime
has comment: http://stackoverflow.com/comment/37072339
has title: Joda-Time DateTime.toDate() reverts back timezone
has comment: http://stackoverflow.com/comment/37070906
upvote count: 2
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37071466
favorite count: 0
has body: I am trying to convert from one timezone to another using Joda-Time. final DateTimeZone fromTimeZone = DateTimeZone.forID("America/Los_Angeles"); final DateTimeZone toTimeZone = DateTimeZone.forID(toTimeZoneString); DateTime convertedStart = new DateTime(start, fromTimeZone).withZone(toTimeZone); Date finalS = convertedStart.toDate(); I see that finalS loses the timezone and is reverted back to the original timezone when I do .toDate(). convertedStart is correctly converted. start is in format -> Wed Jun 04 18:15:38 GMT 2014. Example: start: Wed Jun 04 18:15:38 GMT 2014 toTimeZoneString is Asia/Kolkata convertedStart : 2014-06-05T06:45:38.409+05:30 finalS: Wed Jun 04 18:15:38 GMT 2014 Why is this happening?
has answer: http://stackoverflow.com/a/24047108
accepted answer: http://stackoverflow.com/a/24047108
has comment: http://stackoverflow.com/comment/37071272
has comment: http://stackoverflow.com/comment/37071063
has comment: http://stackoverflow.com/comment/37071354

http://stackoverflow.com/comment/37173906
has text: Encapsulate code - fields and methods that are needed only in constructor. I just can't have method-visible methods that exist in `GNU-C` and functional languages, so I figured out that I could gain it using inner class.
score: 0
comment on: http://stackoverflow.com/q/24100204
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24005567
downvote count: 0
has comment: http://stackoverflow.com/comment/37265505
type: Answer
has comment: http://stackoverflow.com/comment/37280386
has comment: http://stackoverflow.com/comment/37266696
has comment: http://stackoverflow.com/comment/37251415
has body: Your answer to intercept all rpc request is at http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/rpc/RpcRequestBuilder.html You will have to register a builder that extends that one in your gwt.xml file to track what's happening look also at http://www.gwtproject.org/javadoc/latest/com/google/gwt/http/client/RequestBuilder.html I didn't look further, but the answer to your question is 100% there, I did the same with the request factory mechanism, and I think I did it with rpc a few years ago
score: 1
has comment: http://stackoverflow.com/comment/37266673
answers question: http://stackoverflow.com/q/23994323
has comment: http://stackoverflow.com/comment/37266622
accepted answer of: http://stackoverflow.com/q/23994323
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/23962605
has comment: http://stackoverflow.com/comment/36936406
has comment: http://stackoverflow.com/comment/36926853
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23961360
has body: The problem is here BigInteger n = new BigInteger(InetAddress.getByName(sIPv6).getAddress()); byte[] bytes = n.toByteArray(); When you invoke toByteArray() the returned array is only large enough to contain all the significant bits of the address. Since your address starts with 0:0:... the returned byte array will be too short (14). You must left-pad it with binary zeros to make it 128 bits long (16 bytes).
has comment: http://stackoverflow.com/comment/36939730
type: Answer
answers question: http://stackoverflow.com/q/23961360
upvote count: 1
score: 1

http://stackoverflow.com/q/24079695
tagged with: google-glass
answer count: 1
has answer: http://stackoverflow.com/a/24082048
type: UnansweredQuestion
has body: Is there any way to upload a photo that I took (by the "take a picture" voice command)/ a video (by the "record a video" command) of the google glass to a php server?
tagged with: android
has comment: http://stackoverflow.com/comment/37136265
has comment: http://stackoverflow.com/comment/37135444
has title: post picture/video to a php server on google glass
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/74850924
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23993522
has text: When connection is established, how to access contacts?
type: Comment

http://stackoverflow.com/a/24001743
score: 0
answers question: http://stackoverflow.com/q/24001674
type: Answer
has body: I'd go with option 0. Two things: It's closer to the intention of the code (at least that's how I read your question and, in fact, the code). This will make it easier to maintain the code in the future - it's hard to imagine how much time the change you propose would actually make but I believe the time you save developing will always outscale the savings you'd make by orders of magnitude. Second, Just-in-time compilation means you might not even doing yourself a favor performancewise because the java virtual machine might find out for you if case 1 is actually better and react accordingly.

http://stackoverflow.com/q/24042161
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37066564
has title: Rename refactoring in a XML file using XPATH
has comment: http://stackoverflow.com/comment/37067048
has comment: http://stackoverflow.com/comment/37066202
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
answer count: 0
has comment: http://stackoverflow.com/comment/37067876
has body: I want to implement rename refactoring for an input XML file. I have an XML file which is in fact a representation of an input Java program. The XML file for a simple Java program are as below: public class main { private String str; public void print() { str= "Hello World!"; System.out.println(str);} } The resulted XML file as below: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> public class main { <decl_stmt> private String str ;</decl_stmt> public void print <parameter_list>()</parameter_list> { <expr_stmt> str = "Hello World!" ;</expr_stmt> <expr_stmt> System . out . println <argument_list>( str )</argument_list> ;</expr_stmt> } } I want to select an element and then find all its references using XPath expression. For example, in the above example, I want to select the field "str" and then returns two places where it is used. Then I can rename all of them to the new name. Note that I can not add new detailed information to the XML file (such as adding an ID to the field and IDref to its references). The above XML file is all information that I can have for the above input Java program. Another note is that if I define a variable with name "str" in the function "print" then both references to str are refereed to this variable and not to the field. Therefore, they are not references of the field. (-: It is good if anyone can help me with a XPath solution as my program is based on XPath queries. However, please also let me know if there is another simple way such as an API that I can use to programmatically implement rename refactoring in the XML file.
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37067515

http://stackoverflow.com/comment/37149909
score: 0
type: Comment
type: QuestionComment
has text: (You might want to spend 30 minutes or so with Google, researching what "cache" really is.)
comment on: http://stackoverflow.com/q/24086795

http://stackoverflow.com/q/24004860
type: Question
has title: How can I make this Java Code Faster?
accepted answer: http://stackoverflow.com/a/24004876
tagged with: arrays
answer count: 1
score: -4
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36996290
favorite count: 0
has body: this code works fine, but it is too slow for where I am submitting it... I am doing the Australian Informatics Competion and this code has to run under 0.5 seconds. It is taking 0.4 for some questions and is correct, but it times out otherwise which is crap! Is there a way of making it faster?? Plzz Here it is: import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) throws IOException{ Scanner input = new Scanner(new File("encyin.txt")); BufferedWriter output = new BufferedWriter(new FileWriter("encyout.txt")); int length = input.nextInt(); int questions_length = input.nextInt(); ArrayList&lt;Integer&gt; page_words = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; questions = new ArrayList&lt;Integer&gt;(); while(input.hasNextInt() &amp;&amp; page_words.size() &lt; length) { page_words.add(input.nextInt()); } while(input.hasNextInt() &amp;&amp; questions.size() &lt; questions_length) { questions.add(input.nextInt()-1); } for (int i = 0; i&lt;questions.size(); i++) { output.write(String.valueOf(page_words.get(questions.get(i))+"\n")); } input.close(); output.close(); } } Thanks guys :)
has answer: http://stackoverflow.com/a/24004876
upvote count: 1
has comment: http://stackoverflow.com/comment/36996318
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/36996289
tagged with: java
has comment: http://stackoverflow.com/comment/36996279
downvote count: 5
has comment: http://stackoverflow.com/comment/36996222

http://stackoverflow.com/comment/36883952
comment on: http://stackoverflow.com/q/23944703
score: 0
type: Comment
type: QuestionComment
has text: A single process can only have 1 System.out.

http://stackoverflow.com/q/23970044
score: 0
has title: Java positioning GUI component with/without layout manager
has answer: http://stackoverflow.com/a/23970517
tagged with: layout
tagged with: user-interface
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23970109
has body: I'm trying to position some components to align to the left. public class MyGUI extends JPanel { public MyGUI() { FlowLayout layout = new FlowLayout(FlowLayout.LEFT); setLayout(layout); JLabel label_1 = new JLabel("label1"); JTextField textArea = new JTextField(15); JButton button_1 = new JButton("button 1"); button_1.addActionListener(new EventHandler()); JLabel label_2 = new JLabel(); JButton button_2 = new JButton("button 2"); button_2.addActionListener(new EventHandler()); JLabel label_3 = new JLabel(); JButton button_3 = new JButton("button 3"); button_3.addActionListener(new EventHandler()); JLabel label_4 = new JLabel(); add(label_1); add(textArea); add(button_1); add(label_2); add(button_2); add(label_3); add(button_3); add(label_4); } But this is all I'm getting: I need the buttons positioned to the left,a the labels (not visible) positioned to the right. What layout manager would be best for this and how can I manually position any components using x/y coords?
answer count: 4
has answer: http://stackoverflow.com/a/23970511
tagged with: swing
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23970527

http://stackoverflow.com/a/54945157
downvote count: 0
has body: Using Button, BrowserWindowOpener and getUI().getPage().open("http://www.google.com", "_blank"); is discouraged since that is usually blocked by popup blockers. Instead go with the Link component: final Link link = new Link("Google", new ExternalResource("http://www.google.com")); link.setTargetName("_blank"); See more in the Vaadin Link Documentation
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24039476

http://stackoverflow.com/q/24009228
has comment: http://stackoverflow.com/comment/37007964
has title: Android Geolocation Sample Request, Result not found
type: Question
has comment: http://stackoverflow.com/comment/37004249
tagged with: google-maps
tagged with: google-geolocation
has body: I want to get my phone's estimate location through Cell Towers information. I post the sample request from the Google Geolocation through Android. What's wrong in my code to post the request? https://developers.google.com/maps/documentation/business/geolocation/#sample-requests I use Http Post to post the JSON object by setting the content type as application/json. The problem is the result of the request I obtained from the debugger are as below: 06-03 14:51:06.559: D/response(22250): { 06-03 14:51:06.559: D/response(22250): "error": { 06-03 14:51:06.559: D/response(22250): "errors": [ 06-03 14:51:06.559: D/response(22250): { 06-03 14:51:06.559: D/response(22250): "domain": "geolocation", 06-03 14:51:06.559: D/response(22250): "reason": "notFound", 06-03 14:51:06.559: D/response(22250): "message": "Not Found" 06-03 14:51:06.559: D/response(22250): } 06-03 14:51:06.559: D/response(22250): ], 06-03 14:51:06.559: D/response(22250): "code": 404, 06-03 14:51:06.559: D/response(22250): "message": "Not Found" 06-03 14:51:06.559: D/response(22250): } 06-03 14:51:06.559: D/response(22250): } The following is how I post my JSON request in Android. Code Snippets of MainActivity.java for the request. public class MainActivity extends Activity { private static String url = "https://www.googleapis.com/geolocation/v1/geolocate"; private JSONParser jsonParser = new JSONParser(); private JSONObject jsonObject = new JSONObject(); private JSONObject cellObject = new JSONObject(); private JSONObject wifiObject = new JSONObject(); private JSONObject resultObject = new JSONObject(); private HttpConnection httpConnection = new HttpConnection(); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); url = url + "?"; //my_key is replaced by the key obtained from the Google Developer Account. //For the API key, I create a new Server Key…
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/60059131
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/37136188
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24056657
has text: And sorry for the messy code above but I can't find ways to paste a readable code snippet in a comment. I read the help and tried several ways then the 5 minutes expired. I'm not sure how one is supposed to post code except using "Answer Your Question" which is of no use.
score: 0

http://stackoverflow.com/a/24065452
downvote count: 0
has comment: http://stackoverflow.com/comment/37109482
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24065434
has comment: http://stackoverflow.com/comment/37108994
has comment: http://stackoverflow.com/comment/37108884
has body: In most Map implementations, entries are stored based on the state of the key. If the key changes, there's no way to retrieve the entry given the key. A HashMap deals with a key's hashCode() value. If that key's hashCode() value is generated from immutable state, it will be constant. Since those types are immutable, their (external) properties are immutable and their hashCode() is generated from those properties, a key of any of those types cannot change and this problem becomes a non-issue.
has comment: http://stackoverflow.com/comment/37109036
has comment: http://stackoverflow.com/comment/37109031

http://stackoverflow.com/comment/37165976
type: QuestionComment
has text: Open `Preferences > Java > Code Style > Formatter`. Edit your active profile (or create a new one) and look at the `Braces` section.
score: 1
comment on: http://stackoverflow.com/q/24095912
type: Comment

http://stackoverflow.com/comment/36959070
has text: This question would be better asked on codereview
comment on: http://stackoverflow.com/q/23981199
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24061041
accepted answer: http://stackoverflow.com/a/24061090
tagged with: sockets
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: tcp
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24061090
has title: Java socket write byte[] instead of String
answer count: 1
downvote count: 0
has body: I'm new to socket programming, and I've been following several tutorials like this one http://www.myandroidsolutions.com/2012/07/20/android-tcp-connection-tutorial/ and was able to build a client-server architecture over TCP using socket. The thing is, the tutorials are basic so they teaches you how to send using PrintWriter and BufferedReader which seems to write and read String. I have to encrypt my data and send it as byte[], so the question will be: For this mean, can I still use PrintWriter and BufferedReader? if not then What classes should I use for this means and how?, I have seen DataOutputStream and DataInputStream and several others, but have not found their difference or why use one or another. PS: The encryption part is already done, so don't worry about it as it is not the question :)
favorite count: 0

http://stackoverflow.com/q/23996032
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23996746
favorite count: 0
has comment: http://stackoverflow.com/comment/36979756
upvote count: 2
tagged with: android
has body: My Android application has a native C++ layer and a Java layer. The Java layer accesses the native layer via JNI calls. Can the C++ layer safely create C++ objects for its own internal use, and store them in C++ member variables? I'm talking about C++ objects that don't need to be accessed by Java code in any way, i.e. they are managed and deleted completely in the C++ layer. In other words, the same object (via a member variable) is accessed throughout multiple JNI calls, but only the C++ layer needs to access it. I need confirmation in this matter, because I know that there are special JNI methods for handling objects (relevant terms: local reference, global reference, etc.). If I'm correct, these apply only for objects that are visible by (or created for) Java code as well. Therefore, I suppose that native-only C++ objects can be created and deleted in the usual ways (such as new and delete), and Java doesn't need to know anything about them. No special interoperability considerations are necessary, as long as the objects and any references to them reside exclusively in the C++ layer. Is this correct? Can I define C++ classes and methods in this layer in the same way as if it was a usual C++ application without any JNI/Java interoperability? To be general, is it allowed to instantiate and store plain C++ objects, i.e. objects that are out of the authority of Dalvik/JVM?
score: 2
type: AnsweredQuestion
has title: Plain C++ objects in code accessed by JNI
tagged with: java
has comment: http://stackoverflow.com/comment/36985520
has answer: http://stackoverflow.com/a/23996746
type: Question
has comment: http://stackoverflow.com/comment/36979478
tagged with: java-native-interface

http://stackoverflow.com/a/24065055
score: 0
has body: int duration = 90; int min = duration/60; int sec = duration%60; String formattedTime = String.format("%d:%02d",min,sec);
type: Answer
answers question: http://stackoverflow.com/q/24064759

http://stackoverflow.com/a/48739929
has body: from the oracle document Reading an object from the ObjectInputStream is analogous to creating a new object. Just as a new object's constructors are invoked in the order from the superclass to the subclass, an object being read from a stream is deserialized from superclass to subclass. The readObject or readObjectNoData method is called instead of the constructor for each Serializable subclass during deserialization. so in nutshell it should call readObject() method in the hierarchy from super class to subclass. which will only present if all super class implements serializable interface, otherwise superclasse's default constructor is invoked. so serializable Each subclass of a serializable object may define its own readObject method. If a class does not implement the method, the default serialization provided by defaultReadObject will be used. When implemented, the class is only responsible for restoring its own fields, not those of its supertypes or subtypes.
type: Answer
answers question: http://stackoverflow.com/q/24096059
score: 0

http://stackoverflow.com/q/24066299
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/94734214
tagged with: log4j
favorite count: 0
has comment: http://stackoverflow.com/comment/37119537
has answer: http://stackoverflow.com/a/24148092
has body: We have about 19 applications in our weblogic 8.1 server. Each application is an .Ear application with a few ejbs, mdb etc., Each application has a log4j properties defined in a .properties file somewhere in the filesystem. We keep getting this error(below) in the server logs for all the applications. This exception is not caught in the application, the flow of the application does not stop, but we miss a log statement or two when this exception occurs. log4j:ERROR Attempted to append to closed appender named Note: I've looked up in the internet, i've not seen duplicate log4j.jar files anywhere in the system. I can post the .properties files if you need. EDIT: Including a couple of log4j properties. These property files are same for all the other applications as well. 1st LOG file. # Define the root logger with appender file log=.//SI_AppLogs log4j.rootLogger=WARN, SomeApp log4j.logger.SomeAppLoggers = INFO, SomeApp # Define the file appender log4j.appender.SomeApp=org.apache.log4j.DailyRollingFileAppender log4j.appender.SomeApp.File=${log}/CPEPortBasedAuthorization.log log4j.appender.SomeApp.DatePattern='.'yyyy-MM-dd log4j.appender.SomeApp.Append=true # Define the layout for file appender log4j.appender.SomeApp.layout=org.apache.log4j.PatternLayout log4j.appender.SomeApp.layout.conversionPattern=%d %-5r %-5p [%c] (%t:%x) %m%n log4j.additivity.org.apache=false log4j.additivity.SomeAppLoggers = false 2nd Log file # Define the root logger with appender file log=.//SI_AppLogs log4j.rootLogger=WARN, AnotherApp log4j.logger.AnotherAppLoggers = INFO, AnotherApp # Define the file appender log4j.appender.AnotherApp=org.apache.log4j.DailyRollingFileAppender log4j.appender.AnotherApp.File=${log}/CPEPortBasedAuthorization.log log4j.appender.AnotherApp.DatePattern='.'yyyy-MM-dd log4j.appender.AnotherApp.Append=true # Define the layout for file appender log4j.appender.AnotherApp.layout=org.apache.log4j.PatternLayout log4j.appender.AnotherApp.layout.conversionPattern=%d %-5r %-5p…
tagged with: logging
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37118147
has comment: http://stackoverflow.com/comment/37153409
upvote count: 3
tagged with: java
has title: log4j:ERROR Attempted to append to closed appender named
linked to: http://stackoverflow.com/q/8243137
type: Question
tagged with: weblogic
accepted answer: http://stackoverflow.com/a/24148092

http://stackoverflow.com/comment/37178296
score: 0
type: AnswerComment
has text: @lsnow2017 How are you checking which requests get sent? Maybe they are all being sent but the server is throttling your requests. Does it behave the same way if you use a wait call to wait for a few seconds at the end of the loop?
type: Comment
comment on: http://stackoverflow.com/a/24052803

http://stackoverflow.com/q/24053040
possible better answer: http://stackoverflow.com/a/24062615
type: Question
has answer: http://stackoverflow.com/a/24062615
tagged with: bytecode
has body: I am trying to record instance level (or class level ) object initialization or object assignments through bytecode manipulation (using ASM framework ) Something like this : This is the class where I am declaring some instance variables : class DeclarationTestClass1{ /** Assume This Class has some public instance variables **/ private MultipleDeclarationTestClass multiClass = null; private List&lt;String&gt; arrayList1_String = null; public static Hashtable&lt;Integer,Integer&gt; staticHashTable = null; public List&lt;String&gt; getArrayList1_String() { return arrayList1_String; } public void setArrayList1_String(List&lt;String&gt; arrayList1_String) { this.arrayList1_String = arrayList1_String; } } Now, I want to do : DeclarationTestClass1 object1 = new DeclarationTestClass1(); MultipleDeclarationTestClass object1 .object1_innerObject = new MultipleDeclarationTestClass(); RecordingClass.recordingMethod(object1.arrayList1_String = new ArrayList&lt;String&gt;()); RecordingClass.recordingMethod(object1 .object1_innerObject.someMap = new HashMap&lt;String,String&gt;()); Now when I see the output of the desired class using ASMifier , I can see that before the actual putfield is called , there is one DUP_X1 getting called. Now , my understanding is that as the instance level object is referred through another object (i.e : object1.arrayList1_String = new ArrayList&lt;String&gt;() , second word of the stack holds the object through which it is referred (i.e object1 ). Please correct me if I am wrong. But , what I can not understand , in the second scenario , when the instance level object is reffered through another extra object (i.e: object1 .object1_innerObject.someMap = new HashMap&lt;String,String&gt;()) , it has another extra object in the stack , right ? So my questions are : 1) Why in the second scenario also , DUP_X1 is called ? 2) I am using COMPUTE_MAXS flag in asm , by dint of which asm calculates the max stack size for me . So , will this duplicating have any …
answer count: 2
upvote count: 1
tagged with: java-bytecode-asm
favorite count: 0
accepted answer: http://stackoverflow.com/a/24067568
tagged with: bytecode-manipulation
type: AnsweredQuestion
has title: How ASM checks maximum stack size when duplicating operand stack (DUP_X1 and DUP operands)
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24067568

http://stackoverflow.com/a/24073375
has body: Just replace File fXmlFile = new File("your XML file"); on URL url = null; try { url = new URL("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); } catch (MalformedURLException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } URLConnection conn = null; try { conn = url.openConnection(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } And code must run in AsyncTask. I will send full source code through few days.
type: Answer
answers question: http://stackoverflow.com/q/24045207
score: 0

http://stackoverflow.com/comment/37066653
score: 1
has text: The value can be manipulated with the get(), set(), getValue(), and setValue() methods. The get() and set() methods perform their operation with the primitive int type. The getValue() and setValue() methods use the Integer wrapper type.
comment on: http://stackoverflow.com/q/24042649
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24074462
score: 1
has comment: http://stackoverflow.com/comment/37125740
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24074376
downvote count: 0
has body: how about &lt;c:redirect url="/context/controller?action=log-in"&gt; &lt;c:param name="firstName" value="fred"&gt;&lt;/c:param&gt; &lt;/c:redirect&gt;

http://stackoverflow.com/a/36632922
has body: The best way to achieve a soft delete with Hibernate is to use the @SQLDelete annotation on your classes. make sure your mapping is set to cascade delete calling session.delete(yourClass) should achive your soft delete Hibernate doc //used to overide the normal delete behavior @SQLDelete(sql="UPDATE (table_name) SET deleted = '1' WHERE id = ?") //optional Use this to exclude deleted element from get @Where(clause="deleted &lt;&gt; '1'") //OR (Filter may also be used if you need to load deleted items occasionally) @FilterDef(name="ProductFilter",defaultCondition="deleted &lt;&gt; 1 ")
has comment: http://stackoverflow.com/comment/82231997
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23990008
score: 3
answers question: http://stackoverflow.com/q/23990008
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37071587
has text: You got me wrong. I am trying to go to "foo.class" that is called "next". I dont need putString or something else
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24045196
type: AnswerComment

http://stackoverflow.com/q/24009042
upvote count: 25
has answer: http://stackoverflow.com/a/76497461
accepted answer: http://stackoverflow.com/a/24009231
has answer: http://stackoverflow.com/a/71696597
tagged with: java
tagged with: hibernate
has body: I was trying to import a sample project in to eclipse and was facing the below given error up on running the application. Caused by: org.hibernate.MappingException: org.hibernate.dialect.OracleDialect does not support identity key generation at org.hibernate.dialect.Dialect.getIdentityColumnString(Dialect.java:743) at org.hibernate.dialect.Dialect.getIdentityColumnString(Dialect.java:733) at org.hibernate.mapping.Table.sqlCreateString(Table.java:426) at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:1028) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:125) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:492) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782) at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) ... 32 more As per this SO link, I have changed the @GeneratedValue(strategy = GenerationType.IDENTITY) to @GeneratedValue(strategy = GenerationType.AUTO) or @GeneratedValue(strategy = GenerationType.TABLE) But didn't work. Here is the code: User.java: @Entity @Table(name = "users") @ManagedBean @ViewScoped public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "username", nullable = false) private String username; @Column(name = "password", nullab…
linked to: http://stackoverflow.com/q/3406837
type: Question
has comment: http://stackoverflow.com/comment/37039200
has title: org.hibernate.dialect.OracleDialect does not support identity key generation
has comment: http://stackoverflow.com/comment/37043845
has answer: http://stackoverflow.com/a/32920481
has answer: http://stackoverflow.com/a/57250855
answer count: 11
possible better answer: http://stackoverflow.com/a/62030291
has answer: http://stackoverflow.com/a/60899152
has answer: http://stackoverflow.com/a/24009231
has answer: http://stackoverflow.com/a/51856857
has answer: http://stackoverflow.com/a/24009332
downvote count: 0
has answer: http://stackoverflow.com/a/62030291
favorite count: 0
has answer: http://stackoverflow.com/a/69852200
has answer: http://stackoverflow.com/a/69553261
score: 25
type: AnsweredQuestion

annotations
tags question: http://stackoverflow.com/q/23985945
type: Tag
tags question: http://stackoverflow.com/q/23992191
tags question: http://stackoverflow.com/q/24026003
tags question: http://stackoverflow.com/q/23977909
tags question: http://stackoverflow.com/q/24037506
tags question: http://stackoverflow.com/q/23977480
tags question: http://stackoverflow.com/q/23973107
tags question: http://stackoverflow.com/q/23967235
tags question: http://stackoverflow.com/q/23953481
tags question: http://stackoverflow.com/q/23976551
tags question: http://stackoverflow.com/q/24055158
tags question: http://stackoverflow.com/q/24065249
tags question: http://stackoverflow.com/q/23987323
tags question: http://stackoverflow.com/q/24019532
tags question: http://stackoverflow.com/q/24047500
tags question: http://stackoverflow.com/q/24052390
tag name: annotations
tags question: http://stackoverflow.com/q/24047499
tags question: http://stackoverflow.com/q/24059941

http://stackoverflow.com/q/24100867
accepted answer: http://stackoverflow.com/a/24100901
has comment: http://stackoverflow.com/comment/37175135
tagged with: class
score: 0
linked to: http://stackoverflow.com/q/11949248
duplicate of: http://stackoverflow.com/q/11949248
tagged with: android
possible better answer: http://stackoverflow.com/a/24100884
has comment: http://stackoverflow.com/comment/37175186
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24100884
tagged with: java
has title: The method getIntent() in undefined
tagged with: methods
tagged with: eclipse
has body: I am making an app which has a switch on its main page and when the switch is on then it starts another activity . Here I am using getIntent() in the second activity . But it is not working and givivg the error "Undefined method" .I searched and found that this is due to the reason that my class extends 'service' and not 'activity' .But I still don't understand the solution. public class OverlayButtonActivity extends Service implements OnTouchListener { Button mButton; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { super.onCreate(); Intent intent = getIntent(); //mView = new HUDView(this); mButton = new Button(this); mButton.setText("Overlay button"); mButton.setOnTouchListener(this); } } Any help??
has answer: http://stackoverflow.com/a/24100901
type: Question
answer count: 2

http://stackoverflow.com/a/24088529
score: 0
type: Answer
has body: It's because JVM is not able to find the test_package in the class_path of test_package2 which is D:. Add test_package to the build path of test_package2. In eclipse you can do this by Right-click on test_package2 > Build Path > Configure Build Path > Add External Class Folder (or you can zip test_package and use as an external library as well). Now import it in test_package2. It should run.
has comment: http://stackoverflow.com/comment/37228708
has comment: http://stackoverflow.com/comment/37162260
answers question: http://stackoverflow.com/q/24087750

http://stackoverflow.com/comment/37132609
score: 0
has text: @AnanthaSharma Sry for the lack of information. We are planning to use Kerberos.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24075170

http://stackoverflow.com/a/24102825
has comment: http://stackoverflow.com/comment/37187928
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24102646
downvote count: 0
answers question: http://stackoverflow.com/q/24102646
upvote count: 2
has body: PLEASE READ: I made the prompt class an abstract class because apparently it fixed an error It might have fixed the compiler error, but it won't have fixed the problem. You class implements an interface in this case the ActionListener interface. Basically, an interface is a contractual agreement that means that classes the implement the interface will fulfil the requirements of the interface, in this case, this means providing an implementation of the actionPerformed method declared by the ActionListener interface Start by having a read through What Is an Interface?, Creating a GUI With JFC/Swing, How to Use Buttons, Check Boxes, and Radio Buttons and How to Write an Action Listener
type: AcceptedAnswer

http://stackoverflow.com/comment/37030655
comment on: http://stackoverflow.com/a/24023222
score: 0
type: AnswerComment
type: Comment
has text: It was all about uses-permission! Thanks!

http://stackoverflow.com/comment/37179975
comment on: http://stackoverflow.com/q/24102835
score: 0
type: Comment
type: QuestionComment
has text: FYI added token-by-token explanation and a second option. :)

http://stackoverflow.com/q/24028073
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has body: I'm interested in adding an additional ipv4 local network ip address from a java application (actually Scala). So far, the only solution I've found is runtime exec of netsh, but I'd prefer not to have a dependency on netsh and use core java libraries if possible. What's the best solution for this? Moreover, it looks like even netsh won't work for me since I'm on linux.
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24028377
type: Question
tagged with: network-programming
has title: Best way to add/set an ipv4 LAN address in java
score: 3
accepted answer: http://stackoverflow.com/a/24028377

http://stackoverflow.com/comment/37158139
comment on: http://stackoverflow.com/a/24091820
has text: No need to post a silly comment. I removed silly comment, just to keep SO professional. :-)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23945973
has answer: http://stackoverflow.com/a/23946063
has body: I am pulling 2 time values (as strings) from an XML file using xpath, these values (for example) are as follows: 00:07 08:00 00:07 is equal to 7 minutes 08:00 means 8am, with no date associated or needed (that is handled elsewhere) Each of these values is subject to change in each XML file that i read. What i am attempting to do is as follows: I need to subtract or add (depending on the situation) the 7mins from the 8am and give me a hh:mm time (eg: 07:53 or 08:07) in a string that i can eventually output to CSV Next i need to produce 2 additional strings, 1 min before and 1 min after (eg: 07:52 and 07:54 OR 08:06 and 08:08) which also need to be output to CSV I have tried everything and i can think of in relation to the time interpretation and manipulation to get the minutes subtracted/added to the time and then +/- 1 min from there, but being a complete novice i am totally stuck despite reading and testing as much as i could find. Spent the last 2 days working with Joda Time for the first time but i must be missing something fundamental as i cannot get the desired result with this either. The question is - how can i achieve this? Some sample code that gets me reading from the XML and printing the time FileInputStream file = null; try { file = new FileInputStream(new File("Output/XmlConfig.xml")); } catch (FileNotFoundException ex) { Logger.getLogger(KATT.class.getName()).log(Level.SEVERE, null, ex); } DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null; try { builder = builderFactory.newDocumentBuilder(); } catch (ParserConfigurationException ex) { Logger.getLogger(KATT.class.getName()).log(Level.SEVERE, null, ex); } Document xmlDocument = null; try { xmlDocument = builder.parse(file); } catch (SAXException ex) { Logger.getLogger(KATT.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(KATT.class.getName()).log(Level.SEVERE, null, ex); } XPath xPath = XPathFactory.newIns…
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/23946063
downvote count: 3
has comment: http://stackoverflow.com/comment/36886239
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36885926
has answer: http://stackoverflow.com/a/23946066
has answer: http://stackoverflow.com/a/23952284
tagged with: swing
has title: Java time manipulation - subtracting 2 strings
type: Question
has answer: http://stackoverflow.com/a/23946216
accepted answer: http://stackoverflow.com/a/23946216
score: -2
has comment: http://stackoverflow.com/comment/36886436
tagged with: jodatime
upvote count: 1

http://stackoverflow.com/a/23983967
answers question: http://stackoverflow.com/q/23983907
upvote count: 2
has comment: http://stackoverflow.com/comment/36956893
score: 2
type: AcceptedAnswer
downvote count: 0
has body: That's how JUnit works. For each test method that it runs, it creates a new instance of the test class, runs the test and throws the test class instance away. This is deliberate: tests should be isolated from one another. Martin Fowler explained this in more detail here: http://martinfowler.com/bliki/JunitNewInstance.html Instead of doing what you're trying to do, write a method that fills the table and call it from both tests.
type: Answer
accepted answer of: http://stackoverflow.com/q/23983907

http://stackoverflow.com/comment/37139030
type: Comment
comment on: http://stackoverflow.com/a/24082065
type: AnswerComment
has text: @aRestless True, although that could be just mistakes in how he's displaying it in the question. If he wants an ascending index in the data he can always loop through and put that back after.
score: 0

http://stackoverflow.com/comment/36984754
score: 0
type: AnswerComment
type: Comment
has text: hm. One possibility would be threadName_variableName or threadHash_variableName for a convention
comment on: http://stackoverflow.com/a/23994410

http://stackoverflow.com/a/23973591
score: 0
answers question: http://stackoverflow.com/q/23973561
has comment: http://stackoverflow.com/comment/36936517
type: Answer
has comment: http://stackoverflow.com/comment/36936486
has comment: http://stackoverflow.com/comment/36936546
has body: Integer.valueOf("-") will throw a NumberFormatException because "-" by itself isn't a number. If you did "-1", however, you would receive the expected value of -1. If you're trying to get a character code, use the following: (int) "-".charAt(0); charAt() returns a char value at a specific index, which is a two-byte unicode value that is, for all intensive purposes, an integer.

http://stackoverflow.com/comment/107369385
type: AnswerComment
comment on: http://stackoverflow.com/a/24008426
score: 0
type: Comment
has text: I don’t understand your question Fadi. The code I posted does use the scene graph and the NumberAxis.

http://stackoverflow.com/a/24022767
has body: Iterate through the list (using a for-each loop) and check for matches: for (String s : list) { s.matches("\\w.*"); // Do stuff here. }
type: AcceptedAnswer
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24022752
score: 2
answers question: http://stackoverflow.com/q/24022752
has comment: http://stackoverflow.com/comment/37029343
downvote count: 0

http://stackoverflow.com/comment/36904073
comment on: http://stackoverflow.com/a/23954104
score: 0
type: AnswerComment
has text: What changes? And as a follow up, what specifically are you looking for in the html?
type: Comment

http://stackoverflow.com/a/23958307
type: Answer
accepted answer of: http://stackoverflow.com/q/23958096
score: 1
upvote count: 1
has body: You can create your own method to do this using the byte array you get from toByteArray() public static List&lt;Byte&gt; getNibbles(byte[] bytes) { List&lt;Byte&gt; nibbles = new ArrayList&lt;Byte&gt;(); for (byte b : bytes) { nibbles.add((byte) (b &gt;&gt; 4)); nibbles.add((byte) ((b &amp; 0x0f))); } return nibbles; } public static void main(String[] args) { BigInteger i = BigInteger.valueOf(4798234); System.out.println(Arrays.toString(i.toByteArray())); System.out.println(getNibbles(i.toByteArray())); } Output [73, 55, 26] [4, 9, 3, 7, 1, 10] Take the byte 55. You're adding the highest 4 bits and the lowest 4 bits to the nibble list. 55 = 00110111 (55 &gt;&gt; 4) = 00000011 (3) (55 &amp; 0x0f) = 00000111 (7)
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23958096

http://stackoverflow.com/comment/37056474
comment on: http://stackoverflow.com/q/24037285
type: Comment
has text: For sanity you might check that ResultSet/Statement/Connection are closed. A maxPoolSize of 2 is a test I hope; less time with a larger realistic pool might be a better test.
score: 0
type: QuestionComment

nullpointerexception
tags question: http://stackoverflow.com/q/24006990
tags question: http://stackoverflow.com/q/23979541
tags question: http://stackoverflow.com/q/23970272
tags question: http://stackoverflow.com/q/23976650
tags question: http://stackoverflow.com/q/23953358
tags question: http://stackoverflow.com/q/24101765
tags question: http://stackoverflow.com/q/23980690
tags question: http://stackoverflow.com/q/24005558
tags question: http://stackoverflow.com/q/24005353
tags question: http://stackoverflow.com/q/24003831
tags question: http://stackoverflow.com/q/23981118
tags question: http://stackoverflow.com/q/24097964
tags question: http://stackoverflow.com/q/24027959
tags question: http://stackoverflow.com/q/24003707
tags question: http://stackoverflow.com/q/24079395
type: Tag
tags question: http://stackoverflow.com/q/24104150
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/24088221
tags question: http://stackoverflow.com/q/24093738
tags question: http://stackoverflow.com/q/23985497
tags question: http://stackoverflow.com/q/24020938
tags question: http://stackoverflow.com/q/24091951
tags question: http://stackoverflow.com/q/23979959
tags question: http://stackoverflow.com/q/23943592
tags question: http://stackoverflow.com/q/24006297
tags question: http://stackoverflow.com/q/24049285
tags question: http://stackoverflow.com/q/24064045
tags question: http://stackoverflow.com/q/24002987
tags question: http://stackoverflow.com/q/24054717
tags question: http://stackoverflow.com/q/24017013
tags question: http://stackoverflow.com/q/23966586
tags question: http://stackoverflow.com/q/24042681
tags question: http://stackoverflow.com/q/23986641
tags question: http://stackoverflow.com/q/23966862
tags question: http://stackoverflow.com/q/23951819
tags question: http://stackoverflow.com/q/24081869
tags question: http://stackoverflow.com/q/23999326
tags question: http://stackoverflow.com/q/24055679
tags question: http://stackoverflow.com/q/23943546
tags question: http://stackoverflow.com/q/23960838
tags question: http://stackoverflow.com/q/24049953
tags question: http://stackoverflow.com/q/24024785

http://stackoverflow.com/comment/36957118
score: 1
has text: I think it's a reasonable question, and not too broad, because I think from a practical standpoint there's an answer that's correct in most cases: putting the most common cases first won't hurt, and might help, if the switch statement is a performance sink. It does look like it might be a dupe of the question Mystical found, though.
comment on: http://stackoverflow.com/q/23983964
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23966332
has comment: http://stackoverflow.com/comment/36924289
type: Answer
has body: try this public void insert(E item) { int i = 0; while (i &lt; N &amp;&amp; pq.get(i).compareTo(item) &lt;= 0) { i++; } N++; }
score: 0
answers question: http://stackoverflow.com/q/23966265

http://stackoverflow.com/q/23993645
has comment: http://stackoverflow.com/comment/36974703
has answer: http://stackoverflow.com/a/23993889
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/23998014
has comment: http://stackoverflow.com/comment/36974685
tagged with: jmockit
accepted answer: http://stackoverflow.com/a/23998014
has comment: http://stackoverflow.com/comment/36983233
answer count: 2
tagged with: mocking
has body: I want to test this class which calls a method of interface using anonymous class. public class ClassToTest { public void methodToTest() { InterefaceToMock interefaceToMockReference = new InterefaceToMock() { @Override public int methodToMock() { return 0; } }; interefaceToMockReference.methodToMock(); } } This is the interface public interface InterefaceToMock { public int methodToMock(); } I am using this approch to check it methodToMock is called or not import static org.junit.Assert.*; import org.junit.Test; import mockit.FullVerificationsInOrder; import mockit.Mocked; import mockit.NonStrictExpectations; public class TestAClass { @Mocked InterefaceToMock interefaceToMockReferenceMocked; @Test public void test1() { new NonStrictExpectations() { { interefaceToMockReferenceMocked.methodToMock();times=1; } }; (new ClassToTest()).methodToTest(); new FullVerificationsInOrder(interefaceToMockReferenceMocked) { }; assertTrue(true); } } But test case fails. Can anyone help.
tagged with: junit
downvote count: 0
has title: In testing in java how to check if a method of an interface is called or not?
favorite count: 0
has comment: http://stackoverflow.com/comment/36975949
has comment: http://stackoverflow.com/comment/36975981
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/23993889

http://stackoverflow.com/comment/37094240
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24057291
has text: i.e code is returning hostname of machine from its ip

http://stackoverflow.com/q/23947701
has comment: http://stackoverflow.com/comment/36891172
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/23947764
has title: i want to know about tomcat server messages
score: 0
has answer: http://stackoverflow.com/a/23947764
duplicate of: http://stackoverflow.com/q/15632153
has comment: http://stackoverflow.com/comment/36889288
has comment: http://stackoverflow.com/comment/36891336
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/15632153
tagged with: displaytag
has body: I want to know in detail about these messages which is appears when i start my tomcat.. i am using display tags in my project. server is apache tomcat 7.0. will this create problem when i will host it on server? &gt; May 30, 2014 10:56:13 AM org.apache.catalina.core.StandardContext &gt; reload &gt; INFO: Reloading Context with name [/ZestYouth] has started &gt; May 30, 2014 10:56:13 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc &gt; SEVERE: The web application [/ZestYouth] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the &gt; web application was stopped. To prevent a memory leak, the JDBC Driver &gt; has been forcibly unregistered. &gt; May 30, 2014 10:56:13 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads &gt; SEVERE: The web application [/ZestYouth] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely &gt; to create a memory leak. &gt; May 30, 2014 10:56:13 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads &gt; SEVERE: The web application [/ZestYouth] appears to have started a thread named &gt; [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but &gt; has failed to stop it. This is very likely to create a memory leak. &gt; May 30, 2014 10:56:13 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads &gt; SEVERE: The web application [/ZestYouth] appears to have started a thread named &gt; [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but &gt; has failed to stop it. This is very likely to create a memory leak. &gt; May 30, 2014 10:56:13 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads &gt; SEVERE: The web application [/ZestYouth] appears to have started a thread named &gt; [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but &gt; has failed to stop it. This is very likely to create a memory leak. &gt; May 30, 2014 10:56:13 AM org.ap…
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/36926838
type: Comment
type: QuestionComment
has text: See http://androidplot.com/docs/using-axis-value-labels/.
comment on: http://stackoverflow.com/q/23967835
score: 0

http://stackoverflow.com/comment/37152466
type: Comment
has text: Thanks. Where do I add this argument? There must have been some changes made, yes. But since I haven't started a java application, Eclipse or other that I know of in several weeks, those changes must've been done without my knowledge.
comment on: http://stackoverflow.com/a/24083862
type: AnswerComment
score: 0

http://stackoverflow.com/q/24040681
has comment: http://stackoverflow.com/comment/37062646
has answer: http://stackoverflow.com/a/24040804
favorite count: 0
has comment: http://stackoverflow.com/comment/37063463
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37063184
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24041165
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37062625
has comment: http://stackoverflow.com/comment/37063578
tagged with: arrays
score: -1
has body: I have an abstract class Cell: public abstract class Cell{...} I also have to other classes like: public class BigCell extends Cell{...} and public class SmallCell extends Cell{...} and I want to create an array(10x10) that has in the diagonal(i=j) cells of Cell class, up of the diagonal type BigCell cells and down SmallCell cells I wrote this code but is wrong because I can't create the diagonal(i=j) because is type Cell: public void initializeTable(){ for(int i = 0; i &lt; length; i++){ for(int j = 0; j &lt; length; j++){ if(i == j){ table[i][j] = new Cell(); }else if(i &gt; j){ table[i][j] = new SmallCell(); }else{ table[i][j] = new BigCell(); } } } } How can I create my table?
tagged with: abstract-class
answer count: 2
has title: How to create an array of abstract classes
linked to: http://stackoverflow.com/q/1352109
has comment: http://stackoverflow.com/comment/37063018

http://stackoverflow.com/q/24090637
has comment: http://stackoverflow.com/comment/37156015
type: Question
has title: Open new JFrame with JButton Click - Java Swing
has comment: http://stackoverflow.com/comment/37156085
has answer: http://stackoverflow.com/a/24090783
favorite count: 0
has answer: http://stackoverflow.com/a/24090699
upvote count: 3
has comment: http://stackoverflow.com/comment/37155997
answer count: 3
possible better answer: http://stackoverflow.com/a/24090699
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/37160220
tagged with: jframe
tagged with: swing
has body: I am trying to open a new JFrame window with a button click event. There is lots of info on this site but nothing that helps me because I think it is not so much the code I have, but the order it is executed (however I am uncertain). This is the code for the frame holding the button that I want to initiate the event: package messing with swing; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.border.EmptyBorder; public class ReportGUI extends JFrame{ //Fields private JButton viewAllReports = new JButton("View All Program Details"); private JButton viewPrograms = new JButton("View Programs and Majors Associated with this course"); private JButton viewTaughtCourses = new JButton("View Courses this Examiner Teaches"); private JLabel courseLabel = new JLabel("Select a Course: "); private JLabel examinerLabel = new JLabel("Select an Examiner: "); private JPanel panel = new JPanel(new GridLayout(6,2,4,4)); private ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; courseList = new ArrayList&lt;String&gt;(); public ReportGUI(){ reportInterface(); allReportsBtn(); examinnerFileRead(); courseFileRead(); comboBoxes(); } private void examinnerFileRead(){ try{ Scanner scan = new Scanner(new File("Examiner.txt")); while(scan.hasNextLine()){ list.add(scan.nextLine()); } scan.close(); } catch (FileNotFoundException e){ e.printStackTrace(); } } private void courseFileRead(){ try{ Scanner scan = new Scanner(new File("Course.txt")); while(scan.hasNextLine()){ courseList.add(scan.nextLine()); } scan.close(); } catch (FileNotFoundException e){ e.printStackTrace(); } } private void reportInterface(){ setTitle("Choose Report Specifications"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel panel = new JPanel(new FlowLayout()); add(panel, BorderLayout.CENTER); setSize(650,200); setVisible(true); setResizable(false); setLocationRelativeTo(null); } private void allR…
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24090736
has comment: http://stackoverflow.com/comment/37156016
accepted answer: http://stackoverflow.com/a/24090736
downvote count: 0
tagged with: java

http://stackoverflow.com/a/23964295
has comment: http://stackoverflow.com/comment/36920849
has comment: http://stackoverflow.com/comment/36920589
score: 0
has body: If you're worried about the app closing and restarting, and somehow restoring the score for particular activity, you'll probably want to use some persistent storage. It's a little unclear exactly your parameters, but assume each session that a user goes through ScoreActivity generates a unique score, which you want tied to a specific activity, you can store the value in SharePreferences and retrieve it later when you start the activity with a particular identifier. Reference here: http://developer.android.com/reference/android/content/SharedPreferences.html So you'd basically be storing a KV pair like { "scoreSession1", 10 }.
type: Answer
has comment: http://stackoverflow.com/comment/36921102
answers question: http://stackoverflow.com/q/23964101

http://stackoverflow.com/comment/36984169
comment on: http://stackoverflow.com/a/23998241
score: 0
type: Comment
has text: thanks for your prompt and detailed response. Will implement it now and let you know in case any issues.
type: AnswerComment

http://stackoverflow.com/comment/36990281
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23984714
has text: @user3400060 read the answer, not just copy-paste code. It's not supposed to work and I explained why it doesn't make sense, on many different levels. If you have further question feel free to ask, but I don't give trivial answers that easily, just for learning purpose. Good luck.
score: 0

http://stackoverflow.com/a/24012729
answers question: http://stackoverflow.com/q/24012611
downvote count: 0
type: Answer
score: 1
has body: You can create SQLite database from CSV file using technique suggested in this post: How to import load a .sql or .csv file into SQLite? Then you can follow this article to use pre built sqlite database in your application. http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
upvote count: 1

http://stackoverflow.com/q/24019262
downvote count: 0
has body: I have a video on a server that I want to play in a videoview. On my LG G pro (4.1.2) it works like a charm, but it doesnt work on an old nexus (4.1.2) and HTC Desire X (android 4.0.4) Here is my code: videoUrl = video.getUrl(); Uri videoUri = Uri.parse(videoUrl); vvVideoFullscreen.setVideoURI(videoUri); video.getUrl() returns the following string: http://sdf.mysite.com/upload/video/456456.mp4 Pretty straightforward. What should I do about this? I was told that the video file has the right mp4 compression format: h.264 baseline, as outlined here http://developer.android.com/guide/appendix/media-formats.html Here is the error log: D/MediaPlayer(3963): setDataSource(Context context, http://sdf.mysite.com/upload/video/456456.mp4, Map&lt;String, String&gt; headers) in E/MediaPlayer(3963): java.io.FileNotFoundException: No content provider: http://sdf.mysite.com/upload/video/456456.mp4 V/MediaPlayer(3963): network type=wifi Also, I tried playing the video via intent this way: Uri videoUri = Uri.parse(videoUrl); Intent intent = new Intent(Intent.ACTION_VIEW, videoUri); intent.setDataAndType(videoUri, "video/mp4"); startActivity(intent); But I got the following log messages (the video didnt play) 06-03 19:19:48.129: D/ChromiumHTTPDataSource(129): connect to http://sdf.mysite.com/upload/video/456456.mp4 @19601517 06-03 19:19:48.139: V/HTC_Util(129): skip header(x-htc-autoclose)=true 06-03 19:19:48.139: V/HTC_Util(129): skip header(x-htc-buffertime)=7 06-03 19:19:48.139: V/HTC_Util(129): skip header(x-htc-internetwarning)=false 06-03 19:19:48.149: V/HTC_Util(129): skip header(x-htc-maxudpport)=65535 06-03 19:19:48.149: V/HTC_Util(129): skip header(x-htc-mimetype)=video/mp4 06-03 19:19:48.149: V/HTC_Util(129): skip header(x-htc-minudpport)=1024 06-03 19:19:48.159: V/HTC_Util(129): skip header(x-htc-romversion)=1.18.707.3 06-03 19:19:48.159: V/HTC_Util(129): skip header(x-htc-rtcpreportinterval)=3000 06-03 19:19:48.159: V/HTC_Util(129): skip header(x-htc-rtptimeout)=25000 06-0…
favorite count: 0
tagged with: android
score: 2
upvote count: 2
type: UnansweredQuestion
has title: When trying to play a video from url in a videoview, I get a FileNotFoundException: No content provider error on SOME phones
has answer: http://stackoverflow.com/a/31806413
has comment: http://stackoverflow.com/comment/68086796
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24031944

http://stackoverflow.com/q/24085409
answer count: 3
has answer: http://stackoverflow.com/a/24085546
downvote count: 0
accepted answer: http://stackoverflow.com/a/25328906
favorite count: 0
score: 2
has body: In my tests, I have many alerts that appear. For example, if I don't fill out a required item in my form, I get an alert. So far, I have been able to switch to them and perform my actions (verify text, click ok/cancel) by using the below code. basicClick(AppObjects.Continue); String warningText2 = driver.switchToAlert().getText(); Assert.assertEquals(warningText2, "You have not responded to all of the items on this page.\n\nPlease click 'OK' to return to the current page, or 'Cancel' to go to the next page."); driver.switchToAlert().accept() I am now trying to test another alert. It is in a different part of my application and caused by different circumstances than the previous alerts, but it is still just a javascript alert that appears. I use the code below to try and verify the text and click OK, but it is not working. basicClick(AppObjects.Continue); String warningText3 = driver.switchToAlert().getText(); Assert.assertEquals(warningText3, "A comment would be helpful, but is not required.\n\nPlease click 'OK' to return to the current page, or 'Cancel' to go to the next page"); driver.switchToAlert().accept(); I am getting the below errors when trying to switch to this new alert using web driver. How can I get around this issue and verify the text inside the alert and click OK/Cancel? Here is the error I get when using IE or FF org.openqa.selenium.UnhandledAlertException: Modal dialog present: A comment would be helpful, but is not required. Please click 'OK' to return to the current page, or 'Cancel' to go to the next page Build info: version: '2.42.0', revision: '5e82430', time: '2014-05-22 20:18:07' System info: host: 'jgubbels', ip: '10.50.13.78', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_40' Session ID: 5375f9ca-7077-403b-b8e2-fb671ee238b6 Driver info: org.openqa.selenium.ie.InternetExplorerDriver Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false, enablePersistentHov…
upvote count: 2
tagged with: selenium
linked to: http://stackoverflow.com/q/8244723
has answer: http://stackoverflow.com/a/25328906
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24097762
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/19550514
possible better answer: http://stackoverflow.com/a/24085546
has title: Can't switch to javascript alert in Selenium Webdriver

http://stackoverflow.com/a/24070329
accepted answer of: http://stackoverflow.com/q/24070069
upvote count: 1
answers question: http://stackoverflow.com/q/24070069
type: AcceptedAnswer
downvote count: 0
has body: I am not aware of any library that would do what you asked. But you could speed up you code considerably with some changes: a) Don't check the interval. Check only the left limit: Instead of if (l0 &lt;= value &amp;&amp; value &lt;= u0) { hardScore = hardScore-5; } Do if (value &gt; MAX_LIMIT) { // error condition here return; } if (l0 &lt;= value) { // no need to check the upper limit because it was already handled by the if above hardScore = hardScore-5; } b) Speed up your code using elses and avoid checking the value 7 times: Instead of if (l2 &lt;= value &amp;&amp; value &lt;= u2) { hardScore = hardScore-1; } if (l3 &lt;= value &amp;&amp; value &lt;= u3) { hardScore = hardScore-2; } Have if (l2 &lt;= value) { hardScore = hardScore-1; } else if (l3 &lt;= value) { hardScore = hardScore-2; }
type: Answer
score: 1

http://stackoverflow.com/comment/37157666
type: QuestionComment
has text: Where is `level` defined?
score: 2
comment on: http://stackoverflow.com/q/24091557
type: Comment

http://stackoverflow.com/a/24073015
has body: As pointed out the original code results in a run-time error because a Map.Entry object isn't a Car (so the cast is invalid). That being said, since the keys are not required then Map#values can be used, for (final Car car : carMap.values()) { al.add(car); } Or, "No loops Ma!" List&lt;Car&gt; cars = new ArrayList&lt;Car&gt;(carMap.values());
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37122815
upvote count: 2
answers question: http://stackoverflow.com/q/24072926
has comment: http://stackoverflow.com/comment/37122760
type: Answer

http://stackoverflow.com/a/24035027
score: 0
has body: If you're looking to get the corresponding index position of a selection in a JComboBox you can call getSelectedIndex() once the focus is lost on the JComboBox. Note that getSelectedIndex() returns a value starting at 0. Therefore, you may want to add +1 to the returned value if you want the first selection to return a value of 1, the second selection to return a value of 2, etc.
type: Answer
answers question: http://stackoverflow.com/q/24034926

http://stackoverflow.com/q/24086699
tagged with: sax
has title: SaxParser and Wikipedia dump (10GB+)
tagged with: 32bit-64bit
score: 1
tagged with: java
has body: I read that SaxParser is good for big files. But as we can see in documentation, methods of ContentParser class are using 32-bit data types for storing position in file. Wikipedia dump can be file a lot bigger than 2GB. Therefore, is this safe to use SaxParser with Wikipedia Dumps? If not - what should I use?
type: Question
tagged with: saxparser
tagged with: 32-bit
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37148276
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23953060
linked to: http://stackoverflow.com/q/23658848
tagged with: jdbc
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/27844062
tagged with: openshift
has answer: http://stackoverflow.com/a/23954239
has body: At the moment i have an android client app which connects to my java server through socket - serversocket. It sends and receive strings. The java server is connected to a mysql database (actually mariadb) using the jdbc driver. I succeed to create a jbossas application and upload the code of the java server to openshift, but i didn't find any detailed tutorial on how do i connect to this new uploaded server from my socket client (This one (RMI or socket connection to Java Program on OpenShift) gives some tips but i'm still stucked). More on this, how do i know that my server runs just fine on openshift and how do i control de calls to the database after i connect it (found this: $ rhc app create MyApp jbossas-7 $ rhc cartridge add mysql-5.5 -a MyApp), using org.mariadb.jdbc.Driver and java.sql is still working ? Any small guide or tip is highly appreciated. I'm new to these things so please don't be too heavy on comments.
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question
answer count: 2
has title: Java server on OpenShift
upvote count: 1

http://stackoverflow.com/comment/37017859
comment on: http://stackoverflow.com/q/24016458
has text: Yes sir I am connected to the right database with the right credentials.. All other service and controllers use the same connection provider and are working fine. Also if I fire non-join query I get a resultSet that is not empty. The problem occurs with multiple table queries ...!!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37029705
has text: Are you using the latest BaseGameUtils and GooglePlayServices? BaseGameUtils: https://github.com/playgameservices/android-samples/tree/master/eclipse_compat/libraries
type: Comment
comment on: http://stackoverflow.com/q/24016707
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36896625
has text: Do you know how to find the prime factorization of a number? Start by writing a method `factor` that returns a `List` of the appropriate numeric type. Additionally, is using `BigInteger` required? It's a good bit slower than `long`.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23951769

http://stackoverflow.com/q/24073906
has title: Hibernate how to get by id from lazy object
upvote count: 3
tagged with: java
tagged with: hibernate
has body: I had entity A,A is many to one B,fetch type is lazy. When i use below code B still lazy. A a = session.get(A.class,aId);//a.getB(); is lazy B b = session.get(B.class,bId);//this object is same whith a.getB(); //b.id is 0; //b.name is null; //b.age is 0; //if i remove A a = session.get(A.class,aId); //then //b.id is bId; //b.name is "Test"; //b.age = 18; how can i get don't empty B Use My code? class A{ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="bId",nullable = false) B b; //getter and setter } class B{ @Column int id; @Column String name; @Column int age; //getter and setter } //it is in my porject,Shipment is A,OrderDetail is B Shipment shipment = shipmentDao.getByDate(id, shipmentDate); OrderDetail od = baseDao.getById(OrderDetail.class, id);
type: Question
has answer: http://stackoverflow.com/a/24073992
score: 3
has comment: http://stackoverflow.com/comment/37124316
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37124783
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37073153
type: Comment
comment on: http://stackoverflow.com/q/24041960
has text: http://stackoverflow.com/questions/3118968/sessiontimeout-web-xml-vs-session-maxinactiveinterval I
score: 0
type: QuestionComment

android
tags question: http://stackoverflow.com/q/24008870
tags question: http://stackoverflow.com/q/24042368
tags question: http://stackoverflow.com/q/24087728
tags question: http://stackoverflow.com/q/24103181
tags question: http://stackoverflow.com/q/24063958
tags question: http://stackoverflow.com/q/24076508
tags question: http://stackoverflow.com/q/24045110
tags question: http://stackoverflow.com/q/24033620
tags question: http://stackoverflow.com/q/24078812
tags question: http://stackoverflow.com/q/24015564
tags question: http://stackoverflow.com/q/24059440
tags question: http://stackoverflow.com/q/24050482
tags question: http://stackoverflow.com/q/23961197
tags question: http://stackoverflow.com/q/24097804
tags question: http://stackoverflow.com/q/24081179
tags question: http://stackoverflow.com/q/23983234
tags question: http://stackoverflow.com/q/24017013
tags question: http://stackoverflow.com/q/23979257
tags question: http://stackoverflow.com/q/23965862
tags question: http://stackoverflow.com/q/23990174
tags question: http://stackoverflow.com/q/23946496
tags question: http://stackoverflow.com/q/24103725
tags question: http://stackoverflow.com/q/23968316
tags question: http://stackoverflow.com/q/23949237
tags question: http://stackoverflow.com/q/24000709
tags question: http://stackoverflow.com/q/24082513
tags question: http://stackoverflow.com/q/23952773
tags question: http://stackoverflow.com/q/24076600
tags question: http://stackoverflow.com/q/24055578
tags question: http://stackoverflow.com/q/24034360
tags question: http://stackoverflow.com/q/24084319
tags question: http://stackoverflow.com/q/24023468
tags question: http://stackoverflow.com/q/23960019
tags question: http://stackoverflow.com/q/24068959
tags question: http://stackoverflow.com/q/24099987
tags question: http://stackoverflow.com/q/23995088
tags question: http://stackoverflow.com/q/24058163
tags question: http://stackoverflow.com/q/24056591
tags question: http://stackoverflow.com/q/24022515
tags question: http://stackoverflow.com/q/23987373
tags question: http://stackoverflow.com/q/24056060
tags question: http://stackoverflow.com/q/24080321
tags question: http://stackoverflow.com/q/23949438
tags question: http://stackoverflow.com/q/24041293
tags question: http://stackoverflow.com/q/23947358
tags question: http://stackoverflow.com/q/23946071
tags question: http://stackoverflow.com/q/23966351
tags question: http://stackoverflow.com/q/24013169
tags question: http://stackoverflow.com/q/23961538
tags question: http://stackoverflow.com/q/23984465
tags question: http://stackoverflow.com/q/24021101
tags question: http://stackoverflow.com/q/24012068
tags question: http://stackoverflow.com/q/23946482
tags question: http://stackoverflow.com/q/23996215
tags question: http://stackoverflow.com/q/23961472
tags question: http://stackoverflow.com/q/24104275
tags question: http://stackoverflow.com/q/23958792
tags question: http://stackoverflow.com/q/24029121
tags question: http://stackoverflow.com/q/23962324
tags question: http://stackoverflow.com/q/23982368
tags question: http://stackoverflow.com/q/23978125
tags question: http://stackoverflow.com/q/23980442
tags question: http://stackoverflow.com/q/24018032
tags question: http://stackoverflow.com/q/24021400
tags question: http://stackoverflow.com/q/24068199
tags question: http://stackoverflow.com/q/24049197
tags question: http://stackoverflow.com/q/23967835
tags question: http://stackoverflow.com/q/23998679
tags question: http://stackoverflow.com/q/24035121
tags question: http://stackoverflow.com/q/24084876
tags question: http://stackoverflow.com/q/23971697
tags question: http://stackoverflow.com/q/24084467
tags question: http://stackoverflow.com/q/24046049
tags question: http://stackoverflow.com/q/24069575
tags question: http://stackoverflow.com/q/23960512
tags question: http://stackoverflow.com/q/24029546
tags question: http://stackoverflow.com/q/24051900
tags question: http://stackoverflow.com/q/24075984
tags question: http://stackoverflow.com/q/24011849
tags question: http://stackoverflow.com/q/24026296

http://stackoverflow.com/comment/37208440
comment on: http://stackoverflow.com/q/24075808
has text: If we remove the "return" statement for the executeScript method, a null pointer exception is thrown in the above mentioned Java program because "result" variable doesn't gets any value.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37052024
type: Comment
comment on: http://stackoverflow.com/q/24034636
score: 0
has text: @user838204 Couldn't you just pass an ```ArrayList``` of fields and names into your ```TestBean```? Otherwise you'll end up with an unruly amount of private instance variables all with a similar name.
type: QuestionComment

http://stackoverflow.com/q/23989625
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36969036
score: 1
has answer: http://stackoverflow.com/a/23991500
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36967892
answer count: 2
tagged with: sockets
accepted answer: http://stackoverflow.com/a/23991500
upvote count: 1
has comment: http://stackoverflow.com/comment/36968278
tagged with: spring
tagged with: spring-integration
tagged with: java
has comment: http://stackoverflow.com/comment/36968673
possible better answer: http://stackoverflow.com/a/23995149
has body: I'm using Spring (Integration) to offer a socket tcp connection. I'm having a specific timeout for this socket. When the timeout is exceeded, I not only like to shut down the connection (which already works), but also return custom error message (or not closing the connection, but just return the error message). Is that possible? @Bean public TcpConnectionFactoryFactoryBean tcpFactory(Converter converter) { TcpConnectionFactoryFactoryBean factory = new TcpConnectionFactoryFactoryBean(); factory.setType("server"); factory.setPort("8080"); factory.setSingleUse(true); factory.setSoTimeout(10000); //10s; how to return error message? return factory; } Update: @Bean public ApplicationListener&lt;TcpConnectionEvent&gt; tcpErrorListener() { TcpConnectionEventListeningMessageProducer producer = new TcpConnectionEventListeningMessageProducer(); producer.setEventTypes(new Class[] {TcpConnectionCloseEvent.class}); producer.setOutputChannel(tcpErrorChannel()); //what to do here? return producer; }
has answer: http://stackoverflow.com/a/23995149
has title: How to return an error message on socket timeout with Spring-Integration

http://stackoverflow.com/comment/37259299
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24090162
has text: as far as I know, for a particular program, we have a main thread to start with, which is a entry point of that program, then inside that main thread we can ask for more threads from the jvm to run the code simultaneously.
type: Comment

http://stackoverflow.com/comment/36922452
score: 0
comment on: http://stackoverflow.com/q/23965202
has text: Another option is to have the heartbeat on a separate port and establish a separate socket for it. Not as flexible but easier to implement given the current state of your code.
type: Comment
type: QuestionComment

permgen
tags question: http://stackoverflow.com/q/23943990
tag name: permgen
type: Tag

http://stackoverflow.com/comment/37150380
has text: okey, this is what i want. i want a user to type in a number. my program will square the users number. the result of the square must be 8 digit long. if they are not, my program will add zeros at the beggining to make them 8. this is because my program will then take the digits starting at index 2 to index 5(e.g if result of multiplication is 12345678, digits at[2-5] are 3456) and squre them and give the user the result of squre. thats what i want sir.
comment on: http://stackoverflow.com/a/24083795
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23952611
tagged with: javascript
has title: Grid not getting populated in IE8
score: 0
has body: I am using jqxgrid for my application.The grid is working fine in chrome browser however in Internet Explorer 8 it is not.In IE8, the grid is getting populated in some pages while in some pages it is showing error “Object does not support this property or method-jqxrid.js”.However,it is supporting the same js file for other pages in IE8 only.I am using the same code for all the pages as well in same sequence order (for js imports). Also, I have observed that,this problem is coming in pages in which I havent used iframe while grid is coming fine in pages in which grid is used in iframe.Can anybody please suggest what might be the problem?
answer count: 1
has comment: http://stackoverflow.com/comment/36898538
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23952793
tagged with: java
type: Question

http://stackoverflow.com/comment/37088219
score: 4
has text: And you seriously didn't think about googling it ? There are a few ways to implement a singleton in Java: 1. like you did. 2. double check pattern with instance declared as volatile. 3. using Enum. 4. Using inner class for lazy instantiation. and maybe others. BTW, the convention is to name the method `getInstance()`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24054296

http://stackoverflow.com/q/24061189
has title: android.content.ActivityNotFoundException when opening file using ContentProvider
linked to: http://stackoverflow.com/q/23830157
tagged with: android
has comment: http://stackoverflow.com/comment/37101070
has answer: http://stackoverflow.com/a/24078914
possible better answer: http://stackoverflow.com/a/24061463
has body: I am trying to open a private file using another application. I created ContentProvider for the same as below. But I get following error: 06-05 12:57:20.791: E/AndroidRuntime(21922): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.contentprovider/com.android.contentprovider.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.android.contentprovider//data/data/com.android.contentprovider/files/Sample.txt typ=/text* } My code in the main activity is: try { File newFile = new File("Sample.txt"); FileOutputStream fileOutputStream = openFileOutput(newFile.toString(), MainActivity.MODE_PRIVATE); } catch (Exception e) { Toast.makeText(MainActivity.this, "Failed", Toast.LENGTH_SHORT).show(); } Uri uri = Uri.parse("content://com.android.contentprovider/" + this.getFilesDir().toString() + "/Sample.txt"); Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(uri, "/text*"); startActivity(intent); My contentprovider file: package com.android.contentprovider; import java.io.File; import java.io.FileNotFoundException; import android.content.ContentProvider; import android.content.ContentValues; import android.database.Cursor; import android.net.Uri; import android.os.ParcelFileDescriptor; public class MyProvider extends ContentProvider { @Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { File privateFile = new File(getContext().getFilesDir(), uri.getPath()); return ParcelFileDescriptor.open(privateFile, ParcelFileDescriptor.MODE_READ_ONLY); } @Override public int delete(Uri arg0, String arg1, String[] arg2) { return 0; } @Override public String getType(Uri arg0) { return null; } @Override public Uri insert(Uri arg0, ContentValues arg1) { return null; } @Override public boolean onCreate() { return false; } @Override public Cursor query(Uri arg0, String[] arg1, …
tagged with: android-intent
has answer: http://stackoverflow.com/a/24061463
tagged with: android-contentprovider
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24078914

milton
tag name: milton
type: Tag
tags question: http://stackoverflow.com/q/23977471

http://stackoverflow.com/q/24027943
upvote count: 2
type: UnansweredQuestion
tagged with: mapsforge
score: 2
has body: Please help me with android programming. I am making one android mapsforge app and want to add multiple markers on Android Mapsforge map using Mysql. My data is situated in Database Mysql and i am getting with Json using php. It is working but problem is to add markers. Here is my code: public void friend_finder(){ try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://fifauz.com/selectall.php"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); Log.e("log_tag", "connection success "); Toast.makeText(getApplicationContext(), "Connected", Toast.LENGTH_SHORT).show(); } catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); Toast.makeText(getApplicationContext(), "Connection fail", Toast.LENGTH_SHORT).show(); } //convert response to string try{ BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); Intent i = new Intent(getBaseContext(),MainActivity.class); startActivity(i); } is.close(); result=sb.toString(); } catch(Exception e) { Log.e("log_tag", "Error converting result "+e.toString()); } try { JSONArray jArray = new JSONArray(result); for(int i=0;i&lt;jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); String name = json_data.getString("Name"); //Double lati = json_data.getDouble("latitude"); // Double longi = json_data.getDouble("longitude"); String lati = json_data.getString("Lati"); String longi = json_data.getString("Long"); String s = name + lati + longi; double lati_d = Double.valueOf(lati.trim()).doubleValue(); double longi_d = Double.valueOf(longi.trim()).doubleValue(); Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show(); ListOverlay listOverlay = new ListOverlay(); GeoPoint currentLocation = new GeoPoint(lati_d,longi_d); //Strin…
has title: add multiple markers on Android Mapsforge map
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37039722
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27499732
tagged with: android
favorite count: 0

http://stackoverflow.com/q/23970046
tagged with: java
has body: i wrote the following code to move a rectangle using arrow keys but no sort of movement is occurring on the jframe window once i press the keys. I googled a lot regarding this but to no avail.I just see a rectangle drawn o the widow and nothing else. Kindly help here is my code import javax.swing.JFrame; public class Main { public static void main(String args[]) { JFrame window=new JFrame(); window.setSize(640,480); window.setTitle("window"); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); drawingComponent DC=new drawingComponent(); window.add(DC); } } import java.awt.Graphics2D; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JComponent; import javax.swing.Timer; public class drawingComponent extends JComponent implements ActionListener,KeyListener { Timer t=new Timer(50,this);//moving after 5 milliseconds int x=0,y=0,vx=0,vy=0; public drawingComponent() { t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } public void paintComponent(Graphics g) { Graphics2D g2=(Graphics2D) g; Rectangle rect1=new Rectangle(x,y,100,30); g2.draw(rect1); } public void actionPerformed(ActionEvent e) //inbuilt fncn f actionListener(interface) which needs to be created { x+=vx; //changing values y+=vy; repaint(); //inbuilt fncn to repeat the paintComponent method } public void keyPressed(KeyEvent e) { System.out.println("ewbkw"); int code=e.getKeyCode(); if(code==KeyEvent.VK_UP) { vx=0; vy=-2;repaint(); } if(code==KeyEvent.VK_DOWN) { vx=0; vy=2; repaint(); } if(code==KeyEvent.VK_LEFT) {vy=0; vx=-2; repaint(); } if(code==KeyEvent.VK_RIGHT) {vy=0; vx=2; repaint();} } public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} }
answer count: 1
has comment: http://stackoverflow.com/comment/36933361
has comment: http://stackoverflow.com/comment/36936283
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40064691
has comment: http://stackoverflow.com/comment/36934127
has comment: http://stackoverflow.com/comment/36936312
has comment: http://stackoverflow.com/comment/36931149
has comment: http://stackoverflow.com/comment/36933410
has title: moving rectangle using arrowkeys
type: Question
has comment: http://stackoverflow.com/comment/36933422
has comment: http://stackoverflow.com/comment/36935573
has comment: http://stackoverflow.com/comment/36933408
score: 0

http://stackoverflow.com/q/24033003
tagged with: java
has title: Generating random number between 0 and 3 and adding to an arraylist in android
has answer: http://stackoverflow.com/a/24033141
type: Question
has answer: http://stackoverflow.com/a/24033123
has answer: http://stackoverflow.com/a/24033043
has answer: http://stackoverflow.com/a/24033132
tagged with: eclipse
has answer: http://stackoverflow.com/a/24033522
has body: I am trying to make a quiz application where the options are shown in buttons.But i want the options to be shown randomly on the buttons.So i used the random class to randomly generate the numbers between 0 and 3 and then add it to an arraylist.The four options are retrieved from the database onto an array.The index of the array will be the elements of the arraylist. The code is as belows: public void setoptions(String player_name) { //int arr[]=new int[4]; int ran; Random r=new Random(); ran=r.nextInt(3 - 0 + 1) + 0; ArrayList&lt;Integer&gt; c=new ArrayList&lt;Integer&gt;(); // c.add(ran); //Toast.makeText(getApplicationContext(), ran+"",Toast.LENGTH_LONG).show(); for(int i=0;i&lt;c.size();i++) { ran=r.nextInt(3 - 0 + 1) + 0; if(c.contains(ran)) { i=0; continue; } else { c.add(ran); } } c.add(ran); optarr=dbm.getoptions(player_name); Toast.makeText(getApplicationContext(),player_name,Toast.LENGTH_LONG).show(); btnopt1.setText(optarr[c.get(0).intValue()]); btnopt2.setText(optarr[c.get(1).intValue()]); btnopt3.setText(optarr[c.get(2).intValue()]); btnopt4.setText(optarr[c.get(3).intValue()]); // i=(int) Math.random(); //} } I am getting the following logcat: 06-04 04:45:03.697: E/AndroidRuntime(30164): FATAL EXCEPTION: main 06-04 04:45:03.697: E/AndroidRuntime(30164): Process: com.example.readfifa, PID: 30164 06-04 04:45:03.697: E/AndroidRuntime(30164): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 06-04 04:45:03.697: E/AndroidRuntime(30164): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 06-04 04:45:03.697: E/AndroidRuntime(30164): at java.util.ArrayList.get(ArrayList.java:308) 06-04 04:45:03.697: E/AndroidRuntime(30164): at com.example.readfifa.MainActivity.setoptions(MainActivity.java:226) 06-04 04:45:03.697: E/AndroidRuntime(30164): at com.example.readfifa.MainActivity$1.onItemSelected(MainActivity.java:62) 06-04 04:45:03.697: E/AndroidRuntime(30164): at android.widget.AdapterView.fireOnSelected(AdapterView.java:893) 0…
score: 0
has comment: http://stackoverflow.com/comment/37049367
has answer: http://stackoverflow.com/a/24033113
has answer: http://stackoverflow.com/a/24033167
answer count: 9
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24033290
has answer: http://stackoverflow.com/a/24033864

http://stackoverflow.com/q/24036458
has comment: http://stackoverflow.com/comment/37055162
linked to: http://stackoverflow.com/q/4123385
has comment: http://stackoverflow.com/comment/37054624
has comment: http://stackoverflow.com/comment/37055562
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/37054631
tagged with: split
has comment: http://stackoverflow.com/comment/37055885
upvote count: 0
has comment: http://stackoverflow.com/comment/37054596
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24037198
has answer: http://stackoverflow.com/a/24036592
has title: Java - Remove html tags and free lines
answer count: 3
has body: Before asking, I tried to find the solution from other threads but without success. Now: I need to remove tags from a html code. I did that using: str = str.replaceAll("\\&lt;.*?\\&gt;", "").trim(); and this worked. But now I have a problem: in free lines it doesn't work because it take me the space. ex: input: &lt; tag="/name/'&gt; &lt; tag bla="itemprop"&gt; &lt; tag="/name/'&gt;TEST&lt; tag bla="itemprop"&gt; I want as ouput only: TEST and not (free space) TEST How can I remove all the blank lines? Let me clarify my qestion. Im writing piece of a HTML code on a text file. I have this output: Brian, Klein Phil, Churchward (free space) Nigel, Simpkiss Richard, Heeley James, Bryce Andrew, Fettis Owen, Trevor (free space) Konrad, Begg Scott, Weintrob Ben, Duncan Chris, Richards Kit, Lynch, Robinson Southan, Morris (free space) How can I remove the spaces between the two "//"? I used str = str.replaceAll("\\&lt;.*?\\&gt;", "").trim(); But if I have " &lt; tag="/name/'&gt; &lt; tag bla="itemprop"&gt; " It takes me the space too!
has comment: http://stackoverflow.com/comment/37054859
has comment: http://stackoverflow.com/comment/37054746
has comment: http://stackoverflow.com/comment/37055779
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37055717
has answer: http://stackoverflow.com/a/24036830
has comment: http://stackoverflow.com/comment/37054687
downvote count: 1

http://stackoverflow.com/comment/37095734
type: Comment
comment on: http://stackoverflow.com/a/24057291
has text: please tell me the link of website or post that code here
score: 0
type: AnswerComment

http://stackoverflow.com/q/24006446
has comment: http://stackoverflow.com/comment/37020776
downvote count: 0
has comment: http://stackoverflow.com/comment/37331622
tagged with: synchronization
favorite count: 0
answer count: 5
has body: I want to efficiently avoid concurrent execution of a time-consuming task in a heavily multi-threaded environment without making threads wait for a lock when another thread is already running the task. Instead, in that scenario, I want them to gracefully fail (i.e. skip its attempt to execute the task) as fast as possible. In other words: I need to make any attempt to launch the task again when it is already in progress to back off immediately, preferably without a synchronization cost. To illustrate the idea considerer this unsafe (has race condition!) code: private static boolean running = false; public void launchExpensiveTask() { if (running) return; // Do nothing running = true; try { runExpensiveTask(); } finally { running = false; } } I though about using a variation of Double-Checked Locking (consider that running is a primitive 32-bit field, hence atomic, it could work fine even for Java below 5 without the need of volatile). It could look like this: private static boolean running = false; private static Object execLock = new Object(); public void launchExpensiveTask() { if (running) return; // Do nothing synchronized (execLock) { if (running) return; running = true; try { runExpensiveTask(); } finally { running = false; } } } Maybe I should also use a local copy of the field as well (not sure now, please tell me). But then I realized that anyway I will end with an inner synchronization block, that still could hold a thread with the right timing at monitor entrance until the original executor leaves the critical section (I know the odds usually are minimal but in this case we are thinking in several threads competing for this long-running resource). So, could you think in a better approach? EDIT: I previously omitted part of the context, for correctness here I need to maintain a lock during execution to hold other methods trying to change some internal shared state. To be fair I upvoted helpful answers so far including both cases: with and without the need …
accepted answer: http://stackoverflow.com/a/24017553
possible better answer: http://stackoverflow.com/a/24006603
has answer: http://stackoverflow.com/a/24030480
has answer: http://stackoverflow.com/a/24006603
type: AnsweredQuestion
has title: How to avoid concurrent execution of a time-consuming task without blocking?
has answer: http://stackoverflow.com/a/24184371
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24028387
has comment: http://stackoverflow.com/comment/37172790
tagged with: concurrency
linked to: http://stackoverflow.com/q/17683575
has answer: http://stackoverflow.com/a/24017553
score: 2
has comment: http://stackoverflow.com/comment/37000152

http://stackoverflow.com/comment/117876411
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25017842
type: Comment
has text: Looks like the "\n" solution now works in Firefox as well.

http://stackoverflow.com/a/24024605
type: Answer
has comment: http://stackoverflow.com/comment/37136468
upvote count: 1
has comment: http://stackoverflow.com/comment/60211593
score: 1
accepted answer of: http://stackoverflow.com/q/24016348
answers question: http://stackoverflow.com/q/24016348
type: AcceptedAnswer
downvote count: 0
has body: There seem to be spaces in the file path: New%20folder%20(2)

http://stackoverflow.com/a/47156052
upvote count: 3
answers question: http://stackoverflow.com/q/24056987
score: 3
downvote count: 0
type: Answer
has body: For Solr Version 6.6. Its been a little late but it will be useful to other people. I want to configure the search for the field "product_name". solrconfig.xml productSuggester AnalyzingInfixLookupFactory --> DocumentDictionaryFactory product_name true text_suggest true false managed-schema <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> <filter class="solr.ASCIIFoldingFilterFactory"/> <field name="product_name" type="text_suggest" />

http://stackoverflow.com/a/24112797
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24097764
answers question: http://stackoverflow.com/q/24097764
score: 1
upvote count: 1
has body: The problem wasn't errors, but it's good to fix those before posting code, it was the database which I don't have. I changed it so your table uses ObservableList&lt;String&gt; since that's what you're using and it's best to specify the structure in the table. This will only run if you have H2 jar in your path or set it as a library in your project. You can remove that part of the code and just use your database. package dynamictable; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.Map; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellDataFeatures; import javafx.scene.control.TablePosition; import javafx.scene.control.TableView; import javafx.scene.control.TableView.TableViewSelectionModel; import javafx.scene.control.cell.TextFieldTableCell; import javafx.stage.Stage; import javafx.util.Callback; import javafx.util.StringConverter; public class DynamicTable extends Application{ private ObservableList&lt;ObservableList&lt;String&gt;&gt; data; private TableView&lt;ObservableList&lt;String&gt;&gt; tableview; //CONNECTION DATABASE public void buildData() { data = FXCollections.observableArrayList(); try { DriverManager.registerDriver(new org.h2.Driver()); Connection c = DriverManager.getConnection("jdbc:h2:mem:"); //or you can use derby in your jdk folder //DriverManager.registerDriver(new org.apache.derby.jdbc.EmbeddedDriver()); //Connection c = DriverManager.getConnection("jdbc:derby:memory:myDB;create=true"); Statement stmt = c.createStatement(); String sql = "CREATE TABLE CUSTOMER…

http://stackoverflow.com/a/24054248
type: Answer
has comment: http://stackoverflow.com/comment/49475541
score: 1
downvote count: 1
has body: Depending on the version of Cassandra you are running, tv you could either have bound statements added to a batch (C* 2.0) or prepare a batch statement (C* 1.2). These 2 options are covered in this blog post: http://www.datastax.com/dev/blog/client-side-improvements-in-cassandra-2-0 Basically with C* 2.0 you can do: if (pStmtHistTable == null) { pStmtHistTable = session.prepare(insertToCassandra); pStmtHistTable.setConsistencyLevel(ConsistencyLevel.ONE); } // create a batch statement BatchStatement batch = new BatchStatement(); for (FileLoaderVo fileLoaderVo : LoadVo) { // add bound statements to the batch batch.add(pStmtHistTable.bind(...)); } // execute all session.execute(batch);
answers question: http://stackoverflow.com/q/24051221
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24051221
type: AcceptedAnswer

http://stackoverflow.com/q/24034767
has comment: http://stackoverflow.com/comment/37051604
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37051614
has comment: http://stackoverflow.com/comment/37051852
has comment: http://stackoverflow.com/comment/37051736
has body: So i have this application in which I am storing Sockets in an ArrayList on the Server side. When the client closes its application the socket must close as well but It doesnt reflect the changes in the ArrayList in the server. class arrays { public static ArrayList&lt;Socket&gt; online_buyer=new ArrayList&lt;Socket&gt;(); public static ArrayList&lt;Socket&gt; online_seller=new ArrayList&lt;Socket&gt;(); public static ArrayList&lt;String&gt; buyer_prod=new ArrayList&lt;String&gt;(); } public void seller_display() { while(true) { if(flag==1) { synchronized(sock) { for(int i=0;i&lt;arrays.online_buyer.size();i++) { System.out.println(arrays.buyer_prod.get(i)); } flag=0; } } check2(); } } public void check2() { for(int i=0;i&lt;arrays.online_buyer.size();i++) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } **while(!arrays.online_buyer.get(i).isConnected())** { arrays.online_buyer.remove(i); arrays.buyer_user.remove(i); arrays.buyer_add.remove(i); arrays.buyer_prod.remove(i); arrays.time.remove(i); arrays.buyer_no.remove(i); flag=1; System.out.println("RECORD DELETED"); } } } public void run() { get_details(); } } Now the statement while(!arrays.online_buyer.get(i).isConnected()) must be while(!false)=true. When i close the socket from the client side as isconnected()method must return false. But this statement never runs to be false even if i close the socket from client.
type: Question
has comment: http://stackoverflow.com/comment/37051644
linked to: http://stackoverflow.com/q/155243
tagged with: sockets
has comment: http://stackoverflow.com/comment/37051608
duplicate of: http://stackoverflow.com/q/155243
has comment: http://stackoverflow.com/comment/37051793
has comment: http://stackoverflow.com/comment/37051664
score: 0
tagged with: java
answer count: 1
has title: Sockets in ArrayList wont get closed
has answer: http://stackoverflow.com/a/24034871
type: UnansweredQuestion

http://stackoverflow.com/q/24012311
tagged with: postgresql
favorite count: 0
has title: How force Hibernate create table with type Serial for primary Key
has comment: http://stackoverflow.com/comment/37009677
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2183932
linked to: http://stackoverflow.com/q/4979746
tagged with: spring
has comment: http://stackoverflow.com/comment/37010044
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37016740
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37009908
has body: In my spring project, the field Id (used as primary key for my entity classes), have this annotations: @Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; But when the Hibernate create the table in my postgresql database, this field is created with the type Integer. I would like this field to be created with type Serial. Is there any way to do that? UPDATE I change the declaration for the field If for this: @Id @Column(name = "id", columnDefinition = "serial") @GeneratedValue(strategy=GenerationType.AUTO) and now, nothing is created in the database when I start the application with a blank database. UPDATE 2 I tested with this configuration: @SequenceGenerator(allocationSize=1, initialValue=1, sequenceName="usuario_id_seq", name="usuario_id_seq") @GeneratedValue(generator="usuario_id_seq", strategy=GenerationType.SEQUENCE) @Generated(GenerationTime.INSERT) @Id @Column(name="id", columnDefinition="serial") private Integer id; the tables are created, but the primary key is created as integer, and not serial, what I want.
downvote count: 0

http://stackoverflow.com/comment/37146695
score: 0
type: Comment
type: QuestionComment
has text: The sketch I made is supposed to make the leds start blinking or stop blinking whenever I press a button or send a '0' char. It works that way when I use the Serial monitor. However, when doing it via java, it suddenly becomes unresponsive, leaving one led on and ignoring either the button or the serial data. The serial led on the arduino board doesn't blink anymore when I send other chars. Then I have to reset it.
comment on: http://stackoverflow.com/q/24085730

http://stackoverflow.com/a/24085546
answers question: http://stackoverflow.com/q/24085409
has comment: http://stackoverflow.com/comment/37145877
has comment: http://stackoverflow.com/comment/37146161
score: 0
has body: Are you sure that you're waiting until the alert is present? Doing QA, I found that the hardest part of the job tended to be getting the script to wait until the necessary element on the page had been rendered.
type: Answer

http://stackoverflow.com/comment/37002328
type: QuestionComment
comment on: http://stackoverflow.com/q/24006990
score: 0
type: Comment
has text: All the answers below should address your concerns, if you are not able to grasp it please get your basics right first.

http://stackoverflow.com/a/24138636
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: After asking the MontiCore team, the following solution turned out be a good approach: I wrote a helper class for pretty printing the embedded automaton ASTNode (see Listing 1). This helper class can be used e.g. with the following code line: System.out.println(PrettyPrintFactory.getInstance().printNode(autMoore)); Listing 1: import mc.ast.ASTCNode; import mc.ast.PrettyPrinter; import mc.helper.IndentPrinter; import mc.maautomaton._prettyprint.MontiArcAutomatonConcretePrettyPrinter; /** * Prints the AST-Content to a file **/ public class PrettyPrintFactory { private static PrettyPrintFactory instance; private PrettyPrinter pretty; public static PrettyPrintFactory getInstance() { if (instance == null) { instance = new PrettyPrintFactory(); } return instance; } private PrettyPrintFactory() { pretty = new PrettyPrinter(); pretty.addConcretePrettyPrinter(new MontiArcAutomatonConcretePrettyPrinter()); } /** prints the syntax of the astNode to a String */ public String printNode(ASTCNode astNode) { IndentPrinter ip = new IndentPrinter(); pretty.prettyPrint(astNode, ip); return ip.getContent(); } }
answers question: http://stackoverflow.com/q/24079424

http://stackoverflow.com/comment/37165817
type: Comment
type: QuestionComment
has text: You can have a look at http://vitali.web.cs.unibo.it/Progetti/VectorConverter
comment on: http://stackoverflow.com/q/24073764
score: 0

http://stackoverflow.com/q/24008589
score: -1
has answer: http://stackoverflow.com/a/24008919
has comment: http://stackoverflow.com/comment/37003417
upvote count: 0
answer count: 1
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/37003046
tagged with: java
has comment: http://stackoverflow.com/comment/37003458
downvote count: 1
linked to: http://stackoverflow.com/q/215271
type: Question
has title: Sort a 2D array of structs in Java
has comment: http://stackoverflow.com/comment/37002965
has body: Given the 2D Array, PearsonArray[100][100], how would I sort in descending order based on the double PearsonArray[][].pearson_correlation? The rows are just intergers and the columns are structs (as depicted below). Result data looks like this: ROW 0: [0]==>[TEST_USER:201,TRAIN_USER:13, CORRELATION:0.2222194792894441 [1]==>[TEST_USER:201,TRAIN_USER:15, CORRELATION:0.9549380840555494 [2]==>[TEST_USER:201,TRAIN_USER:52, CORRELATION:0.8741572761215378 [3]==>[TEST_USER:201,TRAIN_USER:54, CORRELATION:0.9930549935286451 [4]==>[TEST_USER:201,TRAIN_USER:62, CORRELATION:0.37139067635410394 [5]==>[TEST_USER:201,TRAIN_USER:63, CORRELATION:0.8904703363154174 public class myPearsonStruct { int testUserID; int trainUserID; double pearson_correlation; public myPearsonStruct(int tester, int trainer, double correlation){ this.testUserID = tester; this.trainUserID = trainer; this.pearson_correlation = correlation; } }
has comment: http://stackoverflow.com/comment/37003102

http://stackoverflow.com/comment/51281347
has text: This answer is not a complete solution. What if you change the orientation? what if you press cancel progress - where does the network operation get's cancelled?
comment on: http://stackoverflow.com/a/25251102
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37535765
has text: In the ManagedBean needed the users list (locally).
comment on: http://stackoverflow.com/q/24017638
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37108982
score: 0
comment on: http://stackoverflow.com/q/24032075
type: QuestionComment
type: Comment
has text: and how do you call xtext / the validator

http://stackoverflow.com/comment/95902125
type: Comment
type: QuestionComment
score: 2
has text: If you are using springboot 1.5 and above, simply adding `spring.jackson.deserialization.wrap-exceptions=false` to your application.properties file will do.
comment on: http://stackoverflow.com/q/24040720

http://stackoverflow.com/q/24056422
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/40235908
has body: I use scribe librabry for java , that's a library that simplificate oAuth procedure. I try to write a code for authenticate me in the withings api with java with scribe but i have always the same problem : "Invalide Token". I don't know what to write in the verifier param in scribe .... Thanks for your response. Bye.
type: Question
has title: how to authentificate through withings api using sribe in java
accepted answer: http://stackoverflow.com/a/26756582
has answer: http://stackoverflow.com/a/26756582
tagged with: api
upvote count: 1
tagged with: scribe
answer count: 1
tagged with: withings
has comment: http://stackoverflow.com/comment/41574479
favorite count: 0
tagged with: oauth
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/36926973
type: Comment
type: QuestionComment
has text: @JonSkeet It don't need to protect from SQL Injection because only me will use this app hehe ;)
score: 0
comment on: http://stackoverflow.com/q/23967672

http://stackoverflow.com/comment/37175709
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24101036
type: Comment
has text: @Kb Remember `Thread` implements `Runnable`.

http://stackoverflow.com/comment/37085082
score: 0
type: AnswerComment
has text: Please add your final solution to your question for future reference.
comment on: http://stackoverflow.com/a/24029989
type: Comment

openjpa
tags question: http://stackoverflow.com/q/24024633
type: Tag
tags question: http://stackoverflow.com/q/24052191
tag name: openjpa

http://stackoverflow.com/a/24036379
downvote count: 0
answers question: http://stackoverflow.com/q/24035910
has body: I would use the jstl taglib : &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; and then use the foreach and do sometihng like : &lt;c:forEach var="item" items="${userObject.addresses}"&gt; ${item.street} &lt;/c:forEach&gt;
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/37177745
comment on: http://stackoverflow.com/a/24087111
has text: Cool, it seems what you've compiled was the master branch, or the JPA branch?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24042889
linked to: http://stackoverflow.com/q/3715839
has body: I am attempting to return the count of mysql rows. I get the following error when I run the .jsp file: org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 54 Which is this line of code: // count posts in category 1 catCount = conn.countCategoryPosts(1); I know the database connection is setup fine. This is the countCategoryPosts method. public int countCategoryPosts(int ncatID) throws Exception{ int catID = ncatID; try{ sql = "SELECT COUNT(*) FROM crm_posts WHERE cat_id = ?"; prep = conn.prepareStatement(sql); prep.setInt(1, catID); rs = prep.executeQuery(); }catch(Exception e){ e.printStackTrace(); } return rs.getInt(1); } What is causing the error? EDIT: As requested the full stacktrace: type Exception report message An exception occurred processing JSP page /index.jsp at line 54 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 54 51: id = Integer.parseInt(catAttributes[1]); 52: 53: // count posts in this category 54: catCount = conn.countCategoryPosts(1); 55: 56: // get posts in this category 57: postList = conn.getCategoryPosts(id); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter…
has comment: http://stackoverflow.com/comment/37066925
has comment: http://stackoverflow.com/comment/37068319
downvote count: 1
has comment: http://stackoverflow.com/comment/37066863
type: Question
has title: An exception occurred processing JSP page
tagged with: oop
has comment: http://stackoverflow.com/comment/37072730
tagged with: java
has comment: http://stackoverflow.com/comment/37068357
tagged with: mysql
score: -1
has answer: http://stackoverflow.com/a/24043016
has comment: http://stackoverflow.com/comment/37066906
upvote count: 0
has comment: http://stackoverflow.com/comment/37066820
answer count: 1
tagged with: jsp
favorite count: 0
accepted answer: http://stackoverflow.com/a/24043016
tagged with: jdbc
linked to: http://stackoverflow.com/q/3177733
has comment: http://stackoverflow.com/comment/37066881
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37067868

http://stackoverflow.com/q/23959721
upvote count: 0
answer count: 1
favorite count: 0
tagged with: encryption
has answer: http://stackoverflow.com/a/23959915
has title: Java RSA Implementation: javax.crypto.BadPaddingException
accepted answer: http://stackoverflow.com/a/23959915
type: AnsweredQuestion
has body: I know that this question has been asked before, and I wouldn't ask again if I didn't understand what I've read - I'm implement a straightforward demo of the RSA algorithm - encrypt a message, decrypt and print the output, but the console shows the BadPaddingException thrown in the code: Here's the code and the console output: Code public class RSA { public static void main (String[] args) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(2048); // 1024 or 2048 KeyPair kp = kpg.generateKeyPair(); Key publicKey = kp.getPublic(); Key privateKey = kp.getPrivate(); Cipher cipher = generateCipher(); String data = "abcdefghijklmnop\0\0\0"; System.out.println("Plaintext: " + data); byte[] ciphertext = rsaEncrypt(data.getBytes(), publicKey, cipher); System.out.println("Ciphertext: " + ciphertext); byte[] plaintext = rsaDecrypt(data.getBytes(), privateKey, cipher); System.out.println("Decrypted Plaintext: " + plaintext); } public static Cipher generateCipher() throws NoSuchAlgorithmException, NoSuchPaddingException { Cipher cipher = Cipher.getInstance("RSA"); return cipher; } public static byte[] rsaEncrypt(byte[] data, Key publicKey, Cipher cipher) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { cipher.init(Cipher.ENCRYPT_MODE, publicKey); byte[] cipherData = cipher.doFinal(data); return cipherData; } public static byte[] rsaDecrypt(byte[] data, Key privateKey, Cipher cipher) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] cipherData = cipher.doFinal(data); // error line: at learning.RSA.rsaDecrypt(RSA.java:43) return cipherData; } } Console Plaintext: abcdefghijklmnop Ciphertext: [B@346cd0f9 Exception in thread "main…
tagged with: java
tagged with: rsa
downvote count: 1
type: Question
score: -1

http://stackoverflow.com/a/24079999
type: Answer
score: 2
upvote count: 2
has body: Primitive types in parameter by default will not have a reference to it that why it is not changing when you increment it by one. On the other side if it is an object in the parameter then it will have a reference to it and thus change upon accessing and modifying the reference of the object.
answers question: http://stackoverflow.com/q/24079961
downvote count: 0

http://stackoverflow.com/comment/37048811
has text: This is not a good design. The whole idea of hamcrest and BDD in general is that the tests read like specifications. This reads like you are doing checks of class metadata rather than what the class does.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24032092
score: 1

http://stackoverflow.com/a/76497461
score: 1
has comment: http://stackoverflow.com/comment/134894750
downvote count: 0
answers question: http://stackoverflow.com/q/24009042
has body: Please Change The Oracle Dialect as Older Dialects Doesnt Support key generation e.g. try org.hibernate.dialect.Oracle12cDialect
type: Answer
upvote count: 1

http://stackoverflow.com/q/23993150
has comment: http://stackoverflow.com/comment/36973696
type: Question
has answer: http://stackoverflow.com/a/23993658
answer count: 1
has comment: http://stackoverflow.com/comment/36973789
type: UnansweredQuestion
has title: How to identify and crop a rectangle from a picture using java
score: 0
tagged with: java
has body: I am bit new to image processing. What i'm doing is recognize rectangular shapes (not overlapped) of a given image and create separate images by crop them out. So the output images should be without a border. I tried some examples but none of it did the trick. FYI: those horizontal rectangles are with black lined border in a white background. There are some symbols inside them. does anyone have a clue or an similar example? regards on help
tagged with: shape-recognition
tagged with: image-processing

http://stackoverflow.com/a/24081894
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23951819
accepted answer of: http://stackoverflow.com/q/23951819
type: AcceptedAnswer
has body: Maybe others will benefit from my mistake. The problem was that I used pro-guard and Android Studio to sign my Android App, and I had to keep-attributes some properties so Crashlytics could read the line number and class name. -keepattributes SourceFile,LineNumberTable Via
downvote count: 0

http://stackoverflow.com/q/24003707
tagged with: java
has body: I am trying to read a text file from within the JAR archive of my program. I am getting a null pointer exception when I call the method. I can't find many examples of how to do this that work online, they are all much like what I am using. public class ConsoleHelp { public void print() { try { BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/data/cmdhelp"))); int c; do { c = reader.read(); System.out.print((char) c); } while (c &gt; -1); System.out.println(); } catch (IOException e) { System.out.println("JAR file has not been packaged correctly."); } } } I get this error when I try to run this code: $ java -jar accface-0.1-test8.jar help 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:616) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.NullPointerException at java.io.Reader.&lt;init&gt;(Reader.java:78) at java.io.InputStreamReader.&lt;init&gt;(InputStreamReader.java:72) at frontend.ConsoleHelp.print(ConsoleHelp.java:11) at frontend.Command.main(Command.java:112) ... 5 more
score: 0
accepted answer: http://stackoverflow.com/a/24003760
answer count: 1
tagged with: inputstreamreader
favorite count: 0
duplicate of: http://stackoverflow.com/q/23041513
tagged with: nullpointerexception
has title: NullPointerException with InputStreamReader using getResourceAsStream
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36994448
has comment: http://stackoverflow.com/comment/36994381
linked to: http://stackoverflow.com/q/23506089
has answer: http://stackoverflow.com/a/24003760
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36994335
type: Question

http://stackoverflow.com/comment/37051940
type: QuestionComment
has text: I know, i did, but still dont copy all lines :S (I just copied the code when i tried using bw in the loop)
score: 0
comment on: http://stackoverflow.com/q/24034811
type: Comment

http://stackoverflow.com/a/26108454
has body: Keep @Transactional at your Service method. Make getXXX() calls to load the lazy properties on return entity object from the same service method a(). There is another cool option. Hibernate Fetch Profiles. Define Fetch Profile at Entity and set it active from your service or dao.
score: 0
answers question: http://stackoverflow.com/q/24064635
type: Answer

http://stackoverflow.com/comment/74022875
type: Comment
has text: Does your answer imply that implementing hashCode and equals makes no sense on a immutable class that takes only a lambda as delegate? (e.g. when you write an adapter that uses a lambda)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24098805

http://stackoverflow.com/comment/37182455
type: QuestionComment
has text: Use `Thread.Sleep()`.
comment on: http://stackoverflow.com/q/24104313
score: 36
type: Comment

http://stackoverflow.com/comment/36962170
type: Comment
has text: Give us some examples.
type: QuestionComment
comment on: http://stackoverflow.com/q/23986885
score: 0

http://stackoverflow.com/comment/51189539
type: Comment
comment on: http://stackoverflow.com/a/24095496
type: AnswerComment
has text: I looking for some code for copy all field values from a class to another. But the fields are not just native types. It's possible?
score: 0

http://stackoverflow.com/comment/37172200
type: AnswerComment
comment on: http://stackoverflow.com/a/24099469
type: Comment
has text: FWIW, `R.layout.listview_item` is not an `XmlPullParser`. There's another overload that takes an int as the first arg.
score: 0

http://stackoverflow.com/a/24088058
score: 0
has body: Please take a look at the answers in this question (Android Studio - just can&#39;t get action bar / overflow to work?). If a hardware button is available no overflow menu will be shown.
type: Answer
answers question: http://stackoverflow.com/q/24085403

http://stackoverflow.com/comment/37035723
comment on: http://stackoverflow.com/q/24025995
score: 2
has text: Can you create a [mcve](http://stackoverflow.com/help/mcve)?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37164586
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24095354
type: Comment
has text: Yes, I read up on the link. Alternatively, I can also use private static initialize-methods to initialize my static member. Thanks! I'll accept the answer when 5 minutes is up!

http://stackoverflow.com/q/23989217
has comment: http://stackoverflow.com/comment/37103173
tagged with: netty
has comment: http://stackoverflow.com/comment/37089897
has comment: http://stackoverflow.com/comment/37065373
has title: POSTing data to netty with Apache HttpClient
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37088698
tagged with: java
has comment: http://stackoverflow.com/comment/37088713
linked to: http://stackoverflow.com/q/23651447
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/37103237
has comment: http://stackoverflow.com/comment/37078633
has comment: http://stackoverflow.com/comment/37090811
has body: I'm trying to use Apache HttpClient (the fluent API) to POST data to a netty server. I've tried a few variations, I'll put two here: 1. Client: Request.Post(uri).bodyString("content value", ContentType.TEXT_PLAIN).useExpectContinue().execute().returnContent().asString(); Server: final HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(new DefaultHttpDataFactory(false), req); System.out.println(decoder.getBodyHttpDatas().size()); Calling getBodyHttpDatas() throws a: io.netty.handler.codec.http.multipart.HttpPostRequestDecoder$NotEnoughDataDecoderException 2. Client: Request.Post(uri).bodyForm(new BasicNameValuePair("value", "content value")).useExpectContinue().execute().returnContent().asString(); Server: final HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(new DefaultHttpDataFactory(false), req); final InterfaceHttpData data1 = decoder.getBodyHttpData("value"); while (decoder.hasNext()) { final InterfaceHttpData data = decoder.next(); if (data != null) { try { Attribute attribute = (Attribute) data; System.out.println(attribute.getValue()); } finally { data.release(); } } } This doesn't print any output - decoder.hasNext() is false.
score: 0
has answer: http://stackoverflow.com/a/24077852
accepted answer: http://stackoverflow.com/a/24077852
answer count: 1

http://stackoverflow.com/comment/36933955
type: Comment
comment on: http://stackoverflow.com/a/23971644
has text: my eclipse version is quite new
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36925714
score: 0
type: Comment
has text: Now you get down voted for helping? Guys, are you forgetting what SO is about? If you are in desperate need for bashing please go back to your video games.
comment on: http://stackoverflow.com/a/23967233
type: AnswerComment

http://stackoverflow.com/a/24003069
has comment: http://stackoverflow.com/comment/36994329
downvote count: 0
has comment: http://stackoverflow.com/comment/36993444
has body: After instantiating your LocationClient you can call locationclient.setMockMode(true); After that you can have your code generate Location objects like so public Location createLocation(double lat, double lng, float accuracy) { // Create a new Location Location newLocation = new Location(PROVIDER); newLocation.setLatitude(lat); newLocation.setLongitude(lng); newLocation.setAccuracy(accuracy); return newLocation; } After that you could do something like Location testLocation = createLocation(12.34, 45.679, 9.0f); and locationClient.setMockLocation(testLocation); (This is taken from here) This blog describes how to use mock locations when debugging and turning them off when not debugging.
type: Answer
answers question: http://stackoverflow.com/q/24002644
score: 1
upvote count: 1

http://stackoverflow.com/comment/37075418
has text: Not sure if you maybe missed it, but I'm working with Oracle Developer Data Modeler, not NetBeans. Thanks for the help thusfar!
type: Comment
comment on: http://stackoverflow.com/a/24038670
score: 0
type: AnswerComment

http://stackoverflow.com/a/24033292
type: Answer
has body: Create a new Java class like this import java.util.HashMap; public class MyData { private static HashMap&lt;String, String&gt; items = new HashMap&lt;String, String&gt;(); public static void addItem(String Group, String City, String boys, String girls){ items.put(Group.trim()+"," +City.trim(),boys.trim() +"," + girls.trim()); } public static String[] getItem(String Group, String City){ return items.get(Group.trim()+"," +City.trim()).split(","); } public static void clearData(){ items.clear(); } } Now When you need to put the data, then add it like this MyData.addItem("Young", "Goa", "Boys:4409 ", "girls:95"); MyData.addItem("Child", "Delhi", "Boys:66 ", "girls:90"); And when you need to retrieve it then get it like this String[] arr = MyData.getItem("Young", "Goa"); String boys = arr[0]; String girls = arr[1]; Hope this solves your problem
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24032610
downvote count: 0
has comment: http://stackoverflow.com/comment/37049942

http://stackoverflow.com/a/23949617
type: Answer
has body: I have a byte array which "contains" text - the encoding/charset is unkown at this time. If you don't know the encoding, then there is simply no concept of whitespace, \r, \n characters etc. Those characters could map to any bytes. You must determine the encoding before you can reliably perform any text-based operations. Until then, you simply don't have text. So basically you need to reorder your steps: ask the user for the encoding, then convert the byte array into text, then remove whitespace (e.g. with a regular expression).
answers question: http://stackoverflow.com/q/23949500
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23949500

http://stackoverflow.com/comment/37055033
comment on: http://stackoverflow.com/q/24035392
type: QuestionComment
has text: Well, my point is, you need to make the declarations somehow different. So you really need to _either_ supply an extra parameter, _or_ give the two methods different names. It's not clear why you don't want to have different names for the methods - it seems to me to be the most obvious thing to do.
type: Comment
score: 0

http://stackoverflow.com/comment/37160108
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24092731
type: QuestionComment
has text: @ElliottFrisch Delphi started at 90's end and nowadays it has more technology then C# if you do not know. It compiles to W32, W64, OSX, iOS and Android...

http://stackoverflow.com/comment/37166149
comment on: http://stackoverflow.com/a/24084424
type: AnswerComment
score: 0
type: Comment
has text: Hi durron, thanks for the reply. Your answer is correct and I'm doing the same in one of the other projects. But here I cannot make use of the latest slf4j libraries and need to stick with version 1.6.1 of slf4j, also if I'll use the latest version it'll conflict with 1.6.1 placed at a shared path. So I just changed the version of slf4j in pom.xml. But poof, It stopped working, not even a single exception. And I don't know how to make it work now. Any information?

http://stackoverflow.com/q/24010946
type: Question
tagged with: stax
has title: StaX: Content not allowed in prolog
has answer: http://stackoverflow.com/a/24011437
has comment: http://stackoverflow.com/comment/37007971
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37007746
has comment: http://stackoverflow.com/comment/37008126
type: UnansweredQuestion
has body: I have the following (test) XML file below and Java code that uses StaX. I want to apply this code to a file that is about 30 GB large but with fairly small elements, so I thought StaX is a good choice. I am getting the following error: Exception in thread "main" javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598) at at.tuwien.mucke.util.xml.staxtest.StaXTest.main(StaXTest.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) <?xml version='1.0' encoding='utf-8'?> Gambardella, Matthew XML Developer's Guide 44.95 An in-depth look at creating applications with XML. Ralls, Kim Midnight Rain 5.95 A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world. Here the code: package xml.staxtest; import java.io.*; import javax.xml.stream.*; public class StaXTest { public static void main(String[] args) throws Exception { XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader streamReader = xif.createXMLStreamReader(new FileReader("D:/Data/testFile.xml")); while(streamReader.hasNext()){ int eventType = streamReader.next(); if(eventType == XMLStreamReader.START_ELEMENT){ System.out.println(streamReader.getLocalName()); } //... more to come here later ... } } }
has comment: http://stackoverflow.com/comment/38533369
linked to: http://stackoverflow.com/q/5138696
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37007414

http://stackoverflow.com/q/24097297
answer count: 1
has comment: http://stackoverflow.com/comment/37168432
tagged with: google-app-engine
has body: I have an GWT application hosted on googles app engine. It was running fine until I renamed the RPC method "test()" and now I get the following error: javax.servlet.ServletContext log: greetServlet: An IncompatibleRemoteServiceException was thrown while processing this call. com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. ( Could not locate requested method 'test(java.lang.String, long)' in interface 'de.test.client.GreetingService' ) For some reason reason it is still looking for the old signature of the method. I already compiled and cleaned my project several times and redeployed it, I cleared the browser cache and tried different browsers. In Dev-Mode it works fine as well. Is there some additional cache build into app engine or something? Does someone ever experience similar issues?
has answer: http://stackoverflow.com/a/24099596
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23455516
tagged with: gwt
tagged with: java
tagged with: caching
has title: GWT on AppEngine - IncompatibleRemoteServiceException after method refactoring
type: Question
score: 0

http://stackoverflow.com/q/23999893
downvote count: 0
answer count: 1
tagged with: openscript
favorite count: 0
type: UnansweredQuestion
has body: Openscript compiles the source code file along with its assets etc. and generates a .jwg file when saving the script through IDE. I want an external method to compile the script, thus eliminating the need to open it in Openscript. Is there a way this could be achieved through Ant or some other build automation software? P.S.: There is a batch file bundled along with the software (osclti.bat) which achieves the purpose on Windows. I am specifically looking for something on Linux.
upvote count: 2
has answer: http://stackoverflow.com/a/25226241
type: Question
tagged with: ant
tagged with: java
has title: Is there a way to auto-generate a JWG file/compile an Openscript file through ANT or some other build automation system?
score: 2

http://stackoverflow.com/q/24011843
answer count: 7
tagged with: java
has answer: http://stackoverflow.com/a/24012169
possible better answer: http://stackoverflow.com/a/24011879
has answer: http://stackoverflow.com/a/24012084
has title: String[] cannot be converted to int by method invocation conversion?
has answer: http://stackoverflow.com/a/24011879
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37008810
tagged with: types
has answer: http://stackoverflow.com/a/24011987
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24012169
has comment: http://stackoverflow.com/comment/37008922
has comment: http://stackoverflow.com/comment/37017454
tagged with: compiler-errors
has body: What this code is trying to do Desired result: Solove the following word problem, using code: Also, you can use the modulus operator to extract the rightmost digit or digits from a number. For example, x % 10 yields the rightmost digit of x (in base 10). Similarly x % 100 yields the last two digits. Think Java, Allan Downey, Green Tea Press Questions How is this error repaired? Can my code be simplified or consolidated (see comments)? Error message extRight.java:11: error: method extRight in class extRight cannot be applied to given types; int s = extRight(args); ^ required: int found: String[] reason: actual argument String[] cannot be converted to int by method invocation conversion 1 error My code class extRight { public static void extRight(int x) { x = x % 10; //initially tried `x % 10;` } public static void main(String[] args){ //initially the below was: extRight(args); //then: System.out.print(extRight(args)); int s = extRight(args); String o = Integer.toString(s); System.out.print(o); } }
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37009139
has answer: http://stackoverflow.com/a/24012076
has answer: http://stackoverflow.com/a/24012038
has answer: http://stackoverflow.com/a/24012020
downvote count: 1

http://stackoverflow.com/comment/37085440
has text: Thx. it works! One important attention to gradle users: In the tutorial http://docs.codehaus.org/display/SONAR/Coding+a+plugin about deployment is all about maven deployment, but when you create jar by gradle, don't forget customize MANIFEST.MF (see in the other plugins). Otherwise your plugin will not be found!
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23988474
type: AnswerComment

http://stackoverflow.com/a/38806026
answers question: http://stackoverflow.com/q/24074749
score: 3
upvote count: 3
downvote count: 0
has body: I solve my problem just adding @AutoConfigureTestDatabase(replace=Replace.NONE) @RunWith(SpringRunner.class) @DataJpaTest @AutoConfigureTestDatabase(replace=Replace.NONE) public class TestClienteRepository { }
type: Answer

http://stackoverflow.com/comment/37093489
type: AnswerComment
has text: if he don't remember the order he can always test it with `instanceof`
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24057222

logging
tags question: http://stackoverflow.com/q/24032423
tags question: http://stackoverflow.com/q/23951027
tags question: http://stackoverflow.com/q/23960081
tag name: logging
tags question: http://stackoverflow.com/q/24063233
tags question: http://stackoverflow.com/q/23998949
tags question: http://stackoverflow.com/q/24051421
tags question: http://stackoverflow.com/q/24084834
tags question: http://stackoverflow.com/q/24013133
tags question: http://stackoverflow.com/q/24066299
tags question: http://stackoverflow.com/q/24057258
tags question: http://stackoverflow.com/q/24041869
tags question: http://stackoverflow.com/q/24084179
tags question: http://stackoverflow.com/q/24048657
tags question: http://stackoverflow.com/q/24010070
type: Tag
tags question: http://stackoverflow.com/q/24075976
tags question: http://stackoverflow.com/q/23982872
tags question: http://stackoverflow.com/q/24063426
tags question: http://stackoverflow.com/q/24056891

http://stackoverflow.com/a/23986147
score: 1
has comment: http://stackoverflow.com/comment/36961090
upvote count: 1
has comment: http://stackoverflow.com/comment/37079177
accepted answer of: http://stackoverflow.com/q/23986080
answers question: http://stackoverflow.com/q/23986080
has comment: http://stackoverflow.com/comment/36960998
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36999196
downvote count: 0
has comment: http://stackoverflow.com/comment/37002886
has comment: http://stackoverflow.com/comment/36960909
has body: you need something like if (is_digit(c)) c = (char)('0' + (c - '0' + 5) % 10); else if (is_letter(c)) c = (char)('a' + (c - 'a' + 5) % 26);
type: Answer

http://stackoverflow.com/comment/37104313
score: 1
type: Comment
type: QuestionComment
has text: Did you try printing `pages` to see what value you passed into `Math.ceil()`? That would have immediately told you the problem was not with `Math.ceil()`.
comment on: http://stackoverflow.com/q/24062443

http://stackoverflow.com/comment/56100404
comment on: http://stackoverflow.com/a/34012175
has text: This does not answer the question at all. OP is asking for a local solution so he doesn't have to spend $$$ when running his Integration tests.....
type: Comment
score: 7
type: AnswerComment

http://stackoverflow.com/comment/37032277
type: QuestionComment
has text: @GriffeyDog How can I do that?
comment on: http://stackoverflow.com/q/24024228
score: 0
type: Comment

http://stackoverflow.com/a/24072440
downvote count: 0
answers question: http://stackoverflow.com/q/24072071
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37121940
has body: To display an Object, Swing components will use the toString() method the Object placed in it. One approach is to create a Data class that holds the name, ID, etc., implement toString() to display what you want (in your case, the Account Number), and then put a list of these objects in your JComboBox. Then on change of selection in the combo, get the selected item, cast it to the data class, and then call getDate(), getName(), etc. to populate the textfields. If you want to actually show the extra details of the Customer in the combo (after all, who really knows the person by account number?), then take a look at one approach here: DetailedComboBox
upvote count: 1

http://stackoverflow.com/comment/36956481
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23983410
score: 0
has text: Does the router even have to be told that he should route these packets? Since both PCs are in the subnet, I don't think the router filters something.

http://stackoverflow.com/a/28192770
has comment: http://stackoverflow.com/comment/44753177
score: -1
has body: you need to config the struts default filter dispatcher in the web.xml
answers question: http://stackoverflow.com/q/24057649
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/comment/36917347
score: 0
type: Comment
has text: This did not fix the issue, I did however find the console which gave me a hint, check the edit to the post
comment on: http://stackoverflow.com/a/23962638
type: AnswerComment

http://stackoverflow.com/a/24600059
score: 0
has body: The things are more simpler as it is. Download Blueprints GraphJung jar file and Jung jar libs Add it to lib of Orientdb Implement it as it decribed at Blueprint wiki
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24013197
answers question: http://stackoverflow.com/q/24013197

http://stackoverflow.com/q/24052241
upvote count: 0
tagged with: swing
type: Question
has title: java.lang.StringIndexOutOfBoundsException trying to filter with a jTextField
possible better answer: http://stackoverflow.com/a/24052284
has comment: http://stackoverflow.com/comment/37085843
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24052284
answer count: 3
has answer: http://stackoverflow.com/a/24052600
accepted answer: http://stackoverflow.com/a/24052600
downvote count: 1
has answer: http://stackoverflow.com/a/24052346
favorite count: 0
has body: i made a method that help me to filter rows of a jTable with what i write in a jTextField the problem is that when i try to write in the jTextField more than 8 letters it throws an error called... Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 9 at java.lang.String.substring(String.java:1907) at java.lang.String.substring(String.java:1907) at vocaciones.test_consulta.filtrar(test_consulta.java:338) at vocaciones.test_consulta.jTextField1KeyTyped(test_consulta.java:350) at vocaciones.test_consulta.access$000(test_consulta.java:21) at vocaciones.test_consulta$1.keyTyped(test_consulta.java:79) at java.awt.Component.processKeyEvent(Component.java:6460) at javax.swing.JComponent.processKeyEvent(JComponent.java:2828) at java.awt.Component.processEvent(Component.java:6282) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727) at java.awt.Component.dispatchEventImpl(Component.java:4731) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.se…
has comment: http://stackoverflow.com/comment/37084356
type: AnsweredQuestion

http://stackoverflow.com/comment/37085544
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24052791
has text: Using the class literal *loads* the class, but doesn't *initialize* it. For example, if you delete the class file for `SampleClass` before running the program, you'll get a failure as the class can't be loaded.

http://stackoverflow.com/a/24056800
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24052746
has body: Thank you all above for your answers and discussions. I thought the class will be loaded no matter using Class.forName() or MyClass.class, obviously I'm wrong. But I don't understand why it doesn't load the class when using MyClass.class.

http://stackoverflow.com/comment/37017341
score: 0
type: AnswerComment
has text: The motivation is that if I can keep this layer of abstraction i can make changes in a trasparent way for the customer that uses our platform just by replacing the database and changing the SPARQL endpoint. Otherwise I've to change the platform of the customer in order to match the changes to use the native Neo4J methods. We're exploring which one of this 2 ways is more convenient, but i've to do some tests in order to understand the pros and cons of one approch vs the other one.
comment on: http://stackoverflow.com/a/24013508
type: Comment

soa
type: Tag
tag name: soa
tags question: http://stackoverflow.com/q/24009377
tags question: http://stackoverflow.com/q/24025793
tags question: http://stackoverflow.com/q/23976797

http://stackoverflow.com/comment/36956095
has text: Ok, thanks for the tip. I added a brief explanation.
comment on: http://stackoverflow.com/a/23983479
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23981287
has comment: http://stackoverflow.com/comment/36951723
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36951762
type: Question
accepted answer: http://stackoverflow.com/a/23981379
score: -1
tagged with: concatenation
answer count: 1
has title: Java Strings Concatenation and Objects
has comment: http://stackoverflow.com/comment/36951648
tagged with: string
favorite count: 0
tagged with: string-pool
has body: How many objects will be created for the following code? String temp = "a" + "b" + "c" My understanding: a,b and c are string literals and will be stored on the string pool (so no new object created). Then while appending using "+" operator it uses StringBuffer internally so 1 object will be created which will hold "abc"(StringBuffer). And it will be returned in a new String object (Whose value will be "abc"). -> So as per me total 2 objects will be created during this operation.(one String and one StringBuffer). -> Also String "abc" will NOT be present in String Pool. Am I wrong?
has comment: http://stackoverflow.com/comment/36951475
has answer: http://stackoverflow.com/a/23981379
type: AnsweredQuestion

http://stackoverflow.com/comment/37156013
type: AnswerComment
has text: Pshemo - Thanks for the echo
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24090365

http://stackoverflow.com/comment/37000936
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/54960/discussion-between-thaz-ahammad-and-madprogrammer).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24007383

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/23997210
tags question: http://stackoverflow.com/q/24096748
tags question: http://stackoverflow.com/q/23960451

http://stackoverflow.com/comment/37160287
type: QuestionComment
type: Comment
has text: Stop after "Big Oh)" in your first paragraph and you nailed it. The N terms in your sum are from the N iterations of the outer loop, so don't multiply the sum by N. Good luck!
score: 2
comment on: http://stackoverflow.com/q/24092996

http://stackoverflow.com/a/23951292
score: 0
type: Answer
has body: The fact you need to ask the question what's happening here, means you should seriously consider using constructions like this in your code. Since in Java expressions are evaluated left to right (see here - 'Order of Evaluation' section). This is what happens step-by-step in case of b = a + (a = b).substring(0, 0) Populate a variable with its value: b = "abc" + (a = b).substring(0, 0); Populate b variable with its value: b = "abc" + (a = "def").substring(0, 0); Since first attribute of string concatenation (+) is already evaluated evaluate the second one, which starts with reassigning "def" to a. b = "abc" + "def".substring(0, 0); //Now a = "def" Run substring on "def" b = "abc" + "" Concatenate b = "abc" Reassign to b and now b = "abc" (while as we've shown before a has been reassigned to "def".
answers question: http://stackoverflow.com/q/23951020

http://stackoverflow.com/a/24022465
answers question: http://stackoverflow.com/q/24021582
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: For treating as a big unsigned number, a byte[] isn't an ideal solution, consider for example that for adding two of these numbers, you will have to loop over the two arrays, adding each byte (and the carry from the previous byte), then storing back the resulting byte somewhere. BigInteger internally represents the value in a manner suitable for the operations it provides, so its operations will very likely be at least as good as you can do with byte[]. A slight drawback in terms of performance might be that BigInteger is immutable. Performance wise, a simple, mutable holder object consisting of 4 long members would probably do best: My256BitNumber { long l0; long l1; long l2; long l3; public void add(My256BitNumber arg) { //... } } That would allow you to bypass overhead of object creation (due to being mutable), as well as any potential array access overhead (like array index bounds checks). But considering that none of the operations are trivial to implement, just make use of BigInteger. It combines reasonable performance, with reasonable simplicity of use, and most importantly - is a tested, working solution. If rolling your own implementation is worth it, depends on your use case. Considering you're asking if one could get better performance than BigInteger, the answer is, yes you can - BUT at severe expense in code complexity.

http://stackoverflow.com/comment/36943991
comment on: http://stackoverflow.com/q/23974249
type: Comment
type: QuestionComment
score: 2
has text: If you're interested here's a GAE sample with Spring Boot: https://github.com/scratches/spring-boot-sample-gae. Why you'd want to use XML is not really very clear, but note that there's nothing stopping you from using Spring Boot with XML either.

http://stackoverflow.com/comment/36990207
type: Comment
comment on: http://stackoverflow.com/a/24001125
type: AnswerComment
has text: this could be a comment, don't you think so?
score: 0

http://stackoverflow.com/comment/37053392
has text: @craftsman Cool! Thanks for the info. I will try the same method to see if it works for me.
comment on: http://stackoverflow.com/q/24023956
score: 0
type: Comment
type: QuestionComment

user-interface
tags question: http://stackoverflow.com/q/23983697
tags question: http://stackoverflow.com/q/24049309
tags question: http://stackoverflow.com/q/23983742
tags question: http://stackoverflow.com/q/23959505
tags question: http://stackoverflow.com/q/23998679
tags question: http://stackoverflow.com/q/24098269
tags question: http://stackoverflow.com/q/24026072
tags question: http://stackoverflow.com/q/23965255
tags question: http://stackoverflow.com/q/23989101
tags question: http://stackoverflow.com/q/24031383
tags question: http://stackoverflow.com/q/24050110
tags question: http://stackoverflow.com/q/23986079
tags question: http://stackoverflow.com/q/24093016
type: Tag
tags question: http://stackoverflow.com/q/24026633
tags question: http://stackoverflow.com/q/24099681
tags question: http://stackoverflow.com/q/24084102
tags question: http://stackoverflow.com/q/23949962
tags question: http://stackoverflow.com/q/24086607
tags question: http://stackoverflow.com/q/24047564
tags question: http://stackoverflow.com/q/24033525
tags question: http://stackoverflow.com/q/23946073
tags question: http://stackoverflow.com/q/23983278
tags question: http://stackoverflow.com/q/23951763
tags question: http://stackoverflow.com/q/23958935
tags question: http://stackoverflow.com/q/23962862
tags question: http://stackoverflow.com/q/23970044
tags question: http://stackoverflow.com/q/23976481
tags question: http://stackoverflow.com/q/23964120
tags question: http://stackoverflow.com/q/24021157
tags question: http://stackoverflow.com/q/24098386
tags question: http://stackoverflow.com/q/23986158
tags question: http://stackoverflow.com/q/24068785
tags question: http://stackoverflow.com/q/23985809
tags question: http://stackoverflow.com/q/24088850
tags question: http://stackoverflow.com/q/23945921
tags question: http://stackoverflow.com/q/24009159
tags question: http://stackoverflow.com/q/23963150
tags question: http://stackoverflow.com/q/24037083
tags question: http://stackoverflow.com/q/24049558
tags question: http://stackoverflow.com/q/24097948
tags question: http://stackoverflow.com/q/24039229
tag name: user-interface
tags question: http://stackoverflow.com/q/24095964
tags question: http://stackoverflow.com/q/23954665
tags question: http://stackoverflow.com/q/23944569
tags question: http://stackoverflow.com/q/23951802
tags question: http://stackoverflow.com/q/24043288
tags question: http://stackoverflow.com/q/23995566
tags question: http://stackoverflow.com/q/24104574
tags question: http://stackoverflow.com/q/24019444

http://stackoverflow.com/q/23988281
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36965488
has body: Date of Expire Feb 23, 2014 we want to collect the Expire date (Feb 23, 2014) from that above Html my xpath WebElement expDate = driver.findElement(By .xpath("//div[contains(@data-bind,'text:DateofExpire')]")).getText(); but while executing its produce empty, xpath was perfectly working and only getText() method not returning the value please suggest to collect the date value
tagged with: java
has answer: http://stackoverflow.com/a/23988316
type: Question
has comment: http://stackoverflow.com/comment/36964715
accepted answer: http://stackoverflow.com/a/23988316
score: 0
answer count: 1
tagged with: xpath
has title: value not getting from div

http://stackoverflow.com/comment/36986394
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23996799
has text: @gikarasojokinene Well, the question actually is: why do you think you need a possessive quantifier?
type: AnswerComment

http://stackoverflow.com/a/24007585
answers question: http://stackoverflow.com/q/24007478
score: 0
has body: By implementing WebApplicationInitializer. You can find more details about it here: http://docs.spring.io/spring/docs/3.1.x/javadoc-api/org/springframework/web/WebApplicationInitializer.html.
type: Answer

http://stackoverflow.com/q/24031417
has title: How to select a checkbox from a multiple select box using selenium webdriver in java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37059815
type: Question
has body: I have the below code for the multiple select box in the web page and I need to make a selection of any option group for the list using selenium webdriver AmaWaterways AmaSerena AmaPura Can somebody suggest how to select an option group of my choice?
has comment: http://stackoverflow.com/comment/37045503
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24050431
tagged with: selenium-webdriver

http://stackoverflow.com/q/23992253
has comment: http://stackoverflow.com/comment/37248124
upvote count: 4
has body: I've been asked by my company to learn Trigger Development for IBM® OpenPages® GRC Framework. I have read the Trigger Developer Guide provided by IBM. But it is more focused on only concepts but does not tell how to start (meaning setting a Development Environment). I have no idea where to start and there is no help on the internet. Any help how should I start learning trigger development.
has comment: http://stackoverflow.com/comment/37252841
score: 2
has comment: http://stackoverflow.com/comment/37253310
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24244844
has title: where to learn Trigger Development for IBM® OpenPages® GRC Framework
has comment: http://stackoverflow.com/comment/37252773
has comment: http://stackoverflow.com/comment/37025460
type: AnsweredQuestion
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/24244844
type: Question
tagged with: openpages

android-mediaplayer
tags question: http://stackoverflow.com/q/24049716
tag name: android-mediaplayer
tags question: http://stackoverflow.com/q/24078865
type: Tag
tags question: http://stackoverflow.com/q/24027959
tags question: http://stackoverflow.com/q/24076330

http://stackoverflow.com/comment/37115055
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24068539
has text: Generally, in JDK 1.6+, the compiler will change the ```+``` to use ```StringBuilder``` anyways.

css
tags question: http://stackoverflow.com/q/23983465
tags question: http://stackoverflow.com/q/24004668
tags question: http://stackoverflow.com/q/23997115
tags question: http://stackoverflow.com/q/23949687
tags question: http://stackoverflow.com/q/23961364
tags question: http://stackoverflow.com/q/23962433
tags question: http://stackoverflow.com/q/24074056
tags question: http://stackoverflow.com/q/24080025
type: Tag
tags question: http://stackoverflow.com/q/23945781
tags question: http://stackoverflow.com/q/23962606
tags question: http://stackoverflow.com/q/24079259
tags question: http://stackoverflow.com/q/24055319
tag name: css
tags question: http://stackoverflow.com/q/23964568
tags question: http://stackoverflow.com/q/23964490

http://stackoverflow.com/comment/37181251
has text: Use Prepared statement is what David is suggesting or someone can change the parameters (by special on screen values for text boxes) and do bad things to your data base. details at OWASP website https://www.owasp.org/index.php/SQL_Injection
score: 0
comment on: http://stackoverflow.com/q/24103462
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24104680
favorite count: 0
has body: This is my java code. import java.io.*; import java.util.*; import java.util.concurrent.TimeUnit; class search { private int numelem; private int[] input=new int[100]; public void setNumofelem() { System.out.println("Enter the total numebr of elements"); Scanner yz=new Scanner(System.in); numelem=yz.nextInt(); } public void randomnumber() throws Exception { int max=500,min=1,n=numelem; Random rand = new Random(); for (int j=0;j &lt; n;j++) { input[j]=rand.nextInt(max)+1; } } public void printinput() { int b=numelem,t=0; while(true) if(b!=0) { System.out.print(" "+input[t]); b--; t++; } else break; } } public class mycode { public static void main(String args[]) throws Exception { search a=new search(); a.setNumofelem(); a.randomnumber(); a.printinput(); } } Now the function randomnumber() just returns the same number.The function executes perfectly if I execute it as a separate java program but fails miserably if I call it using an object.I have also tried the following variations but nothing works everything return the same number. Variation 1: public void randomnumber() throws Exception { int max=500,min=1,n=numelem; Random rand = new Random(); for (int j=0;j &lt; n;j++) { TimeUnit.SECONDS.sleep(1); input[j]=rand.nextInt(max)+1; } } Variation 2: public void randomnumber() throws Exception { int max=500,min=1,n=numelem; Random rand = new Random(); for (int j=0;j &lt; n;j++) { rand.setSeed(System.nanoTime()); input[j]=rand.nextInt(max)+1; } } Variation 3: public void randomnumber() throws Exception { int max=500,min=1,n=numelem; Random rand = new Random(); for (int j=0;j &lt; n;j++) { TimeUnit.SECONDS.sleep(1); rand.setSeed(System.nanoTime()); input[j]=rand.nextInt(max)+1; } } Sample input/Output: Enter the number of elements: 5 23 23 23 23 23 23
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37183143
accepted answer: http://stackoverflow.com/a/24104716
tagged with: java
has comment: http://stackoverflow.com/comment/37183170
upvote count: 1
has title: Random generates same number in java
type: Question
has comment: http://stackoverflow.com/comment/37183163
score: -3
has comment: http://stackoverflow.com/comment/37183093
has comment: http://stackoverflow.com/comment/37183200
downvote count: 4
tagged with: random
answer count: 1
has answer: http://stackoverflow.com/a/24104716
has comment: http://stackoverflow.com/comment/37183119

http://stackoverflow.com/comment/36892485
has text: you need to override the toString() method as Innovation said and also try follow the naming conventions for methods, classes which is good for readability purpose.
comment on: http://stackoverflow.com/q/23949440
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24005184
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24005317
type: Question
has answer: http://stackoverflow.com/a/24005192
has title: Why has server socket to be opened before client socket?
score: 0
tagged with: client-server
has comment: http://stackoverflow.com/comment/36996999
has answer: http://stackoverflow.com/a/24005202
tagged with: connection
accepted answer: http://stackoverflow.com/a/24005695
tagged with: sockets
tagged with: android
possible better answer: http://stackoverflow.com/a/24005192
has body: I used socket programming in Java. I connected one pc and android tablet. Server is pc , client is tablet. When i start firstly tablet, socket cannot be connected. However, when i start firstly pc , socket can be connected. Why is this so ? where is the problem ? Pc code: ` btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Thread t = new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub ServerSocket listener = null; Socket socket = null; System.out.println("Opened"); try { listener = new ServerSocket(1515); } catch (IOException e1) { // TODO Auto-generated catch block System.out.println(e1.getMessage()); } String answer = null; while(true) { try { socket = listener.accept(); DataInputStream input = new DataInputStream(socket.getInputStream()); answer = input.readInt()+ " "; answer = answer + input.readInt(); input.close(); dName.setText(answer); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { socket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }); t.start(); ` Tablet code: @Override public void run() { // TODO Auto-generated method stub boolean check = false; while(!check) { try { check = InetAddress.getByAddress(new byte[] { (byte) 192, (byte) 168, 2, 86 }).isReachable(1000); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } while(!socket.isConnected()){ try { socket.connect(sockaddr, 1000); // DataInputStream input = // new DataInputStream(socket.getInputStream()); // int result = input.readInt(); // if(result == -2) // { // MainActivity.MainAct.StartUpdateActivity(); // } } catch (IOException e) { // TODO Auto-generated catch block //text.setText(e.getMessage()); System.out.println(e.getMessage()); }finally{ } } EDIT: The firt while , the check …
has answer: http://stackoverflow.com/a/24005695
answer count: 4

http://stackoverflow.com/q/24026380
has body: My application closes out just fine but the JVM never exits. I notice all threads show up as STATE = BLOCKED. ActiveMQ failover protocol potentially blocking indefinitely, but the thread dump does not seem to indicate that at all. The one other outlier is a thread that appears to be from a CA Wiley tool (Introscope) that is in the IN_NATIVE state. Any ideas what could cause this behavior? Thread dump can be found here.
tagged with: jvm
tagged with: application-shutdown
tagged with: introscope
favorite count: 0
type: Question
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/37076993
tagged with: activemq-classic
tagged with: java
has title: JVM hung on exit with all threads in BLOCKED state
upvote count: 0
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/37036444
has answer: http://stackoverflow.com/a/24027351

http://stackoverflow.com/q/24045626
linked to: http://stackoverflow.com/q/19918561
tagged with: java
has title: Request.getParameter java to vb.net
tagged with: httprequest
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/37073615
tagged with: asp.net
has answer: http://stackoverflow.com/a/24047737
type: UnansweredQuestion
has body: I have a question about retrieving data from a client who is using java and i am using vb.net. I am expecting a form posted to me and read the data. My issues is when i do Request.Form("DATA") i get nothing from the client. Now if i create a html form and post it to my url with the field "DATA" i can read everything fine. I can also loop through my form and see the field and the button if i right them out to the screen or to a text file. Code is below response.write(Request.Form("DATA")) OR Dim entryName As String For Each entryName In Request.Form response.write("Entity Name: " &amp; entryName) Next Either method above works fine for me but not for the client. When the client hits my page i see nothing at all no buttons no fields, nothing. I am concerned he is not posting properly to me. I spoke with the developer and he said he would retrieve the data on his end by doing something like "Request.getparameter" I do not know java at all but from what i read it sounds like "Request.getparameter" will grab any field out of a form or querysting that has the name specified aka my "DATA" field that i am looking for. Can anyone explain to me what request.getparameter means in java and what the equivalent code would be in vb.net? Again i do not know java at all and have searched on this for a while but cant quite find a definitive answer. Thanks in advance.
tagged with: request
tagged with: vb.net
has comment: http://stackoverflow.com/comment/37073389

http://stackoverflow.com/q/23979135
accepted answer: http://stackoverflow.com/a/23979744
has title: Hibernate exception java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.Date
has body: In our project we are facing exceptions with stack trace below. It happens sometimes during object merge (I can't reproduce it). I don't exactly know which object causes this error because lot of cascades. Environment does not matter, it occurs both in production and development environment. We use Hibernate 4.2.5.Final, Spring 3.2.2.RELEASE, Java 7, Tomcat 7. java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.util.Date at org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor.areEqual(JdbcTimestampTypeDescriptor.java:41) at org.hibernate.type.AbstractStandardBasicType.isEqual(AbstractStandardBasicType.java:205) at org.hibernate.type.AbstractStandardBasicType.isSame(AbstractStandardBasicType.java:195) at org.hibernate.type.AbstractStandardBasicType.isDirty(AbstractStandardBasicType.java:231) at org.hibernate.type.AbstractStandardBasicType.isDirty(AbstractStandardBasicType.java:227) at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:294) at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4037) at org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:527) at org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:234) at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:163) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:228) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:100) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) at org.springframework.orm.hibernate4.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:91) at org.springfram…
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36948386
upvote count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/36947923
score: -1
has answer: http://stackoverflow.com/a/23979744
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/37095297
type: Comment
score: 1
type: QuestionComment
has text: Can you please edit your question and include the definition of the TASK table? Also - have you checked TaskSQLMap.updateTask-InlineParameterMap to be certain that LONG wasn't accidentally used for a non-LONG column? (Remember - `LONG` in Oracle means something totally different than `long` in Java). Thanks.
comment on: http://stackoverflow.com/q/24055944

tcp
tags question: http://stackoverflow.com/q/23973844
type: Tag
tags question: http://stackoverflow.com/q/24061041
tags question: http://stackoverflow.com/q/24096710
tags question: http://stackoverflow.com/q/23956141
tags question: http://stackoverflow.com/q/24090529
tags question: http://stackoverflow.com/q/23974017
tags question: http://stackoverflow.com/q/23966640
tags question: http://stackoverflow.com/q/24003992
tags question: http://stackoverflow.com/q/24049748
tags question: http://stackoverflow.com/q/24038683
tags question: http://stackoverflow.com/q/24057965
tag name: tcp
tags question: http://stackoverflow.com/q/24015749

http://stackoverflow.com/comment/37073257
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24045737
has text: In fact the frames go down to 1 per second exactly according to my counter. Animations and keyinput are slow and only update once a second. It does get better when I kill the player (reload the image) a couple more times. Already tried running it with more memory or on a different OS but no result.

vonage
tags question: http://stackoverflow.com/q/24025988
type: Tag
tag name: vonage

http://stackoverflow.com/q/23951410
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/36897735
has comment: http://stackoverflow.com/comment/36899412
score: 6
type: Question
has answer: http://stackoverflow.com/a/23951638
tagged with: java
has title: How do I pass an array or list of values to Java via system properties - and how do I access it?
has comment: http://stackoverflow.com/comment/36899126
has comment: http://stackoverflow.com/comment/36896007
tagged with: environment-variables
tagged with: arrays
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23951638
favorite count: 0
has body: Is there a way to pass a list of values into Java, using only one system property? I'm thinking of something along the lines -DMY_LIST=val1,val2,val3 or -DMY_LIST={val1, val2} Any ideas? How would I access that in Java? Update: I initially asked for environment variables, but actually meant system properties. Similar principle, but quite different... I changed title and text accordingly now. Thanks, @serge-ballesta
upvote count: 6

http://stackoverflow.com/q/23952119
type: Question
type: AnsweredQuestion
has title: Can DeferredResult be used together with @ModelAttribute in Spring MVC 4?
has answer: http://stackoverflow.com/a/26768417
answer count: 1
downvote count: 0
tagged with: asynchronous
favorite count: 0
has body: I've just started working a bit with Spring MVC's DeferredResult annotation. In the documentation, it is clearly stated that DeferredResult can be used as a return type for @RequestMapping handler methods. I'm Currently using this feature to populate multiple model fields in parallel, and only calling setResult on the DeferredResult when all of the fields are ready. This works, but requires quite of bit of synchronization code. The documentation doesn't touch on the subject of whether returning a DeferredResult from a @ModelAttribute method is allowed. This would allow me to remove most of the synchronization boilerplate and let Spring worry about how to fit all of this together. Is it possible to return a DeferredResult from a method annotated with @ModelAttribute?
tagged with: spring-mvc
score: 2
accepted answer: http://stackoverflow.com/a/26768417
upvote count: 2
tagged with: java

http://stackoverflow.com/q/23976603
has comment: http://stackoverflow.com/comment/36942817
has title: String Compression in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/36943062
has answer: http://stackoverflow.com/a/23976665
has comment: http://stackoverflow.com/comment/36942812
has comment: http://stackoverflow.com/comment/36942908
upvote count: 2
type: UnansweredQuestion
has body: I have written a piece of code that compresses Strings of non numeric characters. for example "aabccccaaa" would compress to a2b1c4a3. I was wonder if the way I am accomplishing this has an efficient asymptotic run-time. Is there a more efficient way to accomplish? Code Provided Below: public static String Compress(String s) { if(s.length()&lt;=2) { return s; } int org_length=s.length(); String comp=""; int i=0; while(i&lt;org_length) { Integer lc=1; while(i+1&lt;org_length &amp;&amp; s.charAt(i)==s.charAt(i+1)) { lc++; i++; } if(i&gt;=org_length){ comp=comp+s.charAt(s.length()-1)+1; } else{ comp=comp+s.charAt(i)+lc.toString(); } i++; } if(s.length()&lt;=comp.length()) { return s; } return comp; }
downvote count: 1
tagged with: performance
has comment: http://stackoverflow.com/comment/36942798
tagged with: algorithm
linked to: http://stackoverflow.com/q/21899400
tagged with: java
duplicate of: http://stackoverflow.com/q/21899400
type: Question
has comment: http://stackoverflow.com/comment/36943834
answer count: 1
has comment: http://stackoverflow.com/comment/36942758
has comment: http://stackoverflow.com/comment/36942787
score: 1

http://stackoverflow.com/comment/37097424
type: AnswerComment
comment on: http://stackoverflow.com/a/24057065
type: Comment
has text: @wawanopoulos Have you find the problem or should i search for it?
score: 0

http://stackoverflow.com/comment/37190983
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23982687
has text: What am I doing wrong followed this exactly: http://stackoverflow.com/questions/9940381/how-to-generate-jni-header-file-in-eclipse but I get an error reported in the console and no header generated, Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: /home/simon/workspace/helloworldJava/bin
score: 0

http://stackoverflow.com/q/23964231
has body: I have a problem by programming an user interface. I am using Swing. I begin to create a Tabpane with 5 Tabs. Tab 1 contains: Button1 and a textarea Tab 2 contains: Button2 and a textarea Tab 3 contains: Button3 and a textarea Tab 4 contains: Button4 and Panel1 Tab 5 contains: Button5 and Panel2 This class MyClass implements the interface ActionListener and the method actionPerformed was overwritten like this (short version): public class MyClass implements ActionListener { // Creating UI ... and so on public void actionPerformed(ActionEvent e) { if (e.getSource() == button1) { //do something } // Exactly the same for button2 and button3 if (e.getSource() == button4) { panel1.repaint(); // PANEL 1 } if (e.getSource() == button5) { panel2.repaint(); // PANEL 2 } } } I have two classes Panel1 and Panel2, which extend the class JPanel. public class Panel1 extends JPanel { protected Panel1() { } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); //DRAW SOMETHING ON PANEL1 } } The class for Panel2 looks exactly like this class, but draws something on panel2. My problem is now: In MyClass i have created the UI and all components for it. This includes 5 buttons. On each of these 5 buttons i have called the method: buttonX.addActionListener( new MyClass() ); to do exactly what is defined in the actionPerformed() - method. If i add this ActionListener to button1-3 : Everything works fine. If i add this ActionListener to button1-4 (NOT 5) : button1-3 do what they should do and button4 repaints Panel1 correctly. If i add this ActionListener to button1-3 and 5 (NOT 4) : button1-3 do what they should do and button5 repaints Panel2 correctly. BUT if i add this ActionListener to button1-5 : button1-3 do what they should do and button5 repaints Panel2 correctly. BUT button4 does nothing!. So Panel1 was not repainted! Can somebody explain me, why button1-3 always work; button4 and button5 work, if i add the ActionListener to just ONE of theses two buttons…
type: Question
score: -2
has comment: http://stackoverflow.com/comment/36940556
has comment: http://stackoverflow.com/comment/36920503
has comment: http://stackoverflow.com/comment/36920536
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23964292
has comment: http://stackoverflow.com/comment/36920549
has comment: http://stackoverflow.com/comment/36920510
tagged with: panel
has answer: http://stackoverflow.com/a/23964504
favorite count: 0
has title: Repaint on two panels do not work on second panel
type: UnansweredQuestion
tagged with: repaint
tagged with: java
downvote count: 2
tagged with: panels
tagged with: swing

http://stackoverflow.com/comment/37130981
type: AnswerComment
has text: **A dependency added in pom.xml will download all jar files required for that entry** - can I use these dependies in my project ?
type: Comment
comment on: http://stackoverflow.com/a/24062143
score: 0

http://stackoverflow.com/comment/37145251
comment on: http://stackoverflow.com/q/24084745
type: Comment
type: QuestionComment
score: 0
has text: It is a goal in the pom.xml file. The JAR is put in the target directory along with the project's JAR. That is, the target directory then has project-0.7.jar and project-0.7-with-dependencies.jar and I'd like BOTH of these available via Jenkins's Maven repository.

http://stackoverflow.com/q/24049296
favorite count: 0
has comment: http://stackoverflow.com/comment/37084768
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43178983
score: 4
type: Question
has title: ERROR org.apache.zookeeper.ClientCnxn - Error while calling watcher
tagged with: java
upvote count: 4
tagged with: hadoop
tagged with: apache-zookeeper
has body: I am new to zookeeper. I have written simple program to create Persistent Node. Its working but giving exception once execution is completed.I tried to search on google but there is no satisfactory answer. Can any one advice me anything. public class ZkProg { public static void main(String[] args) throws IOException, KeeperException, InterruptedException { ZooKeeper zk=new ZooKeeper("localhost",1281, null); zk.create("/zookeeper/Names",new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); //zk.delete("/zookeeper/Names",-1); zk.close(); } }
answer count: 2
tagged with: znodes
tagged with: apache
has answer: http://stackoverflow.com/a/25374354
downvote count: 0

http://stackoverflow.com/a/24063882
has comment: http://stackoverflow.com/comment/37107114
has body: EDIT: As it was unclear whether this was Scala or Java earlier, I've revised my answer to work with Play Java. It appears that the templates work slightly different in Java, and the parenthesis around the if statement were messing things up. You don't really need the if statement anyway, as mapping an empty iterator will do nothing. This works: @flash.entrySet.iterator.map { key =&gt; &lt;div class="row"&gt; &lt;div class="large-12 columns"&gt; &lt;div class="alert-box radius @{key.getKey}" data-alert=""&gt; @{key.getKey.toUpperCase} &amp;mdash; @{key.getValue} &lt;a href="#" class="close"&gt;&amp;times;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; } And if you really want the if: @if(flash.size &gt; 0) { (above code) }
has comment: http://stackoverflow.com/comment/37121639
type: Answer
has comment: http://stackoverflow.com/comment/37110835
has comment: http://stackoverflow.com/comment/37105943
has comment: http://stackoverflow.com/comment/37106451
accepted answer of: http://stackoverflow.com/q/24063335
downvote count: 0
answers question: http://stackoverflow.com/q/24063335
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37106764

http://stackoverflow.com/comment/37114646
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24049113
has text: The OP asked about a sentence. I think all those characters are fair game. This isn't a phone number.
type: AnswerComment

http://stackoverflow.com/q/23957176
score: 0
answer count: 1
tagged with: adapter
has answer: http://stackoverflow.com/a/23957485
tagged with: filter
tagged with: android
has body: I'm trying to develop an app, and I'm quite stuck on this problem. I need to filter a list (made up of Libraries), in order to show whether they are open on the morning or not. I have a class for each library, in which there are two global boolean variable called "isMattina" (isMorning) and "isPomeriggio" ("isAfternoon"). I followed up some guides on the internet, and now my code looks like this: package com.matteocunsolo.apposto; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.os.Bundle; import android.os.Environment; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Filter; import android.widget.Filterable; import android.widget.ListView; import android.widget.AdapterView; import android.widget.Spinner; import android.widget.Toast; import com.matteocunsolo.apposto.IOFromFile; public class BiblioList extends Activity { private Spinner spinner1; public static Context context; public int length; public ArrayList&lt;String&gt; list; private Button btnSubmit; public boolean[] elencoOrari = TimeBooleanArray.create(); public Filter mioFiltro; public StableArrayAdapter adapter; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lista); setContext(); addListenerOnButton(); addListenerOnSpinnerItemSelection(); final ListView listview = (ListView) findViewById(R.id.listview); String filePath = Environment.getExternalStorageDirectory() + "/ApPosto/"; //InputStream is = getResources().openRawResource(R.raw.elenco_titoli); String[] values = IOFromFile.readTextFile(filePath + "elenco_Titoli.txt"); length = values.length; list = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; values.length; ++i) { list.add(values[i]); } adapter = n…
type: AnsweredQuestion
tagged with: list
accepted answer: http://stackoverflow.com/a/23957485
has title: How to implement adapters and to filter results in a lit?
type: Question
tagged with: java

http://stackoverflow.com/q/23967025
has title: File location listener in Java - Spring application
score: 0
has body: I have a Java - Spring application. I want to set up a feature to listen a file location(Folder) and has to process a file as a file get created in this folder. My plan is to set up a spring quartz cron job which will run in every five minutes and process the files available. Please suggest me a better approach.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36112245
tagged with: spring
has answer: http://stackoverflow.com/a/23976782
tagged with: spring-mvc
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36937760

http://stackoverflow.com/q/24089748
has answer: http://stackoverflow.com/a/24090129
tagged with: hashmap
tagged with: java
score: 0
tagged with: iterator
answer count: 2
has title: No Printed out Twice?
tagged with: println
has comment: http://stackoverflow.com/comment/37154349
has answer: http://stackoverflow.com/a/24089817
tagged with: io
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24089817
has body: I have the following program which is probably way more complicated than it need to be but is mirroring a Prolog program. I get the correct output which is No X = kian Yes F = [david] C = kian Yes No Except for that last No, I know that it has to do with if(pairs.getKey() == father conditonal and the looping of while(it.hasNext()) I just don't know why it's printing out No twice and how do I fix it? Is it because I call pairs.getKey() == father twice? import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import java.util.Iterator; public class family { public static void main(String [] args) { family obj = new family(); obj.family(); } public static int family(){ String[] male = new String[100]; String[] female = new String[100]; male[0] = "david"; male[1] = "kian"; female[0] = "anna"; female[1] = "sarah"; List&lt;String&gt; father = new ArrayList&lt;String&gt;(); father.add("david"); List&lt;String&gt; mother = new ArrayList&lt;String&gt;(); mother.add("sarah"); parent.put(mother, "kian"); parent.put(father, "kian"); Iterator it = parent.entrySet().iterator(); while(it.hasNext()){ Map.Entry pairs = (Map.Entry)it.next(); if(pairs.getKey() == father &amp;&amp; pairs.getValue() == "sarah"){ System.out.println("Yes"); }else{ if(pairs.getKey() == father){ System.out.println("F = " + pairs.getKey() + "\n" + "C = " + pairs.getValue() + "\n" + "Yes"); } System.out.println("No"); } if(pairs.getKey() == mother){ System.out.println("X = " + pairs.getValue() + "\n" + "Yes"); } it.remove(); } return 0; } }
possible better answer: http://stackoverflow.com/a/24090129
type: Question

http://stackoverflow.com/a/23963466
upvote count: 1
type: Answer
has body: Take a look in the official doc here http://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html You can use read(int n) or read(byte[], int, int)
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23963159

http://stackoverflow.com/a/24076922
accepted answer of: http://stackoverflow.com/q/24076757
score: 3
type: AcceptedAnswer
downvote count: 0
has body: The solution doesn't involve configuring Spring, but the hosts file of your operating system. On Ubuntu, it is found at /etc/hosts, I'm not sure if its the same for Fedora, but it should be. You just need to add a line in the hosts file that looks like the following: 127.0.0.1 myprojectName.com That's it. You then access the myprojectName.com address in your browser and it will look at your localhost, behind the scenes. The above solution works if you only need name resolution for your local machine. If you'd like to expand to your local or external network, the answer is less trivial: for your local network, you need to register a custom domain on your network DNS server (see this and this for more information); if you have a network administrator, direct this requirement to him, explaining that you want to expose your local ip through a custom domain name if you want to expose this name to the entire internet, you have to register the custom domain to a DNS registration service (you can find free DNS services as well, unfortunately I haven't used any lately and dyndns.org doesn't provide free dns service anymore, try searching free dns service on google and lookup some reviews)
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/24076757

bouncycastle
tags question: http://stackoverflow.com/q/24004143
tags question: http://stackoverflow.com/q/23965632
type: Tag
tag name: bouncycastle

http://stackoverflow.com/q/23975388
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23975456
has comment: http://stackoverflow.com/comment/36961137
score: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/36940447
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/44991351
tagged with: java
has body: Right now I have an image and I want to convert it into a BufferedImage... This is my code - private BufferedImage toBufferedImage(Image img, int width, int height){ // Create a buffered image with transparency BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); // Draw the image on to the buffered image Graphics bGr = bimage.getGraphics(); bGr.drawImage(img, 0, 0, null); bGr.dispose(); // Return the buffered image return bimage; } But it doesn't work. Can someone explain what's wrong?
tagged with: image
has title: How to convert Image into BufferedImage
tagged with: graphics
downvote count: 0

http://stackoverflow.com/comment/37112706
has text: private ArrayList arrayButton = new ArrayList (); it looks like now:android.widget.Button{some text and last is #2} and this 2 value i want. How to refer to them now ? for example i want to multiply two values from this array
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24067241

http://stackoverflow.com/comment/37035759
type: Comment
comment on: http://stackoverflow.com/a/24025301
score: 0
type: AnswerComment
has text: @TryingToCode you can access it like: `for(int i=0; i<vehicleList.size(); i++){ if (vehicleList.get(i).getName().equals("[fastcarname]")) vehicleList.get(i).PowerOn()}`

http://stackoverflow.com/a/23995782
has comment: http://stackoverflow.com/comment/36985827
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36998214
has body: Chapter 17 reasons about concurrent code in terms of happens before relationships. In your example, if you take two random threads then there is no happens-before relationship between this.value = initialValue; and result = value;. So if you have something like: T1.start(); T2.start(); ... T1: L = new PlainSimpleAtomicLong(42); T2: long value = L.get(); The only happens-before (hb) relationships you have (apart from program order in each thread) is: 1 &amp; 2 hb 3,4,5. But 4 and 5 are not ordered. If however T1 called L.get() before T2 called L.get() (from a wall clock perspective) then you would have a hb relationship between unlock() in T1 and lock() in T2. As already commented, I don't think your proposed code could break on any combination of JVM/hardware but it could break on a theoretical implementation of the JMM. As for your suggestion to wrap the constructor in a lock/unlock, I don't think it would be enough because, in theory at least, T1 could release a valid reference (non null) to L before running the body of the constructor. So the risk would be that T2 could acquire the lock before T1 has acquired it in the constructor. There again, this is an interleaving that is probably impossible on current JVMs/hardware. So to conclude, if you want theoretical thread safety, I don't think you can do without a volatile long value, which is how AtomicLong is implemented. volatile would guarantee that the field is initialised before the object is published. Note finally that the issues I mention here are not due to your object being unsafe (see @BrettOkken answer) but are based on a scenario where the object is not safely published across threads.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36997504
has comment: http://stackoverflow.com/comment/36988610
accepted answer of: http://stackoverflow.com/q/23984043
downvote count: 0
has comment: http://stackoverflow.com/comment/36998184
answers question: http://stackoverflow.com/q/23984043
has comment: http://stackoverflow.com/comment/36997360
has comment: http://stackoverflow.com/comment/37017542
has comment: http://stackoverflow.com/comment/37017459
has comment: http://stackoverflow.com/comment/36997433
score: 4

http://stackoverflow.com/q/23975047
type: UnansweredQuestion
tagged with: macos
has comment: http://stackoverflow.com/comment/36939641
answer count: 0
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/36939722
type: Question
tagged with: native
has title: Natives broken on Mac
tagged with: java
has body: About a month ago I used a MacBook for doing my programming, and LWJGL could load the natives perfectly fine, no problems. Today I loaded up the same laptop again and the natives refuse to load with Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /Users/kenzietogami/Dropbox/&lt;project name redacted&gt;/./lib/natives/liblwjgl.dylib. This also happens for Minecraft, so it's not isolated to my project. The project works fine for Windows as well. What could be causing this native loading failure?
score: 0
has comment: http://stackoverflow.com/comment/36939661

http://stackoverflow.com/comment/36970719
type: AnswerComment
score: 0
type: Comment
has text: @T.J.Crowder It does annoy me when developers say `Never use double for money` when you end up with a cluster of six servers doing the job of less than half of one. (this is a real case I am dealing with at the moment) Using C# `decimal`, as the case may be, has effectively preventing the software from expanding/being extended for many years because they couldn't justify more machines, which wouldn't have been required in the first place.
comment on: http://stackoverflow.com/a/23990875

http://stackoverflow.com/comment/36969429
type: QuestionComment
type: Comment
score: 1
has text: well the top of the json is a jsonobject node not a jsonarray. your parsing is wrong
comment on: http://stackoverflow.com/q/23990887

http://stackoverflow.com/comment/36931324
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23969718
has text: Can you suggest how to use `read()` with `FileWriter`? Thanks in advance.

http://stackoverflow.com/comment/37140773
has text: "public class StudentActivity extends Fragment" That can't be right.
comment on: http://stackoverflow.com/q/24082950
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23945259
accepted answer of: http://stackoverflow.com/q/23945234
type: AcceptedAnswer
downvote count: 0
has body: Just looking at the printNeatly method: You get the length of the array like this: int n = inputLineLengths.length; But in your loops, you go up to and including n: for (int i=1; i &lt;= n; i++) { You need to stop just before, because arrays (in Java) are indexed from 0 to n-1 (so it's also very likely that you mean to start your arrays from 0, and not 1) for (int i=1; i &lt; n; i++) {
type: Answer
has comment: http://stackoverflow.com/comment/36885223
answers question: http://stackoverflow.com/q/23945234
upvote count: 1
has comment: http://stackoverflow.com/comment/36885183
score: 1

http://stackoverflow.com/q/24038170
favorite count: 0
tagged with: serialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24038609
has comment: http://stackoverflow.com/comment/37100499
score: 1
tagged with: java
tagged with: gson
has title: Gson generic collection of interface
type: Question
answer count: 1
upvote count: 1
has body: I have the following method with Serializable as a self-defined interface: private &lt;T extends Synchronizable&gt; Collection&lt;T&gt; deserialize(String json, Class&lt;T&gt; type) { Type collectionType = new TypeToken&lt;ArrayList&lt;T&gt;&gt;(){}.getType(); return new Gson().fromJson(json, collectionType); } This method is not working properly since Gson expects the type token to be of a specific generic type, e.g. Type collectionType = new TypeToken&lt;ArrayList&lt;Group&gt;&gt;(){}.getType(); (while Group implements Serializable). Does anybody know a solution for this problem, or am I not able to use generic methods at this place, which would be awkward.
downvote count: 0
tagged with: deserialization
tagged with: generics

http://stackoverflow.com/a/24077566
downvote count: 0
type: AcceptedAnswer
has body: in case of webdriver public boolean isAlertPresent(){ try{ driver.switchTo().alert(); return true; }catch (NoAlertPresentException e){ return false; } }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24067212
accepted answer of: http://stackoverflow.com/q/24067212

http://stackoverflow.com/q/24028314
has answer: http://stackoverflow.com/a/24028535
has comment: http://stackoverflow.com/comment/37040276
score: 0
tagged with: java
tagged with: mysql
type: Question
has title: Database search using servlets and jsps
tagged with: servlets
has body: I am learning java servlets and trying to write a program that asks the user to enter a name ,and lists all the rows with the matching name in the db. My problem is, I am storing the user given value in the setter method of a bean class from my controller class. However, I am not able to retrieve it from dao class. Not getting any exceptions or errors, the code is not producing any results. Any help would be appreciated. Controller Class: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); SearchDataHolder sch = new SearchDataHolder(); String fname = (String) request.getParameter("fname"); String lname = (String) request.getParameter("lname"); String email = (String) request.getParameter("email"); sch.setFname(request.getParameter("fname")); sch.setLname((String) request.getParameter("lname")); sch.setEmail((String) request.getParameter("email")); if (((fname).isEmpty()) &amp;&amp; ((lname).isEmpty()) &amp;&amp; (((email).isEmpty() ))) { response.sendRedirect("BlankError.jsp"); return; } else { RequestDispatcher rd = request .getRequestDispatcher("SearchList.jsp"); rd.forward(request, response); return; } Dao Class: Connection con = ConnectionUtils.createConnection(); PreparedStatement ps; List&lt;SearchDataHolder&gt; users = new ArrayList&lt;SearchDataHolder&gt;(); SearchDataHolder sdh = new SearchDataHolder(); String firstName = sdh.getFname(); String lastName = sdh.getLname(); String email = sdh.getEmail(); try { String userList = "select * from Personal_Info where Fname='" + firstName + "' or Lname='" + lastName + "' or Email='" + email + "'"; ps = con.prepareStatement(userList); ResultSet rs = ps.executeQuery(); while (rs.next()) { sdh.setFname((String) rs.getString("Fname")); sdh.setLname((String) rs.getString("Lname")); sdh.setMname((String) rs.getString("Mname")); sdh.setSex(rs.getString("Sex")); sdh.setDob((String) rs.getString("Date")); sdh.setEmail((St…
answer count: 1
has comment: http://stackoverflow.com/comment/37040053
tagged with: jsp
has comment: http://stackoverflow.com/comment/37040263
has comment: http://stackoverflow.com/comment/37040315
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37040287

http://stackoverflow.com/comment/37051385
has text: pass the array in the constructor and initialize the fields to the respective values inside the constructor
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24034636

http://stackoverflow.com/q/24085674
tagged with: synchronization
has comment: http://stackoverflow.com/comment/44224432
has title: Spurious ConcurrentModificationException
has answer: http://stackoverflow.com/a/24086022
has comment: http://stackoverflow.com/comment/37146609
upvote count: 2
linked to: http://stackoverflow.com/q/223918
possible better answer: http://stackoverflow.com/a/24086052
downvote count: 1
has comment: http://stackoverflow.com/comment/37146770
has body: I'm having some issues with a piece of java code which keeps triggering a ConcurrentModificationException. I can't really figure out what is going on, this is a fairly simple static class, not sure why it would be throwing this exception as everything is synchronized. This piece of code has been heavily used for several years, so it's odd that it would start having issues at this point: java.util.ConcurrentModificationException at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:953) at java.util.LinkedList$ListItr.next(LinkedList.java:886) at DataSubscriptionManager.sendMessages(DataSubscriptionManager.java:18) private static HashMap&lt;DataClass,LinkedList&lt;DataSubscriber&gt;&gt; subscriberMap = new HashMap(); public static void sendMessages(LinkedList messages, DataClass dataClass) { synchronized (subscriberMap) { LinkedList&lt;DataSubscriber&gt; subscribers = subscriberMap.get(dataClass); if (subscribers != null) { for (DataSubscriber sub: subscribers) { *** EXCEPTION HAPPENS HERE*** if (sub != null) { sub.sendMessages(messages); } } } } } public static void addDataSubscriber(DataSubscriber sub, DataClass dataClass) { synchronized (subscriberMap) { LinkedList&lt;DataSubscriber&gt; subscribers = subscriberMap.get(dataClass); if (subscribers == null) { subscribers = new LinkedList(); subscriberMap.put(dataClass,subscribers); } while (subscribers.remove(sub)) {} subscribers.add(sub); } } public static void removeDataSubscriber(DataSubscriber sub, DataClass dataClass) { synchronized (subscriberMap) { LinkedList&lt;DataSubscriber&gt; subscribers = subscriberMap.get(dataClass); subscribers.remove(sub); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37146655
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/1655362
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/57633478
has answer: http://stackoverflow.com/a/24086052
favorite count: 0
has comment: http://stackoverflow.com/comment/60157206
accepted answer: http://stackoverflow.com/a/24086022
tagged with: concurrentmodification

http://stackoverflow.com/comment/36919704
type: AnswerComment
comment on: http://stackoverflow.com/a/23960606
type: Comment
has text: Oops! This seems break everything. Split ""\t\t\t \r\n \n" gives me 3 and "\r\n" gives me 2, which is even more confusing...
score: 0

http://stackoverflow.com/q/23953272
has comment: http://stackoverflow.com/comment/36903446
has title: Nashorn. Binding native Java objects?
has answer: http://stackoverflow.com/a/24078133
score: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24078133
tagged with: java-8
has body: I'd like to put native Java objects into the ScriptEngine bindings for easier access. I mean to avoid lots of Java.type(...). I tried in that way. jsEngine.getContext().getBindings(ScriptContext.ENGINE_SCOPE).put("manager", Manager.getInstance()); But that's failed with error "Manager has no such function "funcName" in eval...". Is it possible at all? UPD: Example code public class ManagerClass { public void test() { System.out.println("Hello"); } public static void test2() { System.out.println("Hello Static"); } } public class NewClass { public static void main(String[] args) throws ScriptException { final ScriptEngine s = new ScriptEngineManager().getEngineByExtension("js"); s.getBindings(ScriptContext.ENGINE_SCOPE).put("manager", new ManagerClass()); s.eval("manager.test(); manager.test2();"); } }
type: Question
tagged with: nashorn
has comment: http://stackoverflow.com/comment/36907989
tagged with: java
tagged with: javascript
upvote count: 4
has comment: http://stackoverflow.com/comment/36908142
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36907963
favorite count: 0
has comment: http://stackoverflow.com/comment/36900704

http://stackoverflow.com/q/23978822
tagged with: bytebuffer
has body: Say the Selector just told me there was a read event ready. First thing I do is allocate a ByteBuffer... on the same thread as my selected keys Iterator. if this ByteBuffer was big enough (i would be using up to 4096 bytes in this case) would this significantly slow down my selection process? Please discuss both direct and heap based ByteBuffers.
has title: Allocation of a ByteBuffer on the same thread as the selection process
type: Question
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23978935
type: UnansweredQuestion
tagged with: nio

http://stackoverflow.com/q/24085403
has answer: http://stackoverflow.com/a/24088058
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/37146697
tagged with: android
favorite count: 0
upvote count: 2
score: 0
answer count: 2
downvote count: 2
has title: Despite using android-support-v7-appcompat library, Action bar is working wrong with android 2.2
has comment: http://stackoverflow.com/comment/37146582
has answer: http://stackoverflow.com/a/26612518
has comment: http://stackoverflow.com/comment/37145547
has body: I have used actionbarcompat in programming. Also I've added android-support-v7-appcompat library. Unfortunately action bar display as bellow (Items doesn't appear) : please say right way. this is my menu.xml code: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ActionBar2="http://schemas.android.com/apk/res-auto"&gt; &lt;item android:id="@+id/action_search" android:orderInCategory="100" ActionBar2:showAsAction="always" android:title="Search"/&gt; &lt;item android:id="@+id/action_copy" android:orderInCategory="100" ActionBar2:showAsAction="always" android:title="Copy"/&gt; &lt;item android:id="@+id/action_share" android:orderInCategory="100" ActionBar2:showAsAction="always" android:title="Share"/&gt; &lt;item android:id="@+id/action_share" android:orderInCategory="100" ActionBar2:showAsAction="always" android:title="Hossein"/&gt; &lt;/menu&gt;
tagged with: java
linked to: http://stackoverflow.com/q/23720815
has comment: http://stackoverflow.com/comment/37145548

http://stackoverflow.com/comment/37132877
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24078587
has text: read more here [java timer and socket problem](http://stackoverflow.com/questions/2673045/java-timer-and-socket-problem?rq=1)
score: 0

http://stackoverflow.com/a/24054324
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24054132
upvote count: 1
has body: With your string, this will work: String[] yourArray = subjectString.split("^\\s+|\\s{2,}"); See the output at the bottom of the online demo. How does this work? It looks like your tokens are separated by multiple places. This is what we will use to split: \s{2,} In addition, we want to remove any spaces at the beginning of the string, so we add this to the split conditions: ^\s+

http://stackoverflow.com/a/24035168
has comment: http://stackoverflow.com/comment/37052811
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24035055
type: Answer
has body: a quick and dirty way to do it, if it's open source, would be to throw an exception in the "deepest" function that's in the call chain, then just catch it and use printStackTrace; or make it a RuntimeException and you don't even have to catch it, just run the program once and the callstack will be printed for you.

http://stackoverflow.com/q/24061422
answer count: 2
upvote count: 1
score: -6
has comment: http://stackoverflow.com/comment/37101173
favorite count: 0
tagged with: android
has title: Disable notifications from other apps
has comment: http://stackoverflow.com/comment/37101132
has body: i want to disable notifications coming from other apps like Facebook and other apps. I know it is possible because the Notifications Off app has this functionality.
type: AnsweredQuestion
downvote count: 7
type: Question
linked to: http://stackoverflow.com/q/3595232
possible better answer: http://stackoverflow.com/a/24131743
has answer: http://stackoverflow.com/a/24079046
tagged with: java
accepted answer: http://stackoverflow.com/a/24079046
has comment: http://stackoverflow.com/comment/37103112
has answer: http://stackoverflow.com/a/24131743

http://stackoverflow.com/q/24021344
has comment: http://stackoverflow.com/comment/37026564
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24021429
has title: How to split only digits from a string
type: UnansweredQuestion
tagged with: regex
tagged with: java
has comment: http://stackoverflow.com/comment/37026599
downvote count: 1
type: Question
tagged with: split
answer count: 2
has body: I have random strings that include 6 integers example: 002500bla 025478blu 255699bli 658896blo How can I split only the integers from the string in way to have only bla blu bli blo I need to do that using string.split(); I tried: int [] test = new int [7]; string.split (test); But it doesn't give any output. Where am I wrong?
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/24021480

http://stackoverflow.com/comment/36980246
comment on: http://stackoverflow.com/a/23990073
has text: I'm not sure about that. May I ask why you need such a second constructor ? As a workaround, can you retrieve that `n` value (passed in the secod constructor) from a service bean injected in the resource with `@Inject` ?
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/23945172
answers question: http://stackoverflow.com/q/23945023
score: 0
type: AcceptedAnswer
has body: It appears that you are using Swing for your graphics. Although actually providing code for your question would be a rather complex task, I will try to guide you in the correct direction. It might be best to encapsulate the rectangles (or ovals) into their own classes. Give the objects a method like drawSelf(Graphics g) and pass in the Graphics object. Also, give the classes fields to keep track of their current positions and sizes. Then, for collisions, you might try making a class along the lines of a CollisionDetector. All of your shape objects would have-a CollisionDetector, and everytime a shape moves you ask all shapes to check with their CollisionDetectors, which in turn check all other Detectors to see if they overlap.
type: Answer
accepted answer of: http://stackoverflow.com/q/23945023

http://stackoverflow.com/q/24098202
has body: Hi so after some searching still not found an answer but i would like to get a single element of a webpage to a String Variable. I know how to do this in C but would like to know in java eg: document.nav(the webpage) String value = document.getElementbyid(theid) Thanks so eg: some webpage has the value i want and i need to get that value from the webpage into a String variable
type: Question
has comment: http://stackoverflow.com/comment/95024460
downvote count: 0
tagged with: controls
accepted answer: http://stackoverflow.com/a/24098487
has title: Java get single element from webpage
tagged with: element
answer count: 1
tagged with: web
favorite count: 0
has comment: http://stackoverflow.com/comment/37169923
linked to: http://stackoverflow.com/q/24772828
upvote count: 1
has answer: http://stackoverflow.com/a/24098487
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/23989754
accepted answer of: http://stackoverflow.com/q/23988717
has body: The simplest way to prevent any response is to use &lt;outbound-channel-adapter&gt; - one-way service-invoker. But I guess you use &lt;int-ws:outbound-gateway&gt; and there is no &lt;outbound-channel-adapter&gt; on the matter. In this case you can just emulate the same using reply-channel="nullChannel". It should be enough.
answers question: http://stackoverflow.com/q/23988717
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/a/24099459
has comment: http://stackoverflow.com/comment/37172442
has comment: http://stackoverflow.com/comment/37172240
has body: Instead of using the InputStream to set the input, what you need is to pass InputStreamReader to the setInput sample: xpp.setInput(new InputStreamReader(obinputStreamj)); is -> string BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) { total.append(line); }
answers question: http://stackoverflow.com/q/24099361
score: 0
type: Answer

http://stackoverflow.com/q/24078317
has title: Get directory from classpath (getting a file now)
accepted answer: http://stackoverflow.com/a/24079781
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37133649
favorite count: 0
has comment: http://stackoverflow.com/comment/37132683
has comment: http://stackoverflow.com/comment/37133364
has body: I want to search for files in a directory. Therefore I want to get the directory in a File object but i'm getting a file instead of a directory. This is what I'm doing, it prints false but I want it to be true. URL url = getClass().getResource("/strategy/viewconfigurations/"); File folder = new File(url.toString()); System.out.println(folder.isDirectory()); How can I load this way a directory?
has comment: http://stackoverflow.com/comment/37139932
has answer: http://stackoverflow.com/a/24079781
has answer: http://stackoverflow.com/a/54782980
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/54782980
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37132380

http://stackoverflow.com/comment/36888979
has text: The first quick thought that comes to mind is to put a try-catch around the parse call and continue if an exception occurs. This isn't ideal but it's a thought. Are the headers the first line that comes in? If so, you could keep a line count and skip line 0 in your loop.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23947030
type: Comment

http://stackoverflow.com/q/23974009
tagged with: swing
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36937479
score: 1
tagged with: java
tagged with: jpanel
tagged with: draw
linked to: http://stackoverflow.com/q/7229226
tagged with: jscrollpane
answer count: 1
has answer: http://stackoverflow.com/a/23974063
favorite count: 0
has title: Painting on a JPanel inside a JScrollPane doesn't paint in the right location
linked to: http://stackoverflow.com/q/23701688
has body: So I have a JPanel that's inside a JScrollPane. Now I am trying to paint something on the panel, but it's always in same spot. I can scroll in all directions but it's not moving. Whatever I paint on the panel does not get scrolled. I already tried: A custom JViewPort switching between Opaque = true and Opaque = false Also I considered overriding the paintComponent method of the panel but that would be really hard to implement in my code. public class ScrollPanePaint{ public ScrollPanePaint() { JFrame frame = new JFrame(); final JPanel panel = new JPanel(); panel.setPreferredSize(new Dimension(1000, 1000)); //I tried both true and false panel.setOpaque(false); JScrollPane scrollPane = new JScrollPane(panel); frame.add(scrollPane); frame.setSize(200, 200); frame.setVisible(true); //To redraw the drawing constantly because that wat is happening in my code aswell because //I am creating an animation by constantly move an image by a little new Thread(new Runnable(){ public void run(){ Graphics g = panel.getGraphics(); g.setColor(Color.blue); while(true){ g.fillRect(64, 64, 3 * 64, 3 * 64); panel.repaint(); } } }).start(); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new ScrollPanePaint(); } }); } } The mistake I make is probably very easy to fix, but I just can't figure out how.
upvote count: 2
accepted answer: http://stackoverflow.com/a/23974063
has comment: http://stackoverflow.com/comment/36949455

http://stackoverflow.com/comment/53334492
type: QuestionComment
type: Comment
score: 0
has text: I appreciate you compiling all the above information! Thanks!
comment on: http://stackoverflow.com/q/24028410

http://stackoverflow.com/a/24054650
type: AcceptedAnswer
downvote count: 0
has body: If you have two different constructors, this is very different question from this that you are asking here. In this case the default constructor (without arguments) will be called when HelloBean gets instantiated. To inject a bean instance using arguments you have to use a producer method which will instantiate HelloBean. More info can be found here and here.
accepted answer of: http://stackoverflow.com/q/24034974
answers question: http://stackoverflow.com/q/24034974
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37089380
upvote count: 2
has comment: http://stackoverflow.com/comment/37104060
has comment: http://stackoverflow.com/comment/37100598

http://stackoverflow.com/a/23955926
answers question: http://stackoverflow.com/q/23955836
has body: String location = "C:\\user\\Desktop\\dir1\\dir2\\"; File file = new File(location + "filename.txt");
score: 0
type: Answer

http://stackoverflow.com/q/23982939
score: 0
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36954957
accepted answer: http://stackoverflow.com/a/23983367
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/36954841
has comment: http://stackoverflow.com/comment/36954991
tagged with: encoding
answer count: 1
tagged with: unicode
has body: I first used Spark framework and ORMLite to process data submitted in a form on web page, and I saw the unicode problem when submitting Chinese characters. I first thought the problem may be due to ORMLite, because the charset of my MySQL database has been set to use utf8_general_ci. So I tried the same form submission with the same MySQL data table by using Ninja framework, however, the same problem happens. The Chinese characters turn out to be "?????" (a string of question marks in the database field). In my toy program, I have a model class named "Book", which has three instance variables: Long id; String author; String title; Accordingly, the html form has only two input fields: author and title. I wrote the following method in my BookDAO class and use Hibernate to persist the data into MySQL: @Transactional public boolean postBook(String author, String title) { EntityManager entityManager = entityManagerProvider.get(); Book book = new Book(author, title); entityManager.persist(book); return true; } I have tried to change the charset of mysql to gbk (Chinese character encoding), but still have no luck of getting it to work. Another thing I've noticed is that the encoding errors only happen on my Ubuntu server, but not on my Mac server. This made me think what differences in these two OS's causes my problem with MySQL.
has answer: http://stackoverflow.com/a/23983367
has title: MySQL unicode error with java web frameworks (Ninja, and Spark framework)
type: AnsweredQuestion

http://stackoverflow.com/comment/61725402
score: 0
type: AnswerComment
has text: Metaspace definitely does **not** go to swap (testing it on Java 8u60 on Linux 64bit). On a leak it can push everything else to swap, crawling a machine to a halt.
type: Comment
comment on: http://stackoverflow.com/a/24074533

http://stackoverflow.com/comment/41593948
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24032510
has text: @gaurav001 we cannot start server as debug when jvm.options file of the server already configured -agentlib:jdwp parameter for JVM debugging agent. We can 'Start' the server instead and change to create a 'Remote Java Application' of Debug category launching profile instead and let it attach to port 10777 of the server, or you can change prepend -D at head of -agentlib:jdwp parameter of jvm.options file and then we can 'Debug' a server directly.

http://stackoverflow.com/comment/36992688
score: 0
type: Comment
has text: What if I told you that you can do b) using 2 jars and less time.
comment on: http://stackoverflow.com/a/24002772
type: AnswerComment

http://stackoverflow.com/q/24025065
downvote count: 0
favorite count: 0
has title: Elastic Search TransportClient
accepted answer: http://stackoverflow.com/a/24030156
tagged with: elasticsearch
has answer: http://stackoverflow.com/a/24034789
upvote count: 6
type: AnsweredQuestion
has body: I am using ElasticSearch Java client to query elastic search. I am initializing transport client every time I have to make a call. Is this the right way or should I initialize once during the start of the application and close it at shutdown. Following is the code to initialize client Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", Config.getEsClusterName()).put("client.transport.ignore_cluster_name", true).build(); Client esClient = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(Config.getEsHost(), Config.getEsPort()));
tagged with: java
possible better answer: http://stackoverflow.com/a/24034789
has answer: http://stackoverflow.com/a/42343533
type: Question
has answer: http://stackoverflow.com/a/24030156
score: 6
answer count: 3

http://stackoverflow.com/comment/36890963
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23948222
type: Comment
has text: In your code, you use `tree.put("first", 12")`. This means you know at which position it is. To use it with my code, define `heights` as `int[] heights = {12,19,10,22,5,16}`

http://stackoverflow.com/q/24050897
score: 0
tagged with: android
answer count: 1
has title: two ListView not working on NavigationDrawer
has body: I have two ListView in my NavigationDrawer, both of them is displayed on my NavigationDrawer, but I face a problem, when user want to click an item from one ListView, it does't work, this is how I call setOnItemClickListener from my ListView: list_terbaru=(ListView)findViewById(R.id.list_terbaru); list_terkirim=(ListView)findViewById(R.id.list_terkirim); list_terbaru.setOnItemClickListener(new SlideMenuClickListener()); list_terkirim.setOnItemClickListener(new SlideMenuClickListener()); private class SlideMenuClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position, long arg3) { switch (v.getId()) { case R.id.list_terbaru: id=((TextView)v.findViewById(R.id.nomor_registrasi)).getText().toString(); a=id; ModelHelper.onModel(me); getFragmentManager().beginTransaction().replace(R.id.frame_container,new PemegangPolis()).commit(); selectItem(position); break; case R.id.list_terkirim: id=((TextView)v.findViewById(R.id.no_polis)).getText().toString(); a=""; ModelHelper.onModel(me); getFragmentManager().beginTransaction().replace(R.id.frame_container,new PemegangPolis()).commit(); selectItembaru(position); } } } private void selectItem(int position) { ModelHelper.onModel(me); ModelHelper.onRetrieve(helper,id,me,position,model,SelectPemegang,SelectTertanggung,SelectUA,SelectDi,SelectDA,SelectDP); getFragmentManager().beginTransaction().replace(R.id.frame_container,new PemegangPolis()).commit(); // helper.close();selectItem mDrawerLayout.closeDrawer(SlidingMenu); } private void selectItembaru(int position) { ModelHelper.onModel(me); ModelHelper.onRetrieve(helper,id,me,position,model2,SelectPemegang,SelectTertanggung,SelectUA,SelectDi,SelectDA,SelectDP); getFragmentManager().beginTransaction().replace(R.id.frame_container,new PemegangPolis()).commit(); // helper.close();selectItem mDrawerLayout.closeDrawer(SlidingMenu); } so my question, is it possible to call 'onItemClick' with switch (v.getId())?…
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: navigation-drawer
has answer: http://stackoverflow.com/a/24051018
accepted answer: http://stackoverflow.com/a/24051018
tagged with: listview

http://stackoverflow.com/comment/37106352
type: QuestionComment
comment on: http://stackoverflow.com/q/24064170
score: 2
has text: What's the problem? What have you tried and why didn't it work?
type: Comment

http://stackoverflow.com/q/24102897
has answer: http://stackoverflow.com/a/37341264
answer count: 3
has answer: http://stackoverflow.com/a/24170613
upvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/24071134
tagged with: rest
tagged with: objectify
possible better answer: http://stackoverflow.com/a/24110543
tagged with: android-studio
has comment: http://stackoverflow.com/comment/37195451
tagged with: google-cloud-endpoints
type: AnsweredQuestion
has title: Objectify Key/Ref roundtrip between backend and client [without GWT]
has comment: http://stackoverflow.com/comment/37195421
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24170613
has answer: http://stackoverflow.com/a/24110543
has body: There are a lot of articles here and all over the web, but these all target different Objectify versions and seem not to work for one or the other reason. I have an entity, which references another entity (e.g. an Account entity references a User entity): @Cache @Entity public final class Account { @Id Long id; @Index private Ref&lt;User&gt; user; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public User getUser() { return user.get(); } public void setUser(User user) { this.user = Ref.create(user); } } I am trying to do this: From the client, GET the account entity over REST/Google Cloud Endpoints. Modify the resource. UPDATE it on the server. As discussed here Objectify loads object behind Ref&lt;?&gt; even when @Load is not specified above code always returns the referenced user as well, whích I don't want. One option would be, as @svpino suggested, "Make your @ApiMethod return a different Account object without the user property (thus avoiding fetching the user if you don't need it)." This works as long as I don't want to UPDATE the resource. If I need to UPDATE, the Key/Ref needs to be preserved (even though I don't need it on the client). One possible approach that I can see would be using Key instead of Ref and rendering a web-safe string, then recreating the user during UPDATE. private Key&lt;User&gt; user; public String getUser() { return user.toString(); } public void setUser(String user) { this.user = Key.create(user); } The string looks like "Key(User(5723348596162560))", but it seems not to be reconstituted (at least I get an exception here, haven't tracked it down yet). Another approach would be writing an @ApiTransformer, which did not solve the problem either. Jeff @StickFigure posted several times during the last years and the issue still seems not to be solved. What's the current state with Objectify 5.0.2 and what's the recommendation for preserving the key between roundtrips, when the key is not needed on the clie…

http://stackoverflow.com/comment/36917702
comment on: http://stackoverflow.com/q/23962774
has text: Does the `onPostExecute` return the correct bitmap for `bitmap2`? Also, shouldn't the `bitmap` variable in `onPostExecute` be accessed statically, as in ClassName.bitmap?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23981026
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36953493
type: Answer
upvote count: 16
answers question: http://stackoverflow.com/q/23980888
has comment: http://stackoverflow.com/comment/36953460
has body: The method reduce in the interface Stream is overloaded. The parameters for the method with three arguments are: identity accumulator combiner The combiner supports parallel execution. Apparently, it is not used for sequential streams. However, there is no such guarantee. If you change your streams into parallel stream, I guess you will see a difference: Stream&lt;String&gt;stringStream = Stream.of( "John Lennon", "Paul Mccartney", "George Harrison", "Ringo Starr") .parallel(); Here is an example of how the combiner can be used to transform a sequential reduction into a reduction, that supports parallel execution. There is a stream with four Strings and acc is used as an abbreviation for accumulator.apply. Then the result of the reduction can be computed as follows: acc(acc(acc(acc(identity, "one"), "two"), "three"), "four"); With a compatible combiner, the above expression can be transformed into the following expression. Now it is possible to execute the two sub-expressions in different threads. combiner.apply( acc(acc(identity, "one"), "two"), acc(acc(identity, "three"), "four")); Regarding your second question, I use a simplified accumulator to explain the problem: BiFunction&lt;StringBuilder,String,StringBuilder&gt; accumulator = (builder,name) -&gt; builder.append(name); According to the Javadoc for Stream::reduce, the accumulator has to be associative. In this case, that would imply, that the following two expressions return the same result: acc(acc(acc(identity, "one"), "two"), "three") acc(acc(identity, "one"), acc(acc(identity, "two"), "three")) That's not true for the above accumulator. The problem is, that you are mutating the object referenced by identity. That's a bad idea for the reduce operation. Here are two alternative implementations which should work: // identity = "" BiFunction&lt;String,String,String&gt; accumulator = String::concat; // identity = null BiFunction&lt;StringBuilder,String,StringBuilder&gt; accumulator = (builder,name) -&gt; build…
score: 16
has comment: http://stackoverflow.com/comment/36952255
has comment: http://stackoverflow.com/comment/36952998
accepted answer of: http://stackoverflow.com/q/23980888

http://stackoverflow.com/q/24037502
answer count: 1
has answer: http://stackoverflow.com/a/24040615
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
tagged with: jaxb
type: Question
has body: I'm trying to write a XML fragment containing a CData element in Spring StaxtItemWriter and Jaxb marshaller. But the output is either: not wrap with &lt;![CDATA[ ... ]]&gt; or escaped: &lt; and &gt; replaced by &amp;lt; and &amp;gt; First, the item writer: &lt;bean id="userAuthorizationErrorItemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter"&gt; &lt;property name="rootTagName" value="UserAuthorizationEvent" /&gt; &lt;property name="rootElementAttributes"&gt; &lt;map&gt; &lt;entry key="xmlns:xsi" value="http://www.w3.org/2001/XMLSchema-instance" /&gt; &lt;/map&gt; &lt;/property&gt; &lt;property name="marshaller" ref="userAuthorizationTypeMarshaller" /&gt; &lt;property name="overwriteOutput" value="true" /&gt; &lt;property name="resource" value="file://C:/TEMP/fichierOUT.xml" /&gt; &lt;property name="transactional" value="false" /&gt; &lt;/bean&gt; Then the JAXB marshaller &lt;bean id="userAuthorizationTypeMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"&gt; &lt;property name="contextPath" value="com.usecase1.xsd.model"/&gt; &lt;/bean&gt; The java class (simplified): @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "UserAuthorizationType", propOrder = {"action"}) @XmlRootElement(name = "UserAuthorization") public class UserAuthorizationType { @XmlElement(name = "Action", required = true) protected String action; public String getAction() { return action; } public void setAction(String value) { this.action = value; } } When writing to file, I want that the Action value to be encapsulate into a &lt;![CDATA[ ... ]]&gt; block. I tried using a @XmlJavaTypeAdapter(Adapter1.class) that return: public String marshal(String value) { return "&lt;![CDATA[" + value + "]]&gt;"; } But the output is escaped: &lt;UserAuthorization&gt;&lt;Action&gt;&amp;lt;![CDATA[first, second, third]]&amp;gt;&lt;/Action&gt;&lt;/UserAuthorization&gt; Do you have any idea?
has title: Handle CData in Stax and jaxb
score: 0

http://stackoverflow.com/q/23945586
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23944422
tagged with: java
type: Question
upvote count: 4
tagged with: objectinputstream
tagged with: string
has answer: http://stackoverflow.com/a/23945610
score: 3
has title: What are these two extra bytes in an ObjectOutputStream file?
has comment: http://stackoverflow.com/comment/36885456
answer count: 1
has body: I came across this problem while working on a question that was raised earlier. This is likely specific to ObjectInputStream and not binary reading in general, so the title may be misleading. Basically the problem from there goes like this: the author has serialized a hashmap of strings to doubles. The author's custom serialization format for each entry in the hashmap is pretty simple int n // length of string key as a 4-byte integer byte[n] key // a string of length n double value // the value associated with the key Now for some reason, during the serialization process, one of the strings 2010-00-008.html was serialized with two extra bytes, shown here. So instead of 16 bytes being written, 18 bytes were written instead. This is bound to cause problems because it still says the string is 16 bytes long. However, for some reason, you can write the hash map out and read it back in perfectly! It seems like given an 18 byte string, you can read 16 bytes and still read the whole thing. Test code Here's the code. It's basically the code in the other question except I made it so that you should be able to just change the path and run it. After you run it, you'll get a sequence of write statements followed by a sequence of read statements. Inspect the file and you should notice the extra bytes in the string, but the program does not crash. import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.Map; public class Test { // customize the path as needed public static String path = "C:\\temp\\sample.dat"; HashMap&lt;String, Double&gt; map = new HashMap&lt;String, Double&gt;(); public Test() { map.put("2010-00-027.html",21732.994621513037); map.put("2010-00-020.html",3466.5169348296736); map.put("2010-00-051.html",12528.648992702407); map.put("2010-00-062.html",3354.8950010256385); map.put("2010-00-024.html",10295.095511718278); map.put("2010-00-052.html",538…
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/36885367
accepted answer: http://stackoverflow.com/a/23945610
downvote count: 1

http://stackoverflow.com/comment/37108020
type: QuestionComment
comment on: http://stackoverflow.com/q/24064848
has text: Thanks! After adding `target` element, the error is gone. Thanks a lot for making me learn something new this morning!
score: 0
type: Comment

http://stackoverflow.com/comment/36926611
comment on: http://stackoverflow.com/a/23967723
has text: You mean to suggesting setting `Xmx` which increases the max heap space.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24097670
favorite count: 0
has answer: http://stackoverflow.com/a/24097721
downvote count: 2
has body: I just want to know how to remove that initialized wgt error. Rest, I want my code to be basic and very simple. //Program By Aryansh Malviya //BMI Calculator import java.util.Scanner; public class BMICalc { public static void main(String args[]) { Scanner input = new Scanner(System.in); int cw; int ch; int bmi; int wgt; int hgt; int ct; System.out.print("\nNote: This program is not yet fully functional.\nThere might be issues regarding decimal values. \nProgram has not been equipped to accept or display in decimal values. \nThe program will be updated soon. \nSorry for the inconvinience."); System.out.print("Enter 1 if you want weight in Kilograms"); System.out.print("Enter 2 if you want weight in Pounds"); cw = input.nextInt(); System.out.print("\nNote: If you choose to enter weight in Pounds, you'd have to enter height in Inches. Else, in meters"); if(cw == 1) { System.out.print("\nEnter weight in Kilograms: "); wgt = input.nextInt(); } else if(cw == 2) { System.out.print("\nEnter weight in Pounds: "); wgt = input.nextInt(); } else { System.out.print("\nEnter a valid choice and try again!"); } System.out.print("\nEnter your height: "); hgt = input.nextInt(); bmi = wgt/(hgt * hgt); System.out.printf("\nYour weight is: %d", wgt); System.out.printf("\nYour height is: %d", hgt); System.out.printf("\n\nYour BMI is: %d", bmi); System.out.print("\nBMI VALUES"); System.out.print("\nUnderweight: less than 18.5"); System.out.print("\nNormal: between 18.5 and 24.9"); System.out.print("\nOverweight: between 25 and 29.9"); System.out.print("\nObese: 30 or greater"); } } When I compile the program I get the error that the variable wgt has not been initialized. Please tell me how to solve this problem.
linked to: http://stackoverflow.com/q/415687
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24097726
accepted answer: http://stackoverflow.com/a/24097721
type: Question
possible better answer: http://stackoverflow.com/a/24097724
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/24097724
has title: BMI Calculator. Whats wrong?
answer count: 3
has comment: http://stackoverflow.com/comment/37168964
has comment: http://stackoverflow.com/comment/37168847

http://stackoverflow.com/a/23976426
has body: I dont understand when we get that number(49), i dont see the byte code for the arithmetic operation '5 * 4 + 3 The bytecode compiler is optimizing them away. The expression is a constant expression according to the JLS definition, and that means that the java compiler is permitted to evaluate it at compile time and hard-code the resulting value into the class file. If you want to see what the bytecodes for expression evaluation look like, you need to use parameters, local variables, etc as the "primaries" in the expression; e.g. public int myMethod(int a, int b, int c) { return a + b * c / 42; }
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/23976406
answers question: http://stackoverflow.com/q/23976406
downvote count: 0
score: 5

http://stackoverflow.com/a/24094691
has comment: http://stackoverflow.com/comment/37171270
has comment: http://stackoverflow.com/comment/37178602
has comment: http://stackoverflow.com/comment/37170904
score: 0
answers question: http://stackoverflow.com/q/24094443
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37171303
has comment: http://stackoverflow.com/comment/37172684
type: Answer
has comment: http://stackoverflow.com/comment/37170629
has comment: http://stackoverflow.com/comment/37178611
has body: jQuery's get(...) requires a valid URL. Here is what I tried with the code snippet you provided. This goes to the servlet. 1. provide the jQuery-version.js file &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" &gt;&lt;/script&gt; 2. The correct URL. The below URL will be called like this: http://localhost:8080/TestServlet/someservlet $.get('someservlet', function(responseJson) { alert(responseJson); var $ul = $('&lt;ul&gt;').appendTo($('#somediv')); $.each(responseJson, function(index, item) { $('&lt;li&gt;').text(item).appendTo($ul); }); }); The servlet @WebServlet("/someservlet/*") public class TestServlet extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response) { System.out.println("Hello Test"); String json = "Hello from servlet"; try { response.getWriter().write(json); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
accepted answer of: http://stackoverflow.com/q/24094443
has comment: http://stackoverflow.com/comment/37172696

http://stackoverflow.com/a/24033141
score: 0
has body: Problem with this line: i&lt;c.size() you was't decide the size of array list. means ArrayList initially having Zero element in it. therefore you need to add some element in ArrayList and then iterate it. for(int counter=0; counter&lt;someSize; counter++){ // Add element logic here }
type: Answer
answers question: http://stackoverflow.com/q/24033003

http://stackoverflow.com/a/23985058
has body: There are two broad strategies you can use to achieve this. Processor Based: Add a processor to the end of the route. In this processor do the check if the webservice then responds with a true or false value. A processor would look something like this: package com.example; import java.util.Map; import org.apache.camel.Body; import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.apache.camel.Headers; import org.apache.camel.Message; public class GeneralProcessor { @Handler public void PrepapreErrorImportReport ( @Headers Map hdr , Exchange exch ) { //todo: Get the message as a string; Message in = exch.getIn(); String msg = (String)in.getBody(); // Now check if body contains failed or ok. if(msg.contains("OK")){ //todo: go party the message was OK } else{ //todo: Oh Oh! Houston we have a problem } } } You can then modify your route to use this processor. The Simple Expression Language This is one way the other way is to use the simple expression language. See the example below on how to use this. from("file:data/inbox?noop=true") .marshal() .string() .setHeader(Exchange.CONTENT_TYPE,constant("application/json")) .to("http://www.a-service.com") .choice() .when(simple("${body} contains 'OK'")).to("activemq:okqueue") .otherwise().to("activemq:queue:other"); Notice the simple("${body} contains 'OK'") piece of code. That is the power of simple. Both approaches have uses.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23983681
type: Answer
answers question: http://stackoverflow.com/q/23983681
has comment: http://stackoverflow.com/comment/36968764
has comment: http://stackoverflow.com/comment/36968048
score: 3
has comment: http://stackoverflow.com/comment/36968727
has comment: http://stackoverflow.com/comment/36993810
has comment: http://stackoverflow.com/comment/130738414
has comment: http://stackoverflow.com/comment/36968251
has comment: http://stackoverflow.com/comment/36974050
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37148506
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24086917
has text: Please provide a short but complete program which demonstrates the problem. Indent it properly, and don't comment most of it out. Unless you think the problem is GUI-specific, you shouldn't need a GUI to demonstrate it - hard-code the data.

http://stackoverflow.com/comment/37060215
score: 0
has text: How is this deployed? Is `testlib` in some classloader which the app can see, but which can't see the app? That sounds like a fairly likely explanation...
comment on: http://stackoverflow.com/q/24039400
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37063648
type: Comment
has text: Is it possible a connection is timed out before I get it from connection pool?
comment on: http://stackoverflow.com/a/24038557
score: 0
type: AnswerComment

deserialization
type: Tag
tags question: http://stackoverflow.com/q/24016520
tags question: http://stackoverflow.com/q/24040720
tag name: deserialization
tags question: http://stackoverflow.com/q/24038170

http://stackoverflow.com/comment/36915442
type: Comment
type: QuestionComment
score: 0
has text: The first one should works. My hypothesis is that you forgot the file extension. Are you receiving a FileNotFoundException when instanciating ? Also make sure you have the permission to access that folder.
comment on: http://stackoverflow.com/q/23961676

http://stackoverflow.com/a/37341264
answers question: http://stackoverflow.com/q/24102897
type: Answer
has body: You can create a class that extends Ref&lt;User&gt; and use an @ApiTransformer to transfer that class between backend and client @ApiTransformer(UserRefTransformer.class) public class UserRef extends LiveRef&lt;User&gt; { } public class UserRefTransformer implements Transformer&lt;UserRef, User&gt; { // Your transformation code goes here }
score: 0

maven-cobertura-plugin
tags question: http://stackoverflow.com/q/24087337
tag name: maven-cobertura-plugin
tags question: http://stackoverflow.com/q/23941083
type: Tag

http://stackoverflow.com/q/23948676
linked to: http://stackoverflow.com/q/9565273
has comment: http://stackoverflow.com/comment/36891565
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36891112
linked to: http://stackoverflow.com/q/9347725
has comment: http://stackoverflow.com/comment/36891195
has body: I am a beginner with developing for Google App Engine, so I am trying to follow the basic Java tutorial. Currently I have followed all the steps up to step 3 of Building and testing the app for the "Guestbook" application. I perform mvn appengine:devserver in a terminal, but when I go to localhost:8080 in my browser, I see the following message. HTTP ERROR: 503 Problem accessing /. Reason: SERVICE_UNAVAILABLE In the terminal where I started the server I don't see any output due to this error. Can anyone provide any insight into this problem? Edit - localhost:8080/guestbook also produces this same HTTP 503 error Here is my web.xml file (copied from the GAE tutorial page): <?xml version="1.0" encoding="utf-8"?> guestbook com.google.appengine.demos.guestbook.GuestbookServlet guestbook /guestbook guestbook.jsp And here is the guestbook.jsp they provided (in case this helps): <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="com.google.appengine.api.users.User" %> <%@ page import="com.google.appengine.api.users.UserService" %> <%@ page import="com.google.appengine.api.users.UserServiceFactory" %> <%@ page import="java.util.List" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <% String guestbookName = request.getParameter("guestbookName"); if (guestbookName == null) { guestbookName = "default"; } pageContext.setAttribute("guestbookName", guestbookName); UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { pageContext.setAttribute("user", user); %> Hello, ${fn:escapeXml(user.nickname)}! (You can <a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">sign out.) <% } else { %> Hello! <a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Sign in to include your name with greetings you post. <% } %>
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36891873
score: 2
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/36943708
favorite count: 0
has comment: http://stackoverflow.com/comment/36891921
type: Question
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/36892149
has comment: http://stackoverflow.com/comment/36891243
tagged with: maven
linked to: http://stackoverflow.com/q/10251518
has title: Basic GAE Java tutorial HTTP 503 error

http://stackoverflow.com/comment/36998514
type: QuestionComment
score: 2
has text: An ArrayList actually allocates substantially more space than it needs every time it runs out of space, so it won't have to allocate immediately when it grows again.
comment on: http://stackoverflow.com/q/24006127
type: Comment

http://stackoverflow.com/q/24035584
has comment: http://stackoverflow.com/comment/37053059
has comment: http://stackoverflow.com/comment/37053276
has body: I am trying to get the status code for a URL using Apache HTTPGet request. For a URL which belongs to China Marketplace Domain(something like :www.URL.cn) i am getting a return code 503 whereas when i am trying to load the URL in browser i am getting 200 return STatus. Any clues where it might be wrong. Here is the code: HttpGet urlGet = new HttpGet(URL); // URL being any valid URL HttpResponse urlResponse = (HttpResponse) httpClient.execute(urlGet); int returnCode = urlResponse.getStatusLine().getStatusCode(); I have tried setting User Agent as well but with no success. Is there any additional thing required to resolve this.
has comment: http://stackoverflow.com/comment/37053034
type: UnansweredQuestion
answer count: 0
tagged with: http
has title: Apache HTTP Client giving 503 Status code instead fo 200
type: Question
linked to: http://stackoverflow.com/q/1432961
tagged with: java
score: 0
tagged with: apache
has comment: http://stackoverflow.com/comment/37053225

http://stackoverflow.com/comment/36898095
has text: In that case, I would maintain the Data Model diagram, but I think the answer depends on the person itself and on the way you prefer to work.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23952011
score: 0

http://stackoverflow.com/comment/37051793
has text: @user3686725 AFAIK the isconnected turns to false when the *server* closes the connection.
score: 0
comment on: http://stackoverflow.com/q/24034767
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23982764
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36955184
accepted answer: http://stackoverflow.com/a/24089019
type: Question
has answer: http://stackoverflow.com/a/23982788
tagged with: intellij-idea
tagged with: adt
has comment: http://stackoverflow.com/comment/36954570
possible better answer: http://stackoverflow.com/a/23982788
has comment: http://stackoverflow.com/comment/36954628
score: 0
has comment: http://stackoverflow.com/comment/36955365
answer count: 2
has body: I've been writing this application for my project and I've come through a strange situtation and need help since I cannot find the mistake and there are no errors when compiling. Also, the application works on my Nexus 7 (2013) tablet with Kitkat 4.4.2 and it doesn't work on my Samsung Galaxy S2 with Cyanogenmod 11 M6 installed. Also, it doesn't work on a Galaxy S4 with stock rom running Android 4.4.2. I'm getting the error on Line 16 of the MainActiviy.java file when I check the errors on logcat. You can find the logcat logs, MainActivity.java file, activity_main.xml file and the android manifest below. I'm using Intellij Idea but get the similar results on Android Developer Tools. Thank you very much. MainActivity.java: package gpec.app.metudexter; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.ImageButton; public class MainActivity extends Activity { private ImageButton online_Button, mail_Button, apu_Button, sca_Button, lib_Button, ratingButton; //curriculum_Button, @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //ERROR HAPPENS HERE online_Button = (ImageButton) findViewById(R.id.onlineButton); online_Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent myIntent = new Intent(MainActivity.this, Online.class); // myIntent.putExtra("key", value); MainActivity.this.startActivity(myIntent); } }); apu_Button = (ImageButton) findViewById(R.id.apuButton); apu_Button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent myIntent = new Intent(MainActivity.this, Apu.class); // myIntent.putExtra("key", value); MainActivity.this.startActivity(myIntent); } }); mail_Button = (ImageButton) findViewById(R.id.mailBu…
has title: Android MainActivity.java Error (works on tablet but not on phone)
has comment: http://stackoverflow.com/comment/36954735
has answer: http://stackoverflow.com/a/24089019
tagged with: android
has comment: http://stackoverflow.com/comment/36954503
tagged with: android-intent

http://stackoverflow.com/comment/37004163
score: 0
type: Comment
type: QuestionComment
has text: At first glance, this looks like it should work (it's not amazingly well designed, but there are no glaring functional problems), apart from the inefficiency in allocating a new byte array for each sample read. Some possible things to check: is the server using the same byte order (for each float), and are the floats all between -1 and 1?
comment on: http://stackoverflow.com/q/24009149

http://stackoverflow.com/comment/36979429
has text: to run your application on the shell / terminal you will need a executable jar; for a java web application / web service you will need a *.war file (or *.ear; but start with war as it is simpler for beginning)
comment on: http://stackoverflow.com/a/23995644
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24063309
accepted answer: http://stackoverflow.com/a/24063696
tagged with: elasticsearch
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24063696
possible better answer: http://stackoverflow.com/a/41146896
upvote count: 1
type: AnsweredQuestion
has title: Java or Rest API for server application connecting to ElasticSearch
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/41146896
has body: We are currently in the process of updating our project(Spring MVC application) which was based on Lucene 2.8, to ElasticSearch so basically the bottleneck of storing indexes will pass to ElasticSearch. The application now will only call ElasticSearch Server for CRUD operations on indexes, will not carry dependencies and responsibilities for managing Lucene Documents, IndexWriter... basically just Json and will also show the results from search queries. My question is: Will we need(or gain advantage) by using the Java API ElasticSearch offers instead of the Rest API because as far as I understand(ElasticSearch noob here) Java API will only add more code(and maven dependencies) in the application instead of just performing the REST calls since everything will be json now.
tagged with: rest

http://stackoverflow.com/a/24088846
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/37152966
accepted answer of: http://stackoverflow.com/q/24088635
has comment: http://stackoverflow.com/comment/37152675
downvote count: 0
answers question: http://stackoverflow.com/q/24088635
has comment: http://stackoverflow.com/comment/37152880
has body: I think thats because your TextView isnt in your xml: activity_main, you should add a TexView to this XML.
type: AcceptedAnswer

http://stackoverflow.com/q/23976684
has comment: http://stackoverflow.com/comment/36942994
favorite count: 0
has body: So far i am making a game that you play and then every five seconds it saves the game. so far I have an ok save system. what happens is say you had 100 wood and 30 bread and 0 dirt then it would save to a file "100 30 0". every time you start up the app it loads the save by: public static void loadSave(File loadPath){ try{ Scanner loadScanner = new Scanner(loadPath); while(loadScanner.hasNext()){ for (int i = 0; i &lt; ldStr.length; i++) { ldStr[i] = loadScanner.nextInt(); if(i == 7){ Print(); } } } loadScanner.close(); }catch(Exception e){} } After that it puts them into variables in my main class, like this: public static void Print(){ System.out.println("Loaded File. These are the values: " + ldStr[0] + " " + ldStr[1] + " " + ldStr[2] + " " + ldStr[3] + " " + ldStr[4] + " " + ldStr[5] + " " + ldStr[6]); Pane.numberOfChopers = ldStr[0]; if(ldStr[0] &gt; 0){ Pane.boughtChoper = true; Pane.isChoping = true; } Pane.numberOfHuts = ldStr[1]; if(ldStr[1] &gt; 0){ Pane.boughtHut = true; Pane.isRenting = true; } Pane.resMoney = ldStr[2]; Pane.resWood = ldStr[3]; Pane.hutCostMoney = ldStr[4]; Pane.hutCostWood = ldStr[5]; Pane.chopperPrice = ldStr[6]; Pane.numberOfPeople = ldStr[7]; } Anyway I am just wondering if this is efficient. Also if I were to create a login system how could I go about saving the values to their name(would creating a separate file for each player be ok). ps. I don't plan to use SQL
has comment: http://stackoverflow.com/comment/36944661
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: save
has comment: http://stackoverflow.com/comment/36943273
has title: I need advice on creating a save system?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36942951
has comment: http://stackoverflow.com/comment/36954750
has answer: http://stackoverflow.com/a/24040129
accepted answer: http://stackoverflow.com/a/24040129
score: 0
has comment: http://stackoverflow.com/comment/36942945
answer count: 1

http://stackoverflow.com/comment/37081018
type: AnswerComment
comment on: http://stackoverflow.com/a/24050199
score: 0
type: Comment
has text: I did a println of correctAnswer at the end. For each question it is giving me the wrong answer in fractions. When I ran it just now 9 * 5 was the first question to prompt. After I answered it ran println(correctAnswer) and gave me 1.8.

http://stackoverflow.com/comment/37050995
comment on: http://stackoverflow.com/a/24034361
has text: okay, i got it now.. i have to extend the JFrame class...okay okay thanks .. and sir how you design the UI part
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37006856
comment on: http://stackoverflow.com/q/24007294
has text: I just done that but in that case also I got this issue. I could list down more number of files than previous case but the issue still occurred. :(
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/68446929
has body: the input consistently goes to a similar KeyListener. A KeyEvent is constantly dispatched to the part with the center, the mouse area steers clear of how the key occasion is created. Rather than utilizing a KeyListener, you ought to utilize Key Bindings. At the point when you utilizing Key Bindings, you can conjure an Action at whatever point a KeyStroke is produced by adding the limiting to the root sheet of the JFrame. Peruse the part from the Swing instructional exercise on Key Bindings for more data. Presently in the Action that you make to tune in for the &quot;?&quot; KeyStroke you can then, at that point: utilize the MouseInfo class to get the current mouse area. utilize the SwingUtilities.convertPointFromScreen(...) to change over the mouse highlight be comparative with the root sheet then, at that point, you can utilize the Container.getComponentAt(...) to get the genuine segment the mouse is finished when you know the part you can show your assistance data.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24100599

http://stackoverflow.com/q/24047501
has body: I am writing a simple spring mvc login form example. I am getting below error in netbeans 05-Jun-2014 02:11:51.055 SEVERE [http-nio-8084-exec-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/SpringSecurity.xml]; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.security.config.SecurityNamespaceHandler]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/core/SpringSecurityCoreVersion at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) at org.springframework.context.support.Abstract…
score: 0
tagged with: java
answer count: 3
has title: Spring App error: java.lang.NoClassDefFoundError: org/springframework/security/core/SpringSecurityCoreVersion
has answer: http://stackoverflow.com/a/24047807
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24069008
has answer: http://stackoverflow.com/a/24047605
type: Question
tagged with: spring-mvc

http://stackoverflow.com/q/23947884
linked to: http://stackoverflow.com/q/14767892
type: Question
has title: How do you display a large amount of text in an Android layout?
has comment: http://stackoverflow.com/comment/36892754
answer count: 2
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36890244
has answer: http://stackoverflow.com/a/23948022
has answer: http://stackoverflow.com/a/24008083
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36889618
score: 1
linked to: http://stackoverflow.com/q/1748977
tagged with: java
upvote count: 1
has body: I need to display a Terms and Conditions pdf in a layout. It is not essential for the actual PDF to be displayed. That is, I just need the text within the pdf to be displayed correctly, in paragraphs. Using TextViews seems like the obvious option; however, I feel like both copy pasting each paragraph into a different TextView or copy-pasting it all into one and writing out the \n escape sequence after every paragraph will take too long (it is a very long document)... not to mention I will have to manually put in html tags for all the bold words. So how can I display a large amount of text in a layout without having to manually hardcode all of the paragraphs? I thought there would be some support to display a pdf, but after some research it looks like that that's not possible if the user's device doesn't have a pdf reader installed?
has comment: http://stackoverflow.com/comment/36890289

http://stackoverflow.com/a/23943634
has comment: http://stackoverflow.com/comment/36881688
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36881616
accepted answer of: http://stackoverflow.com/q/23943455
answers question: http://stackoverflow.com/q/23943455
type: Answer
has body: You're missing &lt;mvc:annotation-driven /&gt; and the corresponding namespace declarations in your servlet context. Without it, a default MVC stack is generated for you which doesn't include your Controllers.
upvote count: 5
has comment: http://stackoverflow.com/comment/36881664

http://stackoverflow.com/comment/37068700
has text: Define unused link and unused action.
comment on: http://stackoverflow.com/q/24039570
score: 0
type: Comment
type: QuestionComment

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/24061748

http://stackoverflow.com/q/24055685
answer count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has body: I am actually working on a ListView. I read data from a server and I use Volley to do this. I have a News class who has a title, a description and a picture. I have my function getNewsList(Context context) which I want to return an ArrayList. But I return a null value. Here is my function : public ArrayList&lt;News&gt; getNewsList(final Context context) { apws = new APWSManager(context, new APWSRequestState() { @Override public void customURLFinishedDownload(String response) { // TODO Auto-generated method stub Log.i("RESPONSE LISTVIEWPARSER : ", response); try { JSONArray array = new JSONArray(response); for (int i = 0; i &lt; array.length(); i++) { JSONObject myJson = array.getJSONObject(i); parseJsonItem(myJson); //listCount += INTERVALLE; myAdapter.notifyDataSetChanged(); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { } } @Override public void customURLFailedDownload(String errorMessage) { // TODO Auto-generated method stub Log.i("ERROR REQUEST : ", errorMessage.toString()); } }); HashMap&lt;String, String&gt; mapGet = new HashMap&lt;String, String&gt;(); mapGet.put("&amp;start=", String.valueOf(listCount)); mapGet.put("&amp;end=", String.valueOf((listCount+INTERVALLE))); apws.callAPWSRequest("getnews", mapGet, null, TypeMethod.GET, true); return m_ListItem; } When I get my response, I parse it with my function parseJsonItem(JSONObject object) to get values "title", "picture" and "description". Here is my function : private void parseJsonItem(JSONObject myItem) { try { Log.i("NEWS " + myItem.getString("title"), myItem.toString()); mNews = new News(myItem.getString("title"), myItem.getString("value_out"), myItem.getString("picture")); m_ListItem.add(mNews); } catch (JSONException e) { e.printStackTrace(); } } My problem is the next : I implement a custom ListView who's called PullToRefreshListView. I have three steps in that Object : the first load, the onLoadMore and the onRefresh. I retrieve correctly my data i…
has comment: http://stackoverflow.com/comment/37092699
tagged with: arraylist
tagged with: android-listview
has comment: http://stackoverflow.com/comment/37093518
has title: How to retrieve ArrayList<CustomObject> with Volley and put it in PullToRefreshListView?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/37170528
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24098536
type: AnswerComment
has text: Hmm tried my original code but with if-else statements. Doesn't work. Then also tried your code and still the same result. I'll update the main questions because I seem to have found a rather different problem in the code. I'll respond soon.

http://stackoverflow.com/comment/36948365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23979149
score: 0
has text: @EJP I'm aware of that. I would add this certificate to the trust store of the specific client. I will check the return code thingy, good idea.

http://stackoverflow.com/comment/36941216
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23975767
has text: Hint: 46 is the ascii value for the character '.' :)

http://stackoverflow.com/comment/37068106
comment on: http://stackoverflow.com/q/24029126
has text: The method always returns true after the if/else blocks.
score: 0
type: Comment
type: QuestionComment

hamcrest
tags question: http://stackoverflow.com/q/24032092
tags question: http://stackoverflow.com/q/24003659
type: Tag
tags question: http://stackoverflow.com/q/23963155
tags question: http://stackoverflow.com/q/24093000
tag name: hamcrest
tags question: http://stackoverflow.com/q/24038842

http://stackoverflow.com/q/23994983
type: Question
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23999105
has title: Camel: keep a file to folder depended on response
has body: I have DSL like this: from("file:data/inbox?noop=true") .marshal() .string("UTF-8") .setHeader(Exchange.CONTENT_TYPE,constant("application/json")) .to("http://www.a-service.com") .choice() .when(new Predicate() { @Override public boolean matches(Exchange exchange) { Message in = exchange.getIn(); String msg = in.getBody(String.class); System.out.println(" Response: " + msg); if(msg.contains("\"status\":\"OK\"")){ return true; }else{ return false; } } }) // OK!!! .to("file:data/outbox_success") .otherwise() // NOT OK !!! .to("file:data/outbox_fail"); I expected that if the http response has "status":"OK", files will go to "data/outbox_success". Otherwise, they will go to "data/outbox_fail". But it is not what I expected: yes, the files has been copied to "outbox_XXX" but there are no content in the files. I guess that because the "In" message has been changed to the http response. So, how can I copy a file to a folder depended on response of 'http' ?
score: 0
tagged with: java
tagged with: apache-camel

http://stackoverflow.com/comment/37102892
type: Comment
has text: Essentially, the task you need in this scenario will be completed either way - because `mpee` can only hold one value (and in this case it will be a, b, or c), only one of the `if` statements will go off. However, in general if you have mutually exclusive checks (such as _will a value be_ a, b, or c rather than _will a value contain_ a, b, or c), `if-else` statements will stop unnecessary code from being executed, and overall increase the performance of your program.
comment on: http://stackoverflow.com/a/24062082
score: 0
type: AnswerComment

http://stackoverflow.com/a/24088727
answers question: http://stackoverflow.com/q/24088659
has comment: http://stackoverflow.com/comment/37154061
upvote count: 2
has comment: http://stackoverflow.com/comment/37153990
has comment: http://stackoverflow.com/comment/37152285
type: Answer
has body: You could use a timer: new Timer().scheduleAtFixedRate(new TimerTask(){ @Override public void run() { //Your task here } }, 0, 30 * 1000); You could also use a SchelduledExcutorService as pointed out by Tony. You can read about those here: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html or here: https://gist.github.com/codingtony/c21e278b3111d5256f0d Hope this helps.
score: 2
has comment: http://stackoverflow.com/comment/37154574
downvote count: 0
has comment: http://stackoverflow.com/comment/37152344

http://stackoverflow.com/a/24046230
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24045527
has body: Your code can have both DB-independent and DB-dependent parts. Database-dependent parts: The JDBC URLs, SQL statements (the syntax) are database-dependent in general. With some effort, it is possible to write SQL syntax which is recognized by all Databases, but this may not be possible in all cases. Database-independent parts: The Java code used to get the connections, run statements, managing connections, creating data sources, connection pooling etc. are (as far as I think) common to all database systems that are JDBC compliant. Strictly speaking, the 'JDBC' code is mostly independent of the database. What changes with every database is the statement syntax (but JDBC does not specify the syntax in the first place)
type: Answer
accepted answer of: http://stackoverflow.com/q/24045527
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/37078038
type: QuestionComment
comment on: http://stackoverflow.com/q/24047941
has text: Please show what the output is supposed to look like.
score: 0
type: Comment

http://stackoverflow.com/q/24020700
has comment: http://stackoverflow.com/comment/37025441
has answer: http://stackoverflow.com/a/24020808
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24020904
tagged with: java
has title: JMenuBar does not appear in JFrame
type: Question
answer count: 2
tagged with: menubar
has body: SOLVED Forgot to instantiate my menuBar... I have extended the class JMenuBar, and also the class JFrame. However, when I setJMenuBar(menubar), the MenuBar does not appear in the Frame when testing. Here's my code: Class Frame: import javax.swing.JFrame; public class Frame extends JFrame{ public static MenuBar menubar; public Frame(){ setTitle("LoL Teamcomps"); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setJMenuBar(menubar); } } Class MenuBar: import javax.swing.JMenuBar; import javax.swing.JMenuItem; import com.lolteamcomps.code.components.MenuItem; public class MenuBar extends JMenuBar{ public MenuBar(){ JMenuItem players = new JMenuItem("Players"); JMenuItem champions = new JMenuItem("Champions"); JMenuItem newPlayer = new JMenuItem("Add new"); JMenuItem newChampion = new JMenuItem("Add new"); players.add(newPlayer); champions.add(newChampion); add(players); add(champions); } } And in my function called in my main: private static Frame frame = new Frame(); public static void CreateWindow(){ frame.pack(); frame.setVisible(true); } Only an empty frame appears, with nothing in it. What am I doing wrong? EDIT: My own thought was that setJMenuBar(menubar) won't work, because menubar is not a JMenuBar, but MenuBar extends JMenuBar, so in fact it is a JMenuBar, right? Also, I don't get an error at this line, so I don't think that is the case. Just a thought.
accepted answer: http://stackoverflow.com/a/24020808
score: 0
tagged with: frame
has answer: http://stackoverflow.com/a/24020904
tagged with: swing
has comment: http://stackoverflow.com/comment/37025512

http://stackoverflow.com/comment/36915081
type: Comment
type: QuestionComment
has text: Thanks for the info, updated first post.
comment on: http://stackoverflow.com/q/23961417
score: 0

http://stackoverflow.com/q/24063351
has body: I'm using a sprite sheet of sorts to load in spaceships. The documentation of Graphics.drawImage() states the arguments are boolean Graphics.drawImage(Image img, int dstx1, int dsty1, int dstx2, int dsty2, int srcx1, int srcy1, int srcx2, int srcy2, ImageObserver observer); However, the documentation says that dstx1 and dsty2 are the coordinates of the top left corner, and when you use dstx2 and dsty2 to specify the area drawn, the dimensions are (dstx2- dstx1) and (dsty2 - dsty1). Unless I'm misunderstanding how the function works, It appears that this only loads portions of the image form the corner. How could one draw a part of the image that is not connected to the lefthand corner, for drawing different parts of a sprite sheet?
upvote count: 2
has answer: http://stackoverflow.com/a/24063795
accepted answer: http://stackoverflow.com/a/24063795
tagged with: javax.imageio
has title: Drawing certain parts of image offset from the corner?
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: graphics
downvote count: 0
answer count: 1
tagged with: awt
favorite count: 0

http://stackoverflow.com/q/23981949
has title: where to define variable for a for each loop?
type: Question
has answer: http://stackoverflow.com/a/23981952
has body: can you please advise me why my first code attempt didn't work : public void listAllFiles() { for(String filename : files) { int position = 0; System.out.println(position + ": " + filename); position = position + 1; } } it kept printing position at 0 without iterating position but it seems to work after i did it this way: public void listAllFiles() { int position = 0; for(String filename : files) { System.out.println(position + ": " + filename); position = position + 1; } } I don't understand why the position + 1 was not being executed, is it because we are not meant to define variables inside for loops or am i missing something in my code.
has comment: http://stackoverflow.com/comment/36952699
tagged with: java
score: -1
downvote count: 2
upvote count: 1
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36952698
has answer: http://stackoverflow.com/a/23981951
has answer: http://stackoverflow.com/a/23981950
type: UnansweredQuestion

http://stackoverflow.com/comment/36884545
has text: Have you tried using a debugger?
score: 2
comment on: http://stackoverflow.com/q/23945234
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36952542
score: 0
comment on: http://stackoverflow.com/q/23981670
type: QuestionComment
type: Comment
has text: I still don't get it. You wanted more encapsulation?

http://stackoverflow.com/q/23961174
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/28085919
tagged with: stanford-nlp
has title: StanfordCoreNLP compiler errors using javac
has comment: http://stackoverflow.com/comment/37818969
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36916194
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/28085919
score: 2
type: AnsweredQuestion
tagged with: compiler-errors
has body: I have just started looking into the Stanford NLP libraries. I downloaded and uncompressed the core file that includes everything, then tried to run the demo file (StanfordCoreNlpDemo.java). import edu.stanford.nlp.io.*; import edu.stanford.nlp.ling.*; import edu.stanford.nlp.pipeline.*; import edu.stanford.nlp.semgraph.SemanticGraph; import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations; import edu.stanford.nlp.trees.*; import edu.stanford.nlp.util.*; All of the import lines trigger an "error: package edu.stanford.nlp. does not exist" message. Can anyone tell me what I need to do to make the demo work?

http://stackoverflow.com/comment/37200280
type: Comment
comment on: http://stackoverflow.com/a/24083265
score: 0
has text: @NewOnDotNet Yes. You can directly use the above javascript (in most of the cases). Still it might depend on your context. Visit the link which I have shared in my answer for further information.
type: AnswerComment

http://stackoverflow.com/comment/36967347
comment on: http://stackoverflow.com/a/23989433
score: 0
type: AnswerComment
has text: I dont know whats wrong, but the values of the other row didnt keep. I updated with the code to add new row.
type: Comment

http://stackoverflow.com/a/24096215
has comment: http://stackoverflow.com/comment/37166272
has comment: http://stackoverflow.com/comment/37166468
has comment: http://stackoverflow.com/comment/37166264
has comment: http://stackoverflow.com/comment/37166163
answers question: http://stackoverflow.com/q/24096059
has comment: http://stackoverflow.com/comment/37166506
has comment: http://stackoverflow.com/comment/37166563
score: 0
has comment: http://stackoverflow.com/comment/37166390
has comment: http://stackoverflow.com/comment/39321360
has comment: http://stackoverflow.com/comment/37166429
has comment: http://stackoverflow.com/comment/37166622
has body: Note: this relates to Externalizable classes, not Serializable, as correctly indicated by Pshemo in the comments below. Answer posted by Braj shows a code sample for Serializable. First of all, note the difference between a default constructor and a no-arg constructor. Default constructor is a no-arg constructor generated if you don't provide any other constructor. ObjectInputStream requires that a class has a no-arg constructor, here is a code sample that demonstrates it: import java.util.*; import java.lang.*; import java.io.*; class Ideone { static class Test implements Externalizable { //public Test() {} public Test(int x) { } public void writeExternal(ObjectOutput out) throws IOException { } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { } } public static void main(String[] args) throws java.lang.Exception { Test t = new Test(0); ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(t); oos.close(); ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray()); ObjectInputStream ois = new ObjectInputStream(is); t = (Test)ois.readObject(); ois.close(); } } Produces: Exception in thread "main" java.io.InvalidClassException: Ideone$Test; no valid constructor at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:147) at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:755) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) at Ideone.main(Main.java:36) Demo on Ideone: http://ideone.com/yPpJrb When you uncomment the no-arg constructor, it works fine. And it will also work fine when you'll remove the provided one-argument constructor - because then, the default constructor will be generated.
has comment: http://stackoverflow.com/comment/39310264
type: Answer
has comment: http://stackoverflow.com/comment/37166653
has comment: http://stackoverflow.com/comment/37166196
has comment: http://stackoverflow.com/comment/37166417
has comment: http://stackoverflow.com/comment/37166592
upvote count: 1
has comment: http://stackoverflow.com/comment/37166226
has comment: http://stackoverflow.com/comment/37166237
downvote count: 1

http://stackoverflow.com/q/23950034
has comment: http://stackoverflow.com/comment/36893664
tagged with: java
has comment: http://stackoverflow.com/comment/36893593
type: Question
has comment: http://stackoverflow.com/comment/36893825
has title: SimpleDateFormat fails to parse and returns null
has answer: http://stackoverflow.com/a/23953472
tagged with: simpledateformat
has comment: http://stackoverflow.com/comment/36893792
has comment: http://stackoverflow.com/comment/36893507
has body: I am getting a null returned by SimpleDateFormat. But I feel I have done everything correctly. Below is my code snippet format = new SimpleDateFormat("yyyy-dd-MM'T'H:mm:ss'Z'", Locale.US); format.setLenient(true); ParsePosition pos = new ParsePosition(0); String timeStr = "2013-10-05T01:21:07Z"; System.out.println(format.format(new Date())); System.out.println(timeStr); Date d = format.parse(timeStr,pos); d.getTime(); Gives the output 2014-30-05T13:43:05Z 2013-10-05T01:21:07Z Exception in thread "main" java.lang.NullPointerException I have tried a couple of options mentioned in other posts in this forum. But I am still getting the error. Am I overlooking something trivial?
score: 0
has comment: http://stackoverflow.com/comment/36894164
tagged with: java-7
answer count: 1
has comment: http://stackoverflow.com/comment/36893569
has comment: http://stackoverflow.com/comment/36893558
has comment: http://stackoverflow.com/comment/36893778
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36894012
tagged with: date-parsing
has comment: http://stackoverflow.com/comment/36894625

http://stackoverflow.com/q/23996762
has comment: http://stackoverflow.com/comment/36981061
downvote count: 0
has answer: http://stackoverflow.com/a/23996905
has body: In a java program, I am using log4j2 for my (debug) output. When using a third party libary, I would like to disable the log output from these libraries. How can I do that? Actually this seems quite simple to me but I could not find a solution for it. I can't be the only one looking for this?
accepted answer: http://stackoverflow.com/a/23996905
possible better answer: http://stackoverflow.com/a/76328612
has answer: http://stackoverflow.com/a/76328612
favorite count: 0
has title: Disable log output from libraries
upvote count: 2
tagged with: log4j2
type: AnsweredQuestion
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/4972954
has comment: http://stackoverflow.com/comment/36980987
type: Question
answer count: 2

http://stackoverflow.com/comment/36909558
score: 0
type: Comment
has text: There's an updated version of the code at http://dadaelectronics.asia/wipv3_6/page2/show.jsp?id=230165&db=Entries
type: QuestionComment
comment on: http://stackoverflow.com/q/23957942

http://stackoverflow.com/comment/81668475
has text: This worked for me. I had a similar issue. Execution failed for task ‘:app:lint***Release’. > org.picocontainer.MutablePicoContainer.registerComponentInstance(Ljava/lang/Object;)Lorg/picocontainer/ComponentAdapter;
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30436088

http://stackoverflow.com/q/24005558
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/36997558
has comment: http://stackoverflow.com/comment/36997436
has title: JDBC NullPointerException
tagged with: java
has comment: http://stackoverflow.com/comment/36997586
has body: I've written a code in swing in which I've inserted text in jTextFields. But when I try to insert them in my database, it gives NullPointerException after "Driver Connected". Following is my JDBC code: Connection conn = null; PreparedStatement pst = null; ResultSet rs = null; try{ Class.forName("oracle.jdbc.OracleDriver"); System.out.println("Driver Loaded."); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "usname", "pass"); System.out.println("Driver Connected."); String insert = "INSERT INTO directorsdb values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; pst=conn.prepareStatement(insert); pst.setString(1, dirname.getText()); pst.setString(2, jDateChooser1.getDate().toString()); pst.setString(3, DIN.getText()); pst.setString(4, PAN.getText()); pst.setString(5, UIN.getText()); pst.setString(6, birthplace.getText()); pst.setString(7, passportno.getText()); pst.setString(8, dlicense.getText()); pst.setString(9, nationality.getText()); pst.setString(10, occupation.getText()); pst.setString(11, occupationcompany.getText()); pst.setString(12, designation.getText()); pst.setString(13, qualification.getText()); pst.setString(14, officeadd.getText()); pst.setString(15, residentialadd.getText()); pst.setString(16, contacthome.getText()); pst.setString(17, contactwork.getText()); pst.setString(18, contactmobile.getText()); pst.setString(19, emailper.getText()); pst.setString(20, emailwork.getText()); pst.setString(21, emailother.getText()); pst.setString(22, secretaryname.getText()); pst.setString(23, secretarycontact.getText()); pst.setString(24, secretaryemail.getText()); pst.setString(25, buttonGroup1.getSelection().getActionCommand()); pst.setString(26, jDateChooser2.getDate().toString()); pst.setString(27, fathername.getText()); pst.setString(28, mothername.getText()); pst.setString(29, jDateChooser3.getDate().toString()); pst.setString(30, posiionboard.getText()); pst.setString(31, jDateChooser4.getDate().toStrin…
type: Question
answer count: 1
duplicate of: http://stackoverflow.com/q/218384
score: 0
tagged with: nullpointerexception
tagged with: jdbc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24005570
tagged with: swing

http://stackoverflow.com/q/24059770
favorite count: 0
has answer: http://stackoverflow.com/a/24059851
accepted answer: http://stackoverflow.com/a/24059851
has body: If I go to the Javadoc page for the RandomGenerator class I see a summary of the class constructor and methods. It says public class RandomGenerator extends Random. How can I find out more information about how RandomGenator class invokes the constructor of Random class? I don't see any references in RandomGenerator class to it's superclass constructor.
tagged with: superclass
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24059878
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37100206
tagged with: java
type: Question
tagged with: inheritance
has answer: http://stackoverflow.com/a/24059878
answer count: 3
tagged with: subclass
upvote count: 1
has title: Javadoc identifying superclass constructor
has answer: http://stackoverflow.com/a/24059887

http://stackoverflow.com/comment/37037471
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24026978
has text: Sure, that's true. That's why I clarified up top "as far as you or the program is concerned". No need to go into the specifics of GC for this simple question. But indeed, you are correct.

http://stackoverflow.com/q/23972045
tagged with: spinner
favorite count: 0
has body: On SWT spinner (or maybe some other similar SWT widget), how can I force the user to use the UI buttons instead of edit the text from the keyboard. thanks.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23973111
score: 1
tagged with: java
tagged with: swt
upvote count: 1
type: Question
has title: SWT Spinner - Disabling Keyboard Editing
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23973111

http://stackoverflow.com/comment/36945436
has text: yes,cause i am calling update by click on marker's infowindow,and that marker's data already in db(i used content provider helper android program to be sure 100%).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23974647
score: 0

derby
tags question: http://stackoverflow.com/q/24056607
tags question: http://stackoverflow.com/q/24006273
tags question: http://stackoverflow.com/q/24070111
tags question: http://stackoverflow.com/q/23957246
tags question: http://stackoverflow.com/q/23990521
tags question: http://stackoverflow.com/q/23986873
tag name: derby
type: Tag
tags question: http://stackoverflow.com/q/24033401

multi-touch
tags question: http://stackoverflow.com/q/24026296
type: Tag
tag name: multi-touch

http://stackoverflow.com/a/24097534
has comment: http://stackoverflow.com/comment/37168656
has comment: http://stackoverflow.com/comment/37168985
answers question: http://stackoverflow.com/q/24097356
type: Answer
has body: If you take a look at the javadoc it states the following: Whenever an operation occurs involving a source sequence (such as appending or inserting from a source sequence) this class synchronizes only on the string buffer performing the operation, not on the source. This means that if several threads has access to the source it is possible that another thread modifies the source before it is written. A simple example, that might make this a bit clearer. StrginBuffer sb = new StringBuffer //some other thread might change the sharedSource. sb.append(getSharedString());
has comment: http://stackoverflow.com/comment/37168887
has comment: http://stackoverflow.com/comment/37168709
score: 0

http://stackoverflow.com/comment/36966074
score: 2
comment on: http://stackoverflow.com/q/23988745
has text: You can add a jar in eclipse by right clicking on the Project --> Build Path --> Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37190279
type: Comment
type: QuestionComment
has text: To illustrate my question, here is some similar application through java script. Still looking toward a recent alternative in Java ...: http://www.lemonde.fr/les-decodeurs/visuel/2014/06/06/les-artistes-ont-ils-vraiment-plus-de-risque-de-mourir-a-27-ans_4433903_4355770.html (it is made thanks to this : http://raphaeljs.com/)
comment on: http://stackoverflow.com/q/24048195
score: 0

http://stackoverflow.com/comment/37004538
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24009149
has text: That multithreading was my idea for a errorsource too, but the double while should work according to my logs. It is called once one array is ready to be used. Since it is called immediatly, the array shouldn't be overwritten before it was sent to the writeSamples method.
score: 0

http://stackoverflow.com/comment/37126067
comment on: http://stackoverflow.com/q/24074868
score: 0
has text: @user3145373ツ The path is shown correct.Even when i restart my server(apache in my case).The same image may get shown
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24022341
has comment: http://stackoverflow.com/comment/37029382
score: -2
has answer: http://stackoverflow.com/a/24022423
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: javascript
has comment: http://stackoverflow.com/comment/37028646
answer count: 3
has comment: http://stackoverflow.com/comment/37028690
has comment: http://stackoverflow.com/comment/37028741
upvote count: 0
accepted answer: http://stackoverflow.com/a/24048736
has comment: http://stackoverflow.com/comment/37028660
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/37028654
has title: How to parse a JSON object from ajax call in Java Script
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24022440
downvote count: 2
has answer: http://stackoverflow.com/a/24048736
type: Question
has body: I am making an Ajax call in my JSP which is recieving a JSON response. Running alert('Ajax Response ' + respArr); gives the following screen: The Java server-side code: public void doGet(HttpServletRequest request, HttpServletResponse res) throws IOException, ServletException { try { String fromDate = request.getParameter("drFrom"); String toDate = request.getParameter("drTo"); JSONArray jsonArray = chartData.getCCSBJson(fromDate, toDate); res.setContentType("application/json"); res.getWriter().write(jsonArray.toString()); } The JavaScript: if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) { if(xmlhttp.responseText != null) { var respArr = xmlhttp.responseText; var jsonData = eval("(" + respArr + ")"); alert('JSON Chart ' + jsonData); // The line from above var obj = JSON.parse(xmlhttp.responseText); alert('JSON Parse' + obj); The JSON that is being returned: [ { "chart":{ "caption":"", "exportDataFormattedVal":"1", "numberPrefix":"", "showexportdatamenuitem":"1", "xAxisName":"Bureau usage", "yAxisName":"count" }, "data":[ { "label":"SB AutoDecison", "value":"0" }, { "label":"CC AutoDecison", "value":"0" }, { "label":"CC Judgemental", "value":"0" }, { "label":"SB Judgemental", "value":"0" } ] } ] The alerts result: alert('JSON Chart ' + jsonData) // JSON Chart[object Object] alert('JSON Parse ' + obj); // JSON parse[object Object] What I want is to parse the object and generate an Excel sheet out of the content. When I try to loop: var jqueryData = jQuery.parseJSON(respArr); var obj = JSON.parse(xmlhttp.responseText); for (var i in obj) { alert('For loop string' + obj[i]); } It throws some 7 or 8 alerts with JavaScript code for (i = 0; i &lt; 5; i++) { alert(i + ' of respArr ' + respArr[i]); } Gives letter after letter of the JSON: [, {, ", c, h, and so on for each iteration of the loop. Can I not just traverse the JSON like respArr[0].data or respArr[0].chart?
possible better answer: http://stackoverflow.com/a/24022423

http://stackoverflow.com/comment/36924620
type: Comment
has text: @Dipika your suggestion i correct solution for my problem. thanks for your suggestion.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23966454

http://stackoverflow.com/q/24096836
upvote count: 1
has comment: http://stackoverflow.com/comment/37167625
has comment: http://stackoverflow.com/comment/37167493
has comment: http://stackoverflow.com/comment/37167782
type: Question
has comment: http://stackoverflow.com/comment/37167524
has comment: http://stackoverflow.com/comment/37167684
tagged with: arrays
has comment: http://stackoverflow.com/comment/37167753
has answer: http://stackoverflow.com/a/24096901
tagged with: listview
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37167659
tagged with: rss
has comment: http://stackoverflow.com/comment/37167547
accepted answer: http://stackoverflow.com/a/24096901
tagged with: android
has title: Android - Add an item from one ListView to another ListView?
has body: I have an app that shows news from a RSS feed. There is ListView-1 which loads the news and when you click on an item(news), it shows only the selected news in a seperated xml layout. On the ActionBar for the single news item layout, user can click on Add to Favourites. I have another activity and layout file and a listview just for Favourites. How can I copy an item from one listview to another? So, the user can add news from main ListView-1 to another list called ListView-2. I cannot use intents for sending one list item. I have been thinking of using SharedPreferences to share an ArrayList, but something else needs to be the solution.
has comment: http://stackoverflow.com/comment/37167812
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37167590
has comment: http://stackoverflow.com/comment/37167456
score: 1
tagged with: java

http://stackoverflow.com/comment/36909492
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23958437
type: Comment
has text: @Oliboy50 oh..thnks.my java textbook has put out only one form of write() method.

http://stackoverflow.com/q/23979787
has body: upon clicking a menu option in my application , it opens a new window which opens an URL where SSL cert has to be accepted. I have added code in my Webdriver connection class , like :- FirefoxProfile firefoxprofile = new FirefoxProfile(); firefoxprofile.setAcceptUntrustedCertificates(true); firefoxprofile.setAssumeUntrustedCertificateIssuer(false); capabilities.setCapability(FirefoxDriver.PROFILE, firefoxprofile); driver = new FirefoxDriver(capabilities); But this particular scenario is not getting handled by the above code...and I still get the untrusted SSL cert .... I am not sure how to handle this...
tagged with: firefox
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37015221
favorite count: 0
type: UnansweredQuestion
tagged with: selenium
has comment: http://stackoverflow.com/comment/37007403
upvote count: 1
has answer: http://stackoverflow.com/a/44266940
score: 1
tagged with: java
tagged with: ssl-certificate
has title: Accepting untrusted SSL certificate using webdriver for a window that opens up on clicking a menu option
tagged with: webdriver
type: Question

http://stackoverflow.com/q/24062853
tagged with: nested-exceptions
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/24066794
type: Question
has answer: http://stackoverflow.com/a/24066794
accepted answer: http://stackoverflow.com/a/24075700
has title: How to catch nested SMTPAddressFailedException using Spring mail API
answer count: 2
upvote count: 1
has body: I am trying to send email to user provided email id and I am getting below : org.springframework.mail.MailSendException: Failed messages: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException Now the problem is I can catch MailSendException and send a Meaningful error message to Client saying, please provide valid emailId, but MailSendException is a very generic exception to catch and catching it doesn't guarantee that the exception has occurred because of invalid email id. This exception can occur for various other reasons. My Problem is that I want to catch SMTPAddressFailedException but unfortunately in this case it is a nested exception and the actual exception thrown by Spring is a very generic MailSendException. Please suggest
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/24075700
tagged with: jakarta-mail

http://stackoverflow.com/comment/37117602
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24069823
has text: It is indeed a duplicate. You should handle the exception in case the table already exists, but that shoul be covered in your code, not in the question/answer.
score: 0

typed
tags question: http://stackoverflow.com/q/23987085
type: Tag
tag name: typed

http://stackoverflow.com/comment/36939310
comment on: http://stackoverflow.com/a/23974902
has text: I just spotted that. didn't think I'd created them as static. it's been a long night. - I'll delete the post. thanks.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37076520
type: Comment
type: QuestionComment
has text: petey, I tried to change the ip to 127.0.0.1 , didn't work either. But I'm not sure that that was what you meant...
score: 0
comment on: http://stackoverflow.com/q/24047789

http://stackoverflow.com/q/23942753
favorite count: 0
has comment: http://stackoverflow.com/comment/36890450
has title: Can i call a method and redirect to another page together from p:commandLink
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23974005
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36880259
tagged with: primefaces
accepted answer: http://stackoverflow.com/a/23974005
has comment: http://stackoverflow.com/comment/36880388
has body: Is it possible to call a Java method and redirect to another .xhtml page from one p:commandLink at the same time and how? My commandLink is: &lt;p:commandLink value="Click Here" action="#{userRequestBean.cancelRequest()}" update = ":dataGrid" &gt; &lt;f:setPropertyActionListener target="#{userRequestBean.request}" value="${userActiveRequest}" /&gt; &lt;/p:commandLink&gt; And i would like when I click the link, also to be redirected to another page (as well as to call a java method)
has comment: http://stackoverflow.com/comment/36936981
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36956659
type: Comment
comment on: http://stackoverflow.com/a/23983865
type: AnswerComment
has text: Yeah I know, the issue is really when I'm checking against a cloned array that is not of equal length, What's a simple way to check that? I'll add my current method of iteration.
score: 0

http://stackoverflow.com/a/40522222
upvote count: 4
has body: I couldn't track down the problematic reference except for knowing it is somehow getting into my class-path so here is my 2 cents for lazy developers using eclipse: Scroll down the list of maven dependencies under your project tree (usually under Java Resources -> Libraries -> Maven Dependencies), track the problematic added jar you wish to exclude from your packaged JAR, right click on it -> select Maven -> Exclude Maven Artifact ! Voila - automatically an exclusion will be added to your pom right under the dependency that refers it. Mine BTW was jcifs... org.codelibs jcifs 1.3.18.2 servlet-api javax.servlet Good luck!
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/24080541

http://stackoverflow.com/q/23985859
has body: Im triying to connect to database using pentahoo, but i have this error: Error connecting to database [Prueba] : org.pentaho.di.core.exception.KettleDatabaseException: Error occured while trying to connect to the database Error connecting to database: (using class org.gjt.mm.mysql.Driver) java.lang.NullPointerException org.pentaho.di.core.exception.KettleDatabaseException: Error occured while trying to connect to the database Error connecting to database: (using class org.gjt.mm.mysql.Driver) java.lang.NullPointerException at org.pentaho.di.core.database.Database.normalConnect(Database.java:415) at org.pentaho.di.core.database.Database.connect(Database.java:353) at org.pentaho.di.core.database.Database.connect(Database.java:306) at org.pentaho.di.core.database.Database.connect(Database.java:294) at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:84) at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2459) at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:541) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:329) at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:139) at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:123) at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:26) at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:121) at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source) at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source) at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source) at …
tagged with: pentaho
has comment: http://stackoverflow.com/comment/36960391
has title: Error connecting to database mysql using pentaho 5.0
linked to: http://stackoverflow.com/q/11634181
has comment: http://stackoverflow.com/comment/36960546
score: 0
tagged with: sql
tagged with: data-warehouse
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/36960543
type: Question

http://stackoverflow.com/a/23991506
upvote count: 15
answers question: http://stackoverflow.com/q/23991119
has body: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); Creates a List of type string, and the list can be potentially typecast into any other type of list. This is called decoupling. You are decoupling your code from a specific implementation of the interface. The advantages it provides, is when writing large amounts of code, you can switch between types of lists to suit your preferences (speed, memory etc), as all of your code, can treat your list as just type List. You can also pass a List as parameters and returns List from functions. And later on if you are not happy with the ArrayList, you just change that one line of code List&lt;String&gt; list = new ArrayList&lt;String&gt;(); // old code List&lt;String&gt; list = new LinkedList&lt;String&gt;(); // new code // The rest of the code doesnt need changing ... list = getList(); ... public List&lt;String&gt; getList() { List&lt;String&gt; temporaryList; ... return temporaryList; } public void changeList(List&lt;string&gt; localListVariable) {} And your program will behave as expected. On the other hand, ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); Creates an ArrayList of String types and it cannot be used as any other kind of List (Vector,LinkedList etc). Therefore it is bound by the methods available to an ArrayList. If you now want to change the type of list used, you will have to change all function parameters and return types and so on throughout your program (wherever you have had to create an ArrayList&lt;String&gt; to work with your variable).
type: Answer
downvote count: 1
score: 14

http://stackoverflow.com/comment/36969672
has text: What about `NumberFormat.getCurrencyInstance`? The `Locale` will deal with the separators. It will even deal with (some) currency symbols.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23990875

http://stackoverflow.com/comment/37042233
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24029618
has text: [Complete example found after 1 minute of googling.](http://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html)
type: Comment

http://stackoverflow.com/a/33863897
upvote count: 2
has body: In my case i solve my problem by doing following step, its old que but others my also having this problem so Follow these stem in android development Console Open the Credentials page. Click Add credentials > OAuth 2.0 client ID. Select Android. and fill the fingerprint and package name . Click Create. Then there will be successful sing in from google. Hope this may solve your problem. !!! Please msg me if any problem occurs.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24041462

http://stackoverflow.com/comment/37083638
type: QuestionComment
comment on: http://stackoverflow.com/q/24051748
has text: Change value in @RequestMapping to "/login" and in `web.xml` set ` / `
score: 0
type: Comment

directed-acyclic-graphs
type: Tag
tag name: directed-acyclic-graphs
tags question: http://stackoverflow.com/q/23946745

http://stackoverflow.com/comment/60707727
type: Comment
comment on: http://stackoverflow.com/a/24056549
score: 1
has text: Wouldn't the last line cause a type mismatch?
type: AnswerComment

http://stackoverflow.com/q/24019481
answer count: 1
has title: Setting font size to 0 causes CGAffineTransformInvert: singular matrix error
has answer: http://stackoverflow.com/a/24024744
has body: I have a JTextPane and when a user clicks a button, I want certain portions of the text to "hide" StyleConstants.setFontSize(style,0); StyleConstants.setForeground(style,textPane.getBackground()); accomplished this perfectly, however it is also raising the following error: Java[20425] : CGAffineTransformInvert: singular matrix. Is there a way to accomplish what I'm doing (set font size to 0) without getting this error? Thanks!
type: AnsweredQuestion
tagged with: fonts
tagged with: java
tagged with: jtextpane
tagged with: swing
linked to: http://stackoverflow.com/q/5674128
type: Question
has comment: http://stackoverflow.com/comment/37024804
accepted answer: http://stackoverflow.com/a/24024744
score: 0
has comment: http://stackoverflow.com/comment/37025038
has comment: http://stackoverflow.com/comment/37025052

http://stackoverflow.com/comment/36960543
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23985859
has text: I think you just have to restart it. here's post http://stackoverflow.com/questions/11634181/pentaho-data-integration-sql-connection they faced the same issue.

http://stackoverflow.com/comment/37186611
comment on: http://stackoverflow.com/a/24101704
score: 0
type: Comment
has text: I'm not quite sure what you mean. What I would do is, for each layer in your game, sort your sprites that are going to be red this frame into a separate list. First draw all your regular sprites, then change the shader to the custom shader and draw the red sprites, and then change the shader back to null (which switches it back to default).
type: AnswerComment

http://stackoverflow.com/comment/36912674
type: QuestionComment
score: 2
has text: Close the resultSet and preparedStatement after reading value.
comment on: http://stackoverflow.com/q/23960212
type: Comment

http://stackoverflow.com/a/24011558
has body: You don't need to use generics in assignment. Collection&lt;HashMap&lt;String, Integer&gt;&gt; outCollecttion = doSomeWork(collection);
answers question: http://stackoverflow.com/q/24011457
type: Answer
has comment: http://stackoverflow.com/comment/37008264
score: 0

http://stackoverflow.com/comment/37136754
has text: You can make a ".bat" file of the keytool commands which make a certificate and run that file from GUI .. using Java swing you can do this.
comment on: http://stackoverflow.com/q/24080881
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37056544
has text: Ya got that now. Can you please tell where can i get the required jar file?
comment on: http://stackoverflow.com/q/24036662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/78980702
comment on: http://stackoverflow.com/a/46009669
has text: .Whats the point? You still didn't answer the WHY part - "So, what is the reason why Java designers decided to not allow default methods overriding methods from Object?"
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/24024765
possible better answer: http://stackoverflow.com/a/24024831
has comment: http://stackoverflow.com/comment/37033537
has answer: http://stackoverflow.com/a/24024786
duplicate of: http://stackoverflow.com/q/3184883
type: AnsweredQuestion
has title: Multiple Moving Balls: Adding Ball works but removing does not
linked to: http://stackoverflow.com/q/3184883
has answer: http://stackoverflow.com/a/24024831
tagged with: java
tagged with: swing
type: Question
has body: I am learning Java on my own and having some issues with graphics. I learned a lot from StackOverflow! I would have posted a lot earlier had it not been for earlier threads! Here is the basic scenario. I have JFrame on which I am added Balls (which is another class extending JPanel). The balls move randomly and one ball moves on a rectangle. There are three buttons on panel: Pause, Add Random Ball, and Remove Random Ball. I am having issues with removing balls. It gives exception of concurrent access to an ArrayList and I am not sure how to go around that. And also I would like to turn pause button into pause/play but not sure how to restart the run method as its not static method. Since I am new to Java I may be doing some basic mistakes or my approach may not be correct. Any suggestions will be appreciated. Thanks ! Here is the code: Ball Class import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JPanel; public class Balls extends JPanel { public static ArrayList&lt;Balls&gt; BallList = new ArrayList&lt;Balls&gt;(); public Balls(String n, Color col, String nm) { mode = n; ballcolor = col; name = nm; if (name != "dummy") { BallList.add(this); } } @Override protected void paintComponent(Graphics g) { // TODO Auto-generated method stub super.paintComponent(g); for (Balls ball : BallList) { g.setColor(ball.ballcolor); g.fillOval(ball.x, ball.y, 20, 20); } } private int x, y; private String name; private static Boolean run = true; public String mode; public Color ballcolor; private String DirectionR = "R"; private void getposition() { if (mode.equals("Circle")) { } if (mode.equals("Rectangle")) { if (x == 0) { x = 150; } if (y == 0) { y = 200; } if (x == 150 &amp;&amp; y == 200) { DirectionR = "R"; } if (x == 350 &amp;&amp; y == 200) { DirectionR = "D"; } if (x == 350 &amp;&amp; y == 300) { DirectionR = "L"; } if (x == 150 &amp;&amp; y == 300) { DirectionR = "U"; } if (DirectionR.equa…
accepted answer: http://stackoverflow.com/a/24024786
score: 0
answer count: 2

http://stackoverflow.com/a/23968165
score: 1
upvote count: 1
has body: In my projects I use the maven assembly plugin to package the application in a redistribuable way : Everything under src/main/java and src/main/resources is packaged inside the main jar (standard behaviour). Then using assembly plugin, I create a zip containing 3 folders : /lib : contains the main jar + all the dependencies /bin : contains the additional files from the src/main/scripts maven source folder (startup shell scripts) /etc (or /conf) : contains the additional files from the src/main/config maven source folder (config files) I find this setup very convenient as it is really close to the initial maven standard layout (src/main/java + src/main/resources in the main jar and other folders taken appart), still being adapted to my projects.
answers question: http://stackoverflow.com/q/23962556
has comment: http://stackoverflow.com/comment/37001699
has comment: http://stackoverflow.com/comment/36996610
downvote count: 0
type: Answer

http://stackoverflow.com/a/24017508
answers question: http://stackoverflow.com/q/24017126
type: Answer
score: 0
has body: You need loop(while,do-while,or for loop) to do this kind of repeated stuff . Sample code may help import java.util.Scanner; public class Coffee { public static void main(String[] args) { int count = 0; String pass = "hey"; System.out.println("Enter password: "); Scanner key = new Scanner(System.in); String moves = key.nextLine(); boolean flag = true; while (flag) { if (moves.compareTo(pass) == 0) { count++; System.out .println("You're one step closer to a free coffe! You have so far bought " + count + " coffe(s)"); } if (count == 10 &amp;&amp; count != 0) { System.out.println("You've got a free coffe!"); count=0; } if (moves.compareTo(pass) != 0) { System.out.println("Wrong password! Try again.\n"); } System.out.println("Do you want to continue ..(y/n)"); String choice = key.nextLine(); if (choice.equals("n")) { flag = false; } else { flag = true; } } } }

http://stackoverflow.com/comment/37121419
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24071735
type: Comment
has text: Thanks for the reply. I have been using an approach like: "find the adverb in the tree, and then find the first adjective in the adverb's parent's right descendent." That seemed kind of hacky.

touch-event
tags question: http://stackoverflow.com/q/24059661
tags question: http://stackoverflow.com/q/24080321
type: Tag
tag name: touch-event

http://stackoverflow.com/a/24022103
downvote count: 0
has comment: http://stackoverflow.com/comment/37058550
has comment: http://stackoverflow.com/comment/37063386
has comment: http://stackoverflow.com/comment/37039644
type: Answer
accepted answer of: http://stackoverflow.com/q/24021228
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24021228
has comment: http://stackoverflow.com/comment/37048316
has comment: http://stackoverflow.com/comment/37056885
has body: I'm confused about the multiple creation of Strings S12, S34 etc. At the end your result should be S12 + Y1+ S34 + Y2 + S5678;. This is equivalent to S1 + S2 + Y1 + S3 + S4 + Y2 + S5 + S6 + S7 + S8. So is there any point in creating those intermediate concatenation here? If not you could try this program. EDIT : public class MixProcessor { private static int counter = 0; public static void main(String[] args) { String str= "Wx1 Wx2 Wy1 Wx3 Wx4 Wy2 Wx5 Wx7 Wx8"; StringBuilder output = new StringBuilder(); StringBuilder temp = new StringBuilder(); String previousPatter = ""; boolean shouldMerge = false; for(String s : str.split(" ")){ String processedString = ""; if (s.matches(".*?x.*")){ shouldMerge = ("x".equals(previousPatter) || previousPatter.trim().length() == 0) ? true : false; previousPatter = "x"; processedString = function1(s); } else if (s.matches(".*?y.*")){ shouldMerge = ("y".equals(previousPatter) || previousPatter.trim().length() == 0) ? true : false; previousPatter = "y"; processedString = function2(s); } if(shouldMerge){ temp.append(processedString); } else { output.append(function3(temp.toString())); temp = new StringBuilder(processedString); } } //Append the last value output.append(function3(temp.toString())); System.out.println(output.toString()); } private static String function2(String s) { return "Y" + s.substring(s.indexOf("y") + 1); } private static String function1(String s) { return "S" + s.substring(s.indexOf("x") + 1); } private static String function3(String s) { // Here this could be any function. I'm just trying to make as per the question return (s.indexOf("S") != -1) ? ("str" + (++counter)) : s; } }
type: AcceptedAnswer

http://stackoverflow.com/q/24099104
type: AnsweredQuestion
score: 0
answer count: 1
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/37173192
tagged with: ibm-mq
has answer: http://stackoverflow.com/a/24130969
has title: Websphere MQ asynchronous put not working
tagged with: java
has body: We have an application using Websphere MQ v.7.0.1. The server is on linux, the client application runs on Windows 7 and is written in Java using the MQ classes for java. One of the queues between the client and the server is exclusively for a keepalive protocol between the client and the server. For a variety of reasons we don't need to go into, this is necessary to maintain connections to the "real back end" of which the MQ server is only a part. The Keepalive protocol works reasonably well except in the instance when one of the servers goes down and the clients need to reconnect to it when it becomes available. Then we have problems. We have decided that our implementation of the keepalive protocol is much too complicated. The client only needs to send these keepalive messages to the server at a regular interval and need not care if they reach the server or not. If they don't, the server will take appropriate action. Therefore, an asynchronous put suggests itself. Our first attempt at implementing it was as follows: from this: MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults QueueKL.put(mqMessage,pmo); to this: MQPutMessageOptions pmo = new MQPutMessageOptions(); pmo.options |= CMQC.MQPMO_ASYNC_RESPONSE; QueueKL.put(mqMessage,pmo); The results were an unpleasant surprise. Instead of returning immediately, the put call never returns and the thread from which it was called never shows another sign of life. Of course this call is launched in a try-catch block and we've tried to catch as a last resort any possible Throwable that could be thrown i.e. catch (Throwable t) and log it. Nothing of the sort is logged. The thread appears to be blocked there at this point, the exact opposite of what I expected to happen. I must be missing something critical in how I am implementing this call, (is some special setup required in the Queue or QueueManager? The IBM docs are aggravatingly sparse here) but I don't know what that is. Please help me get to t…
accepted answer: http://stackoverflow.com/a/24130969
has comment: http://stackoverflow.com/comment/37188269
type: Question

http://stackoverflow.com/comment/36974350
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23993426
has text: @Madiwalappa - Study up on encryption. It's quite common for an algorithm to require a fixed-size block of data, meaning you may have to pad the last block being processed.
score: 0

http://stackoverflow.com/a/24007630
answers question: http://stackoverflow.com/q/24007579
has comment: http://stackoverflow.com/comment/37237189
downvote count: 0
score: 2
has body: Going down the IO ladder 30 times is not going to hurt the performance of your program. The time it takes to read 2G from disk into RAM (many seconds, even on a beefy machine) completely dwarfs the cost of going in and out of native code, which is on the order of a couple of milliseconds, tops. What are you doing that requires you having the entire file in memory? Can you not simply do serial processing?
has comment: http://stackoverflow.com/comment/37001207
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37001098

http://stackoverflow.com/q/24103513
has answer: http://stackoverflow.com/a/24103601
answer count: 3
has comment: http://stackoverflow.com/comment/37181915
has body: I want to search data from JTable when data found then I want to highlight table row. This code is work properly search record but I don't know what I do for highlight the row. String target = jTextField1.getText(); for(int row = 0; row &lt; jTable1.getRowCount(); row++) for(int col = 0; col &lt; jTable1.getColumnCount(); col++) { String next = (String)jTable1.getValueAt(row, col); if(next.equals(target)) { System.out.println("found");// here what change for highlight row. } }
has title: Highlight found data in JTable row
has answer: http://stackoverflow.com/a/27957740
has comment: http://stackoverflow.com/comment/37183609
type: UnansweredQuestion
tagged with: tablerowsorter
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/45818935
tagged with: filtering
linked to: http://stackoverflow.com/q/5520548
tagged with: java
tagged with: jtable
score: 0

http://stackoverflow.com/q/24101134
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I found this code on stackoverflow that explain how to get all running process on windows, this get name and pid Kernel32 kernel32 = (Kernel32) Native.loadLibrary(Kernel32.class, W32APIOptions.UNICODE_OPTIONS); Tlhelp32.PROCESSENTRY32.ByReference processEntry = new Tlhelp32.PROCESSENTRY32.ByReference(); WinNT.HANDLE snapshot = kernel32.CreateToolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS, new WinDef.DWORD(0)); try { while (kernel32.Process32Next(snapshot, processEntry)) { System.out.println(processEntry.th32ProcessID + "\t" + Native.toString(processEntry.szExeFile)); } } finally { kernel32.CloseHandle(snapshot); } My question is: how can i get the process path?
has answer: http://stackoverflow.com/a/24110581
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24110581
tagged with: jna
has title: JNA Windows get process path

http://stackoverflow.com/q/24046281
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37073543
has body: I made a program to sum factorials in java like 4! + 3! + 2! + 1! = 33, but it doesn't work. Could anyone help explain why? import javax.swing.JOptionPane; public class fac { public static void main(String[] args) { int sum = 0, fact, i, j; fact = Integer.parseInt(JOptionPane.showInputDialog("ENTER NO")); for (i = fact; i &gt; 1; i--) { for (j = fact - 1; j &gt; 0; j--) fact = fact * j; sum = sum + fact; } sum = sum + 1; System.out.print("SUM OF FACTORIAL = "+sum); } }
possible better answer: http://stackoverflow.com/a/24046367
answer count: 2
has answer: http://stackoverflow.com/a/24046367
downvote count: 7
score: -7
accepted answer: http://stackoverflow.com/a/24047186
has comment: http://stackoverflow.com/comment/37073587
tagged with: java
has comment: http://stackoverflow.com/comment/37073618
has comment: http://stackoverflow.com/comment/37073617
has answer: http://stackoverflow.com/a/24047186
has title: Sum of factorials in Java

http://stackoverflow.com/a/23961557
has comment: http://stackoverflow.com/comment/36915256
has comment: http://stackoverflow.com/comment/36915413
answers question: http://stackoverflow.com/q/23961472
has body: after the setContentView call add the reference to the view there setContentView(R.layout.activity_enter_text); view = findViewById(R.id.view1); for StringBuilder(String) is undefined for the type EnterText, use the new keyword to make a new StringBuilder (i dont think you need this tho) String weight = new StringBuilder(String.valueOf(i1)).append("f").toString(); for Syntax error on token ".0d", . expected, just use getLayoutParams().weight and assign it a float not an int value, LinearLayout.LayoutParams lllp = (LinearLayout.LayoutParams) view.getLayoutParams(); lllp.weight = 0.25f view.setLayoutParams(lllp); // this one may not be needed should look something like : View view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_enter_text); view = findViewById(R.id.view1); //Set the weight using a float n LinearLayout.LayoutParams lllp = (LinearLayout.LayoutParams) view.getLayoutParams(); lllp.weight = 0.25f; // supply a float like this int height1 = 200; // you have to supply a value int width1 = 300; // you have to supply a value lllp.width = width1; lllp.height = height1; view.setLayoutParams(lllp); // this one may not be needed }
has comment: http://stackoverflow.com/comment/36915547
score: 0
has comment: http://stackoverflow.com/comment/36915217
has comment: http://stackoverflow.com/comment/36916062
type: Answer
has comment: http://stackoverflow.com/comment/36915664
has comment: http://stackoverflow.com/comment/36915590
has comment: http://stackoverflow.com/comment/36915496

http://stackoverflow.com/q/23961586
has answer: http://stackoverflow.com/a/23961952
has answer: http://stackoverflow.com/a/23961657
type: UnansweredQuestion
score: 5
has title: Gson: JsonSyntaxException: Expected BEGIN_OBJECT but was STRING
upvote count: 5
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has body: I am trying to convert a JSON String into a HashMap. Here is some of my code: public static void createSimpleAppointment(String json){ try { Gson gson = new Gson(); HashMap&lt;String,String&gt; data = new HashMap&lt;String,String&gt;(); data = gson.fromJson(json, data.getClass()); The exception is being thrown on the last of those lines (where I set data). The JSON String is {"body": "body", "startDate": "2014-05-30 11:00:00", "endDate": "2014-05-30 12:00:00", "location": "location", "subject": "subject!"} The exception I get is 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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 3 at com.google.gson.Gson.fromJson(Gson.java:815) at com.google.gson.Gson.fromJson(Gson.java:768) at com.google.gson.Gson.fromJson(Gson.java:717) at com.google.gson.Gson.fromJson(Gson.java:689) at ews.calendar.Calendar.createSimpleAppointment(Calendar.java:70) at ews.main.gateway.Main.main(Main.java:34) ... 5 more Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 3 at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:374) at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183) at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145) at com.google.gson.Gson.fromJson(Gson.java:803) ... 10 more
tagged with: hashmap
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/55158094
has answer: http://stackoverflow.com/a/53392070
answer count: 4

http://stackoverflow.com/q/23951571
has body: webERP Opensource below is the PHP Client soap Client API. How to convert this PHP Client script into JAVA client script. Client program contain 5 arguments. <?php include 'xmlrpc/lib/xmlrpc.inc'; include 'config.inc'; echo 'Home '; $_POST['debtor'] = "ARGUMENT 1"; $weberpuser = "ARGUMENT 2"; $weberppassword = "ARGUMENT 3"; $DebugLevel = 1; $ServerURL = "ARGUMENT 4"; if (isset($_GET['debtorno'])) { $_POST['debtor']=$_GET['debtorno']; $_POST['submit']='set'; } if (!isset($_POST['submit'])) { echo ' Enter customer code'; echo ' '; echo ' '; } else { $debtorno = new xmlrpcval($_POST['debtor']); $user = new xmlrpcval($weberpuser); $password = new xmlrpcval($weberppassword); // weberp.xmlrpc_GetCustomer ARGUMENT 5 $msg = new xmlrpcmsg("weberp.xmlrpc_GetCustomer", array($debtorno, $user, $password)); $client = new xmlrpc_client($ServerURL); $client->setDebug($DebugLevel); $response = $client->send($msg); $debtor = php_xmlrpc_decode($response->value()); echo " "; if (sizeof($debtor)<20) { echo 'oops, an error number '.$debtor[0].' has occurred'; } foreach ($debtor as $key => $value) { if (!is_numeric($key)) { echo " ".$key." ".$debtor[$key]." "; } } echo " "; } ?> Please advise webERP rest service.
tagged with: php-java-bridge
tagged with: erp
score: 0
has comment: http://stackoverflow.com/comment/36896508
has comment: http://stackoverflow.com/comment/36899909
tagged with: rest
has comment: http://stackoverflow.com/comment/36896823
has comment: http://stackoverflow.com/comment/36897323
has comment: http://stackoverflow.com/comment/36896881
answer count: 0
has comment: http://stackoverflow.com/comment/96502860
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36896723
has comment: http://stackoverflow.com/comment/36896423
tagged with: php
has comment: http://stackoverflow.com/comment/36896539
has comment: http://stackoverflow.com/comment/36896692
tagged with: java
has comment: http://stackoverflow.com/comment/36896578
has comment: http://stackoverflow.com/comment/36898472
has comment: http://stackoverflow.com/comment/36896181
has title: How convert php soap client application into java
type: Question

http://stackoverflow.com/comment/36937492
type: QuestionComment
type: Comment
score: 1
has text: This seems to be a thousand questions rather than one. Read the JavaEE spec...
comment on: http://stackoverflow.com/q/23974035

http://stackoverflow.com/comment/36937876
comment on: http://stackoverflow.com/a/23946036
type: Comment
has text: @beserious *Large arrays are necessary here unfortunately* I don't think so. Try to use an in-memory database instead to store large amounts of data and query them with no problem.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23980098
score: 0
has body: You need to initialize isLiked and finalize it: final String isLiked = new String(); /* Rest of the code remains the same. */ new Request(Session.getActiveSession(), post_id + "/likes/", null, HttpMethod.GET, new Request.Callback() { .... .... }
type: Answer
answers question: http://stackoverflow.com/q/23979751
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23979751

http://stackoverflow.com/comment/37128188
type: QuestionComment
has text: -1 Your second code fragment is not valid. You cannot call `m1(p, 'd');` without being in a method.
score: 0
comment on: http://stackoverflow.com/q/24076075
type: Comment

http://stackoverflow.com/comment/37119976
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24070468
has text: Predictions are like that ... and I'm a pessimist.

http://stackoverflow.com/a/24068462
answers question: http://stackoverflow.com/q/24066367
has comment: http://stackoverflow.com/comment/37115261
has comment: http://stackoverflow.com/comment/37116394
type: Answer
has comment: http://stackoverflow.com/comment/37115353
has comment: http://stackoverflow.com/comment/37116989
has comment: http://stackoverflow.com/comment/37115021
has comment: http://stackoverflow.com/comment/37114942
has comment: http://stackoverflow.com/comment/37114732
has comment: http://stackoverflow.com/comment/37116458
score: 0
has body: Thanks to +Braj, I am able to make an answer using Expression Language. Apparently, this is supposed to be better than jsp scripting/tags. Servlet - import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ProductList extends HttpServlet { private static final long serialVersionUID = 1L; public ProductList() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<String> products = new ArrayList<String>(); products.add("Car"); products.add("Gun"); products.add("Shades"); request.setAttribute("productsList", products); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } JSP - <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> Insert title here <c:import url="/ProductList" /> <c:set var="myProducts" value="${requestScope.productsList}" /> List of products from servlet <c:forEach var="product" items= "${myProducts}" varStatus="i"> ${product} </c:forEach>

http://stackoverflow.com/comment/37732145
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23987849
has text: I was able to resolve the problem by wiping my hard drive, installing Ubuntu and running eclipse :)

http://stackoverflow.com/q/24026343
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/24026365
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37037847
linked to: http://stackoverflow.com/q/369512
linked to: http://stackoverflow.com/q/24028238
has title: How to sort and get highest value from Java Object/ArrayList
accepted answer: http://stackoverflow.com/a/24026429
has comment: http://stackoverflow.com/comment/37039830
tagged with: object
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/19338686
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24026365
duplicate of: http://stackoverflow.com/q/369512
linked to: http://stackoverflow.com/q/19338686
has answer: http://stackoverflow.com/a/24026429
has body: I have an ArrayList with Student Objects (Name, Mark in Math, Mark in Physics). How can I sort the ArrayList and edit with first highest number/s, then second highest then third and so on. For example I have the object value below: ArrayList&lt;&gt; allStudents = new ArrayList(); allStudents.add(new Student("A", 80, 94) ); allStudents.add(new Student("B", 98, 91) ); allStudents.add(new Student("F", 70, 84) ); allStudents.add(new Student("C", 98, 92) ); allStudents.add(new Student("H", 99, 93) ); I will look for the student with highest number, I got H. I edit the object like: "H", 97, 90 and save it back to that ArraList. Again I look for 2nd highest but here I have students "B" and "C", I can see they same number in math but in Physics C has highest number so I will edit "C", 96, 90 and save it back to the ArrayList and so on. Here which student already edited, I will not fetch them for edit and save thr and so on. IF someone please help me! Thanks in advance

http://stackoverflow.com/q/24076439
downvote count: 0
favorite count: 0
tagged with: query-parser
tagged with: elasticsearch
answer count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: java
has title: Analyzing queries in the client side of Elasticsearch but not on the server
has body: We are migrating our Lucene based search codebase to Elasticsearch. The major problem we encountered is how we should migrate our QueryParsers. In our old solution, the QueryParsers take in a human input query string, and transform that to Lucene's Query object, which is then fed into Lucene's IndexSearcher. However, in Elasticsearch we don't directly interact with IndexSearcher, instead we can only build the queries in the client side using Query DSL and send the JSON to Elasticsearch server. Elasticsearch server then (possibly) rewrites/analyses the JSON query to build a Lucene query. To make use of our existing and sophisticated logic in QueryParsers, we decided that we can stick to our old approach by: Explicitly tell Elasticsearch to NOT analyze any query in the search time. Do ALL the query related analysis (tokenizing, synonym, etc) in the Java client. Believe that Elasticsearch's Query DSL is kind of a one-to-one mapping to Lucene's Query Don't worry about the scoring process, we are writing our scorer scripts as a Elasticsearch plugin. The questions are: Is this approach feasible? What are the potential problems in doing so? What is the best practice? Thanks in advance!
type: Question
score: 3
tagged with: lucene
tagged with: search

http://stackoverflow.com/comment/93495689
score: 7
comment on: http://stackoverflow.com/a/36522058
type: AnswerComment
has text: It might be because the cost of HotSpot compilation is incurred by whatever test is run first.
type: Comment

http://stackoverflow.com/comment/36888053
has text: Please explain how the input matches the output (what are "slabs")?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23947044

http://stackoverflow.com/a/24033663
has body: Your new_layout.xml does not have a ViewGroup with the id container to which you add/replace Fragments. .add(R.id.container, new PlaceholderFragment()) If you set activity_main.xml you had a FrameLayout with the id android:id="@+id/container" to which you add the Fragment PlaceHolderFragment. You Either get rid of if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } Or add a ViewGroup in new_layout.xml. Also have views in fragment layout and initialize them in onCreateView of Fragment. You are encouraged to use Fragments.
accepted answer of: http://stackoverflow.com/q/24033620
has comment: http://stackoverflow.com/comment/37050105
answers question: http://stackoverflow.com/q/24033620
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23973802
has answer: http://stackoverflow.com/a/23974033
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: file
tagged with: mysql
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23974033
downvote count: 0
answer count: 1
tagged with: hsqldb
has body: how can I load data from file into hsqldb table? I have this statement that works correctly in mysql and I want to change it to work for hsqldb. String sqlLoadkey ="load data local infile " +"'E:/Thesis/ThesisWork/outdata/keywords.txt'"+ " \n" + " into table "+ "keywordsTable" +"(keywords)"; stmt1.executeUpdate(sqlLoadkey); this is the exception I get java.sql.SQLSyntaxErrorException: unexpected token: LOAD at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source) at ThesisCode.ReductionTry.main(ReductionTry.java:67) Exception in thread "main" java.lang.NullPointerException at ThesisCode.ReductionTry.main(ReductionTry.java:138) Any ideas Thanks
has title: load data from file into hsqldb
favorite count: 0

http://stackoverflow.com/q/24019290
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/37169822
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24098256
has title: Java Heap Size - Young Generation Size without AdaptiveSizePolicy
answer count: 1
downvote count: 0
favorite count: 0
has body: today I've noticed a strange behaviour while sizing my java heap. As parameters to size my Young Generation I choose: -XX:NewSize=2100M -XX:MaxNewSize=2100M Additionally I switched off the AdaptiveSizePolicy with: -XX:-UseAdaptiveSizePolicy According to these 3 parameters my Young Generation should be 2100M the whole time. But when I look into my gc-log the size is just about 1900 MB (~89%). When trying a different size the young generation in the log is around the same percentage (~89%). The whole heap is 5 GB. In the logfile the size of the whole heap is good (~ 4,97 GB). The Collectors I use are PSYoungGen for Young Generation and ParallelOldGC for Old Generation. Can someone briefly explain why the young gen size is smaller than it should be?
tagged with: heap-memory

http://stackoverflow.com/a/50971134
type: Answer
has body: The answer provided by Nick is for old version. The PointLabeler method has been moved into LineAndPointFormatter. The latest working example has been provided by Nick in another thread: https://stackoverflow.com/a/39482297/9969285
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23967835

http://stackoverflow.com/comment/37219605
score: 0
type: QuestionComment
type: Comment
has text: in the log, i don't see any transaction who are created, don't think it's normal. I have a class with this annotation: @EnableTransactionManagement
comment on: http://stackoverflow.com/q/24069136

http://stackoverflow.com/q/24045908
type: Question
score: 0
answer count: 1
has body: I have four classes. One contains my linkedstack setup One is infixtopostfix for prioritization and conversion Parenthesis for matching Postfix for evaluation I have setup almost everything here but it is still returning false anyway I put it. On another note my equals on !stackMatch.pop().equals(c) is not working due to it being a object type with '!' being a problem. My programs are simple and straight forward: LinkedStack.java public class LinkedStack implements StackInterface { private Node top; public LinkedStack() { top = null; } // end default constructor public boolean isEmpty() { return top == null; } // end isEmpty public void push(Object newItem) { Node n = new Node(); n.setData(newItem); n.setNext(top); top = n; } // end push public Object pop() throws Exception { if (!isEmpty()) { Node temp = top; top = top.getNext(); return temp.getData(); } else { throw new Exception("StackException on pop: stack empty"); } // end if } // end pop public Object peek() throws Exception { if (!isEmpty()) { return top.getData(); } else { throw new Exception("StackException on peek: stack empty"); } // end if } // end peek } // end LinkedStack InfixToPostfix.java import java.util.*; public class InfixToPostfix { Parenthesis p = new Parenthesis(); LinkedStack stack = new LinkedStack(); String token = ""; // each token of the string String output = ""; // the string holding the postfix expression Character topOfStackObject = null; // the top object of the stack, converted to a Character Object char charValueOfTopOfStack = ' '; // the primitive value of the Character object /** * Convert an infix expression to postfix. If the expression is invalid, throws an exception. * @param s the infix expression * @return the postfix expression as a string * hint: StringTokenizer is very useful to this iteratively */ //public String convertToPostfix(String s) throws Exception { //} private boolean isOperand (char c){ return ((c&gt;= '0' &amp;&amp; c &lt;= '9') || (c &gt;= 'a' &amp;&amp; …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24046102
has title: Parenthesis Check within a Linked stack for infix to postfix
tagged with: stack
tagged with: java

http://stackoverflow.com/comment/37027014
comment on: http://stackoverflow.com/a/24020343
type: AnswerComment
score: 0
type: Comment
has text: Specify <view-state id="login" model="loginActionFlows"> and try.

http://stackoverflow.com/comment/37165622
comment on: http://stackoverflow.com/a/24095744
type: AnswerComment
has text: No, it does not work... The "result" as an attribute is not visible at all... The "when test" fails so the "otherwise" will be done. Why?
score: 0
type: Comment

http://stackoverflow.com/comment/37135884
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24079987
has text: @e-r-a-n: It's a matter of opinion. Creating abstract properties on the base class so it can reach out to the child classes feels wrong to me, I'd have the child classes provide that information to the base as needed (e.g., as above). But you can find a lot of examples in the wild of the approach mikea advocated. I would avoid it, but that doesn't mean you have to. The JDK does it, of course, with the various abtract classes in `java.util`, but then, looking to the JDK for OOP best design practices is probably a fairly suspect thing to do... ;-)
type: AnswerComment

http://stackoverflow.com/comment/36989810
has text: Thanks for the answer! I can get the flash to work, but I am having trouble with the timing. It looks like the code that runs the animation takes much longer to complete (about a second later than everything else). It almost appears as if this waits until everything else is done to run. Is there a way to set timings of animations? I am running very similar code to yours in a Runnable with no luck
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23960627
type: Comment

http://stackoverflow.com/comment/37065580
type: AnswerComment
type: Comment
score: 2
has text: I think you should calculate the `switch` value before the `switch` statement to make it a bit more readable.
comment on: http://stackoverflow.com/a/24042179

swt
tags question: http://stackoverflow.com/q/24007619
tags question: http://stackoverflow.com/q/24015489
tags question: http://stackoverflow.com/q/24007294
tags question: http://stackoverflow.com/q/24041022
tags question: http://stackoverflow.com/q/24035955
tags question: http://stackoverflow.com/q/24089030
tags question: http://stackoverflow.com/q/24030498
tags question: http://stackoverflow.com/q/24054811
tags question: http://stackoverflow.com/q/23969553
tags question: http://stackoverflow.com/q/24074365
tags question: http://stackoverflow.com/q/24067475
tags question: http://stackoverflow.com/q/23946694
tags question: http://stackoverflow.com/q/23972045
tags question: http://stackoverflow.com/q/24024136
tags question: http://stackoverflow.com/q/24015984
tags question: http://stackoverflow.com/q/24011016
tags question: http://stackoverflow.com/q/23981460
type: Tag
tags question: http://stackoverflow.com/q/23985519
tags question: http://stackoverflow.com/q/24016513
tag name: swt

http://stackoverflow.com/q/24090357
linked to: http://stackoverflow.com/q/5054995
possible better answer: http://stackoverflow.com/a/24091453
has answer: http://stackoverflow.com/a/24091453
has comment: http://stackoverflow.com/comment/37156214
has answer: http://stackoverflow.com/a/24090361
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37156139
tagged with: java
linked to: http://stackoverflow.com/q/280793
type: Question
has comment: http://stackoverflow.com/comment/37156475
has comment: http://stackoverflow.com/comment/37155493
tagged with: indexof
has comment: http://stackoverflow.com/comment/37155467
has comment: http://stackoverflow.com/comment/37156116
accepted answer: http://stackoverflow.com/a/24090361
has comment: http://stackoverflow.com/comment/37155604
has comment: http://stackoverflow.com/comment/37156081
tagged with: substring
has title: Case insensitive replace() method in Java (using indexOf)
tagged with: replace
score: 0
has comment: http://stackoverflow.com/comment/37155685
has body: I've needed a replace() method which could replace a needle String within a haystack String, in a case insensitive way. I also needed this to be done without any regex. I couldn't find any such method, so I've written my own. This question is to document it, in case anyone else finds it useful in future. And if any improvements can be made (without using String.replace), feel free to suggest them.
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/37156415
has comment: http://stackoverflow.com/comment/37156432
has comment: http://stackoverflow.com/comment/37156190
has comment: http://stackoverflow.com/comment/37156327

http://stackoverflow.com/comment/36913409
type: AnswerComment
comment on: http://stackoverflow.com/a/23957850
score: 0
type: Comment
has text: @user2820072 there is no notify in the join() method because the join() method is the one that's waiting. It's the thread that you're waiting _for_ that calls notify(). The thread does not immediately die when the run() method returns. The run() method was _called_ by something (e.g., by a private method of the Thread class, or by a JNI method), and that caller is what clears the isAlive() flag and then notifies the Thread object. Only then does the thread _truly_ die.

http://stackoverflow.com/comment/37187083
score: 0
comment on: http://stackoverflow.com/a/24103506
type: AnswerComment
type: Comment
has text: Of course, looking at this the next day, I realize we should have been recommending StringBuilder :)

http://stackoverflow.com/q/23971871
answer count: 1
tagged with: foreach
type: AnsweredQuestion
has body: I have a problem in Java when using a for-each construct on an ArrayList. In one class, named Graph, I have the protected attribute protected ArrayList&lt;Edge&lt;E&gt;&gt; edges In my Edge class, I have the protected attribute protected LinkedList&lt;Connector&lt;E&gt;&gt; pointers; What I'm trying to do, in my Edge class, is to define a method to print on screen each pointer of each Edge of my Graph g. I tried using different approaches getting errors everytime, and then I ended up using the for-each loop (I thought it was the best choice since I know the type of the elements in the collection I'm trying to iterate on). My code is as follows: public void printConnectors(Graph g){ for (Edge&lt;E&gt; e: g.edges){ System.out.println(e.iterator()); //I do have an iterator in my Edge class } } This is not working though, Eclipse gives me the following error: Type mismatch: Cannot convert from element type Object to Edge I know this may be a stupid error derived from something I'm not seeing in my code, but I can't get it to work. Can anyone help me and explain why the compiler tries to convert from Object to Edge even though edges should be an ArrayList of Edges?
tagged with: java
has answer: http://stackoverflow.com/a/23971898
accepted answer: http://stackoverflow.com/a/23971898
type: Question
tagged with: eclipse
tagged with: arraylist
score: 0
tagged with: iterator
linked to: http://stackoverflow.com/q/2770321
has title: for-each in Java trying to convert element types

http://stackoverflow.com/comment/36925791
comment on: http://stackoverflow.com/q/23966004
type: Comment
score: 0
has text: What has doInBackground to do with your problem? You have some code to grab a google page which is indeed a very good method to check if you have internet connection. (You did not tell in which thread or asynctask you used it but ala not important). If there is no internet connection the request times out. Very clear. Now what is the question?
type: QuestionComment

http://stackoverflow.com/a/23990629
type: Answer
has body: What is exactly the main purpose of the program? if it is just to remove the null in the String, I would do as JamasA says. Otherwise if you want to get the timestamp and the "tes" string in two clean strings I would do it in this way: String tes = b.replace("null", ""); String[] aux = tes.split("\\|"); for (int i = 0; i &lt; aux.length; i++) { System.out.println(aux[i].trim()); } In this way you get both information separated.I hope it will helpful for you :)
answers question: http://stackoverflow.com/q/23989811
score: 0

unix
tags question: http://stackoverflow.com/q/23989012
tags question: http://stackoverflow.com/q/23961676
tags question: http://stackoverflow.com/q/24080560
tags question: http://stackoverflow.com/q/23994654
tags question: http://stackoverflow.com/q/23967479
tags question: http://stackoverflow.com/q/23974583
tags question: http://stackoverflow.com/q/24074358
tags question: http://stackoverflow.com/q/24066627
type: Tag
tag name: unix

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/24083880
tags question: http://stackoverflow.com/q/24016564
tag name: google-oauth

http://stackoverflow.com/comment/36959994
has text: Is the framework actually going to use the setters, or do they just need to exist?
type: Comment
comment on: http://stackoverflow.com/q/23985124
score: 0
type: QuestionComment

http://stackoverflow.com/a/24033246
type: Answer
answers question: http://stackoverflow.com/q/24033212
has body: Does the -jar option of the java command also compile the sources before running the main method? No, absolutely not. It just specifies the jar file in which to find the manifest specifying the main class, and (usually) the class file for that class. It definitely doesn't compile anything.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37050923
upvote count: 2
has comment: http://stackoverflow.com/comment/37049743
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37050885
has comment: http://stackoverflow.com/comment/37048850
has comment: http://stackoverflow.com/comment/37049803
accepted answer of: http://stackoverflow.com/q/24033212
has comment: http://stackoverflow.com/comment/37048919

http://stackoverflow.com/comment/36900980
type: QuestionComment
has text: Consider providing proper DDLs (and/or an sqlfiddle) TOGETHER WITH THE DESIRED RESULT SET.
score: 0
comment on: http://stackoverflow.com/q/23954334
type: Comment

http://stackoverflow.com/q/24021228
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 2
has title: How to mix the processing of a Java string
tagged with: string
favorite count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24022103
accepted answer: http://stackoverflow.com/a/24022103
has comment: http://stackoverflow.com/comment/37026922
has body: Java string contains two types of words. Words of first Type are: Wx1,Wx2,Wx3,Wx4,Wx5,Wx6, Wx7 etc. Words of second Type are: Wy1,Wy2 etc. Given String str= "Wx1 Wx2 Wy1 Wx3 Wx4 Wy2 Wx5 Wx7 Wx8" First type is processed by function1(), Second type function2(), and function3() further processes the concatenated output of function1(). function1(Wx1) gives String S1 function1(Wx2) gives String S2 String S12= S1 + S2; function3(S12) returns String str1 function2(Wy1) gives String Y1 function1(Wx3) gives String S3 function1(Wx4) gives String S4 String S34= S3 + S4; function3(S34) returns String str2 function2(Wy2) gives String Y2 function1(Wx5) gives String S5 function1(Wx6) gives String S6 function1(Wx7) gives String S7 function1(Wx8) gives String S8 String S5678 = S5 + S6 + S7 + S8 function3(S5678) returns String str3 String output = str1 + Y1+ str2 + Y2 + str3; This is the whole logic my program. I am confused at last step to shape the loop that where and how to call the function3(): for(int i=0; i&lt;Words.length; i++){ if Word[i]= Type1??????????{ doThis(); ????? //somewhere here I have to call function3(), how the program will judge that the next word is of type2, hence function3 is to be called here.// WHERE AND HOW TO CALL function3(); } else {doThat(); } Being new to Programming I need the help to form the logic of the loop.
downvote count: 1
has comment: http://stackoverflow.com/comment/37026668
has comment: http://stackoverflow.com/comment/37026337

http://stackoverflow.com/comment/37005157
comment on: http://stackoverflow.com/q/24009725
type: QuestionComment
has text: Curious if you have an opportunity not to run it in cmd. IOW, have you tried it in an ide?
score: 0
type: Comment

http://stackoverflow.com/a/39749690
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24047699
upvote count: 2
has body: had similar problem, in my case I was updating an html component with a javacript, values in javascript and html seems not to agree on special characters. this quick trick can help function htmlDecode(input){ var e = document.createElement('div'); e.innerHTML = input; return e.childNodes[0].nodeValue; }
type: Answer

http://stackoverflow.com/comment/137641482
type: Comment
score: 1
has text: @andrebrait you’re developing against a contract and the contract of `Stream.generate(…).limit(…)` is that it may pick arbitrary elements instead of the “first” elements, because “first” has no meaning for an unordered Stream. Even if it happens to do the intended thing in one setup you shouldn’t rely on things that are not guaranteed. Regarding exceptions, I got one right ins the first try: https://ideone.com/Zy1KkM
type: AnswerComment
comment on: http://stackoverflow.com/a/56289986

http://stackoverflow.com/comment/36932365
comment on: http://stackoverflow.com/q/23970831
type: Comment
type: QuestionComment
has text: You would normally use a debugger to see the contents of objects during run time in java.
score: 1

http://stackoverflow.com/q/24004212
tagged with: opengl-es
type: AnsweredQuestion
tagged with: shader
tagged with: glsl
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24016955
has title: Passing attribute into shader Libgdx
tagged with: libgdx
has body: I can't figure out how to pass a custom attribute into the shader using libgdx. I have a float inside my shader: attribute float a_ParticleStartTime; I want to pass in the current time into my shader at the time of creation. I have my mesh, and can use it to specify color and position like such: mesh = new Mesh(true, MAX_VERTS, 0, new VertexAttribute(Usage.Position, POSITION_COMPONENTS, "a_position"), new VertexAttribute(Usage.Color, COLOR_COMPONENTS, "a_color")); But I'm lost on how to pass in an attribute that is not a default catergory in the Usage class. I need to pass in the current time. Does anybody know the correct way to do this? I looked at examples but found nothing. :(
score: 0
has answer: http://stackoverflow.com/a/24016955
answer count: 1

http://stackoverflow.com/comment/36903033
has text: thx for answering @mabi, yes I have this in a modal pannel in a separated h:form , I don't have a h:message, and my backing bean is view scooped.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23950898
score: 0

http://stackoverflow.com/comment/36921017
type: Comment
has text: Yes i did likte that.
type: AnswerComment
comment on: http://stackoverflow.com/a/23964173
score: 0

http://stackoverflow.com/comment/37184316
type: Comment
type: QuestionComment
has text: @thedp are you using NetBeans?
comment on: http://stackoverflow.com/q/24101643
score: 0

http://stackoverflow.com/comment/37170025
has text: `.` means any character. `\.` and `[.]` mean literal dot. `\\d` means digit, not letter.
score: 0
comment on: http://stackoverflow.com/q/24098269
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24028552
has body: Yes as @Gary Russell told you, you can use tcp gateway for it. Example : &lt;int-ip:tcp-inbound-gateway id="inGateway" request-channel="tcpChannel" reply-channel="replyChannel" connection-factory="cfServer" reply-timeout="10000"/&gt; &lt;int-ip:tcp-outbound-gateway id="outGateway" request-channel="tcpChannel" reply-channel="replyChannel" connection-factory="cfClient" request-timeout="10000" remote-timeout="10000"/&gt; Here's full documentation. Look on it.
has comment: http://stackoverflow.com/comment/37040634
downvote count: 0
has comment: http://stackoverflow.com/comment/37063141
has comment: http://stackoverflow.com/comment/37057274
has comment: http://stackoverflow.com/comment/37060106
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24013618

http://stackoverflow.com/comment/36947412
score: 2
comment on: http://stackoverflow.com/q/23979134
has text: You need `App context` for displaying this `Alert Dialog`. pass `context` to your `alertbox(context)`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24027479
answers question: http://stackoverflow.com/q/24026830
type: Answer
has body: You want to use Selenium Grid for this. To run tests in parallel with JUnit4, you will also need Maven.
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37067577
has comment: http://stackoverflow.com/comment/37067765
downvote count: 0

http://stackoverflow.com/comment/37066516
score: 0
comment on: http://stackoverflow.com/q/24042681
type: Comment
type: QuestionComment
has text: `spots` is local to the method, not the instance.

http://stackoverflow.com/q/24060970
has title: Java handle URL with special characters
has comment: http://stackoverflow.com/comment/37100958
has body: Hi I'm currently using appcelerators Titanium, so far so good except I'm have great difficulty with downloading from urls with special characters typically square brackets. The app receives information from an RSS feed which has a url with special characters, i used yahoo pipes and regex to replace these with %5B &amp; %5D which worked fine but that url is then redirected to the actual download url which also has square brackets which leaves me with an error illegal character can anyone advise on how to handle special characters in url thanks
has comment: http://stackoverflow.com/comment/37100204
tagged with: android-webview
answer count: 0
tagged with: webview
has comment: http://stackoverflow.com/comment/37100575
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37100533
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/24069265
has comment: http://stackoverflow.com/comment/37149206
has comment: http://stackoverflow.com/comment/37121365
type: Answer
score: 2
downvote count: 0
has body: Its most likely not setup as an Android Library project and that is why it can't be accessed that way. You can create the jar yourself though by using: https://stackoverflow.com/a/11289115/1784299 eclipse itself or running the jar command in a terminal. (Eclipse might be a little more user friendly if you don't use the terminal. I would however highly recommend learning how to incorporate Maven in your projects because it is a huge time saver. If you migrate to Android Studio then Maven will become your best friend.
accepted answer of: http://stackoverflow.com/q/24068995
has comment: http://stackoverflow.com/comment/37126696
answers question: http://stackoverflow.com/q/24068995
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/37178308
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24101992
has text: The only thing you can't explisitly do is create the equivalent of ``int & x``, where in two separate places in the program can assign to the same *raw* ``int`` variable and have the changes propigate. You can of course get the same effect by placing the ``int`` into some container object and passing that object around, but you can't do it with just a base ``int`` (or ``double``, ``bool``, etc).

http://stackoverflow.com/comment/37062507
comment on: http://stackoverflow.com/a/24040427
type: AnswerComment
type: Comment
score: 1
has text: You only need to declare a data source with your DB parameters (I updated my answer).

http://stackoverflow.com/q/23944507
has title: Out of memory error or program unresponsive during multithreading JAVA
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36883245
has comment: http://stackoverflow.com/comment/36883212
has comment: http://stackoverflow.com/comment/36883396
has comment: http://stackoverflow.com/comment/36883393
has body: I am new to multi threading. Literally. And I am pretty new to Java overall. HOwever, I am making a simulation and the thread seem to be working well except I occasionally have the program become unresponsive and once it said out of memory error. I assume this is because I am creating too many threads? At the point it normally does this I have over 2000 threads running at the same time. I can adjust the code (i.e reduce the number of customers or increase time between ticks) to release the pressure on the system but I am wondering if there is something I could be doing to help ease the burden within each thread itself. I'm pretty sure it isn't a deadlock since the code runs fine if I do the above but run it for longer so the same amount of customers come through. I will show the relevant parts of the code and if more is required I am happy to put this up. Please I don't understand this very well, so some very simple and helpful explanations would be greatly appreciated, since if the comment is too complex I probably wont' know how to implement it. This is the main class that creates the thread. CheckoutFloor checkoutFloor = new CheckoutFloor(); checkoutFloor.addCheckoutOperators(checkoutOperators); int tick = 0; int customers = 0; while (tick &lt; simulationTime) { for (int i = 0; i &lt; 2; i++) { Random rand = new Random(); int random = rand.nextInt(100) + 1; if (random &lt;= 50) { customerRunnable customer = new customerRunnable(checkoutFloor); Thread t = new Thread(customer); t.start(); tick++; } else { tick++; } Here is the runnable code: public void run() { try { customer.addRandomShopTime(); while (customer.shopTime &gt; 0) { Thread.sleep(1); customer.setShopTime(); } CheckoutOperator checkoutOperator = checkoutFloor.weightedCheckoutDeterminator(); checkoutOperator.addCustomer(customer); while (customer.checkoutTime &gt; 0) { Thread.sleep(1); if (checkoutOperator.customerList.get(0) == customer) { customer.setCheckoutTime(); } } checkoutOperator.removeCurrentC…
has comment: http://stackoverflow.com/comment/36883271
has comment: http://stackoverflow.com/comment/36883314
has comment: http://stackoverflow.com/comment/36883749
has comment: http://stackoverflow.com/comment/36883288
has comment: http://stackoverflow.com/comment/36883380
has comment: http://stackoverflow.com/comment/36884006
has comment: http://stackoverflow.com/comment/36883323
has comment: http://stackoverflow.com/comment/36883352
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/a/31330682
score: 9
has comment: http://stackoverflow.com/comment/58004953
has comment: http://stackoverflow.com/comment/63326949
has comment: http://stackoverflow.com/comment/58256224
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/63326435
has body: You can face this error, if you're compiling from Eclipse with m2e plugin. The workaround is to uncheck Resolve Workspace artifacts in the Maven Run Configuration.
type: Answer
accepted answer of: http://stackoverflow.com/q/23986331
upvote count: 9
answers question: http://stackoverflow.com/q/23986331
has comment: http://stackoverflow.com/comment/55278695
has comment: http://stackoverflow.com/comment/63333968
downvote count: 0

http://stackoverflow.com/comment/37120032
has text: The only way JNI will give you better performance is if you save more by doing the region calculations in native code than you lose in the Java <-> JNI <-> native call overheads.
type: Comment
comment on: http://stackoverflow.com/a/24070468
score: 1
type: AnswerComment

http://stackoverflow.com/a/23963418
answers question: http://stackoverflow.com/q/23962993
type: Answer
accepted answer of: http://stackoverflow.com/q/23962993
has body: What you need to understand is that Maven handles transitive dependencies. In your case, spring-context depends on spring-core and therefore when you declare spring-context in your pom.xml, Maven will automatically resolve the spring-core transitive dependency (that way you don't need to declare the dependencies of your dependencies and so on). spring-core has no Spring dependencies of it's own. That's why when you use it on it's own no other Spring dependency is added to the classpath You can easily inspect the dependency tree of your project using the Maven dependency plugin Plus you can see the dependencies of each module in it's Maven central page (if one exists :)). Here is the relevant page spring-context On a final note, the author of the tutorial you are following didn't need to add spring-core, it was probably just an oversight. Declaring the spring-core is a redundancy that does not cause a problem as long as the versions of the dependencies are in sync.
score: 10
upvote count: 10
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36931752
score: 0
comment on: http://stackoverflow.com/q/23970436
type: Comment
type: QuestionComment
has text: Just black screen not even action bar

http://stackoverflow.com/a/36522058
has comment: http://stackoverflow.com/comment/93495689
has comment: http://stackoverflow.com/comment/77991240
downvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24054773
upvote count: 33
score: 30
has comment: http://stackoverflow.com/comment/108766067
has body: This test shows that your second option can perform significantly better. Findings first, then the code: one filter with predicate of form u -&gt; exp1 &amp;&amp; exp2, list size 10000000, averaged over 100 runs: LongSummaryStatistics{count=100, sum=4142, min=29, average=41.420000, max=82} two filters with predicates of form u -&gt; exp1, list size 10000000, averaged over 100 runs: LongSummaryStatistics{count=100, sum=13315, min=117, average=133.150000, max=153} one filter with predicate of form predOne.and(pred2), list size 10000000, averaged over 100 runs: LongSummaryStatistics{count=100, sum=10320, min=82, average=103.200000, max=127} now the code: enum Gender { FEMALE, MALE } static class User { Gender gender; int age; public User(Gender gender, int age){ this.gender = gender; this.age = age; } public Gender getGender() { return gender; } public void setGender(Gender gender) { this.gender = gender; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } static long test1(List&lt;User&gt; users){ long time1 = System.currentTimeMillis(); users.stream() .filter((u) -&gt; u.getGender() == Gender.FEMALE &amp;&amp; u.getAge() % 2 == 0) .allMatch(u -&gt; true); // least overhead terminal function I can think of long time2 = System.currentTimeMillis(); return time2 - time1; } static long test2(List&lt;User&gt; users){ long time1 = System.currentTimeMillis(); users.stream() .filter(u -&gt; u.getGender() == Gender.FEMALE) .filter(u -&gt; u.getAge() % 2 == 0) .allMatch(u -&gt; true); // least overhead terminal function I can think of long time2 = System.currentTimeMillis(); return time2 - time1; } static long test3(List&lt;User&gt; users){ long time1 = System.currentTimeMillis(); users.stream() .filter(((Predicate&lt;User&gt;) u -&gt; u.getGender() == Gender.FEMALE).and(u -&gt; u.getAge() % 2 == 0)) .allMatch(u -&gt; true); // least overhead terminal function I can think of long time2 = System.currentTimeMillis(); return time2 - time1; } pub…
has comment: http://stackoverflow.com/comment/120994313

http://stackoverflow.com/comment/36934127
type: QuestionComment
has text: i have designed the code to do exactly what u r saying it is doing.But then, y is it not running on my pc?
score: 0
comment on: http://stackoverflow.com/q/23970046
type: Comment

http://stackoverflow.com/comment/36992708
score: 0
type: Comment
has text: No, I mean that this helps you to find a), but not b).
type: AnswerComment
comment on: http://stackoverflow.com/a/24002805

http://stackoverflow.com/q/24078122
tagged with: backup
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24080262
type: AnsweredQuestion
has body: Her is the code I use to back up my database. I succesfully get a "backup.sql" file when I run this but when I check it,it's empty. There's no data so meaning I got no backup but an empty sql file instead. Furthurmore, when I run this program, the system hangs and I have to end the process through task manager. public void Backupdbtosql() throws IOException, InterruptedException { String executeCmd = ""; executeCmd ="mysqldump -u root -p root mydb--add-drop-database -r D:\\database\\backup.sql"; Process runtimeProcess =Runtime.getRuntime().exec(executeCmd); int processComplete = runtimeProcess.waitFor(); if(processComplete == 0){ System.out.println("Backup taken successfully"); } else { out.println("Could not take mysql backup"); } }
has title: MySQL database backup creates an empty file
tagged with: java
tagged with: mysql
upvote count: 1
accepted answer: http://stackoverflow.com/a/24080262
type: Question

http://stackoverflow.com/a/24052664
has body: @Entity public class ObjectAttribute { @Id private int id; @Id &lt;------------------------ try to remove this annotation @ManyToOne @JoinColumn(name="objectId") private Object object; private String name; } It thinks your ObjectAttribute has 2 ids compound key UPDATE: If it really has compound multi column primary key you should reference both columns
type: Answer
accepted answer of: http://stackoverflow.com/q/24052580
score: 14
has comment: http://stackoverflow.com/comment/37085984
upvote count: 14
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24052580
downvote count: 0
has comment: http://stackoverflow.com/comment/37086414
has comment: http://stackoverflow.com/comment/37085206
has comment: http://stackoverflow.com/comment/37085158

http://stackoverflow.com/q/24002714
tagged with: ffmpeg
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8354168
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24002896
has title: use ffmpeg in java ubuntu
has body: i try to convert video using ffmpeg in ubuntu. ffmpeg -i inputfile.flv -sameq outputfile.mpeg this works if change directory to inputfile directory. is that posible to use this command ? ffmpeg -i "home/Documents/inputfile.flv" -sameq "home/Documents/outputfile.mpeg" i don't want to change directory when i use that command, because that command is using for my java code. so my input file and output file is variable in my code . here's my full code package Converter; import Controller.ConvertedButtonListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Arrays; /** * * @author roylisto */ public class VideoConverter { private String defaultFile; private String convertedFile; private ConverterThread myThread; private ConvertedButtonListener butListener; public VideoConverter(String fileDir,String convertOutput,ConvertedButtonListener buttonListener){ this.defaultFile=fileDir; this.convertedFile=convertOutput; this.butListener=buttonListener; } public void convertToMjpeg(){ String[] listCommands={"ffmpeg","-i","\""+defaultFile+"\"","-qscale","0","\""+convertedFile+"\""}; myThread=new ConverterThread(listCommands,this); myThread.start(); } public void setCommandStream(String stream){ butListener.setCommandOutput(stream); } class ConverterThread extends Thread{ VideoConverter vc; String[] command; ConverterThread(String[] command,VideoConverter vc){ this.command=command; this.vc=vc; } public void run(){ synchronized(vc){ try{ String s = null; Process process = new ProcessBuilder(command).start(); BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream())); StringBuffer start= new StringBuffer(); // read the output from the command while ((s = stdInput.readLine()) != null) { start.append(s); vc.setCommandStream(s); } stdInput.close()…
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/36993503
score: 0
has comment: http://stackoverflow.com/comment/36995632
answer count: 1
tagged with: directory

http://stackoverflow.com/a/24656227
has body: Thanks to the hint from Tushar Mishra in the comments I was able to track down the origin of the error and why it occurs in one case but not in the other. I'll try to explain in short, maybe it'll save someone some research time (or remember me if I perhaps run into this or a similar error again). When closing either the AnnotationConfigApplicationContext-object (UC1) or the AnnotationConfigApplicationContext-object (UC2) with ctx.close(), from somewhere org.springframework.beans.factory.DisposableBean#destroy() is invoked. As far as I understood, within there used singleton beans get destroyed by invoking the destroy()-methods of each of those beans. In short: closing the XXApplicationContext-object also destroys the MongoFactoryBean and with it closes the connection to the MongoDB. So using c**tx.close()** at the described position leads to using a MongoOperations-object on a closed connection at the next line, resulting in the described NullPointerException. And for why the sample code with Annotations (UC1) runs fine, whereas the sample code configured with XML (UC2) just breaks with an NullPointerException: In UC1, the org.springframework.beans.factory.DisposableBean#destroy()-call is interupted by some DisposableBeanMethodInterceptor, which tries to redirect to a dispose() method. But there is no method implemented in MongoFactoryBean, so the Mongo-connection stays alive and can be used even after ctx.close() was invoked. I think the connection will get killed later by the garbage collector, leading to the same error. I'm not sure what to make of this, yet. If I should implement a dispose()-method myself or something alike. But at least I figured out, why this code sample behave different, although supposed to do the same thing. Maybe it helps someone. Thanks again, Tushar, for giving a hint to the right direction.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24056776
answers question: http://stackoverflow.com/q/24056776
type: Answer

http://stackoverflow.com/comment/37155791
comment on: http://stackoverflow.com/q/24089740
score: 0
type: Comment
type: QuestionComment
has text: I tried with the following:s = new String("b2622f5e1310a0aa14b7f957fe4246fa".getBytes(), "UTF-16"); System.out.println(MurmurHash3.murmurhash3_x86_32(s.getBytes(), 0, s.length(), MURMUR_SEED)); I still see difference

http://stackoverflow.com/a/23974333
has comment: http://stackoverflow.com/comment/37063977
downvote count: 0
has body: This seems to work fine: // Can do a weighted sort on weighted items. public interface Weighted { int getWeight(); } /** * Weighted sort of an array - orders them at random but the weight of each * item makes it more likely to be earlier. * * @param values */ public static void weightedSort(Weighted[] values) { // Build a list containing as many of each item to make up the full weight. List&lt;Weighted&gt; full = new ArrayList&lt;&gt;(); for (Weighted v : values) { // Add a v weight times. for (int i = 0; i &lt; v.getWeight(); i++) { full.add(v); } } // Shuffle it. Collections.shuffle(full); // Roll them out in the order required. int i = 0; do { // Get the first one in the shuffled list. Weighted next = full.get(0); // Put it back into the array. values[i++] = next; // Remove all occurrences of that one from the list. full.remove(next); } while (!full.isEmpty()); } // A bunch of weighted items. enum Heavies implements Weighted { Rare(1), Few(3), Common(6); final int weight; Heavies(int weight) { this.weight = weight; } @Override public int getWeight() { return weight; } } public void test() { Weighted[] w = Heavies.values(); for (int i = 0; i &lt; 10; i++) { // Sort it weighted. weightedSort(w); // What did we get. System.out.println(Arrays.toString(w)); } } Essentially for each item to be sorted I add it as many times as needed to a new list. I then shuffle the list and pull the top one out and clar all occurrences of it from the remaining. The last test run produced: [Rare, Common, Few] [Common, Rare, Few] [Few, Common, Rare] [Common, Few, Rare] [Common, Rare, Few] [Few, Rare, Common] which seems to be about right. NB - this algorithm will fail under at least the following conditions: The original array has the same object in it more than once. The weights of the items are insanely huge. Zero or negative weights will almost certainly mess with the results. Added This implements Rossum's idea - please be sure to give him the credit for the algorithm. public static…
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23971365
answers question: http://stackoverflow.com/q/23971365
has comment: http://stackoverflow.com/comment/36954601
type: Answer
has comment: http://stackoverflow.com/comment/36950991
has comment: http://stackoverflow.com/comment/36953351
score: 2

http://stackoverflow.com/q/23966048
has title: HSQLDB connection error
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23966068
score: 0
answer count: 1
tagged with: hsqldb
has body: I created a java program for connect the HSQLDB , the first one works well, public final static String DRIVER = "org.hsqldb.jdbcDriver"; public final static String URL = "jdbc:hsqldb:file:F:/hsqlTest/data/db"; public final static String DBNAME = "SA"; but these are not public final static String DRIVER = "org.hsqldb.jdbcDriver"; public final static String URL = "jdbc:hsqldb:file:C:/Program Files/tich Tools/mos tech/app/data/db/t1/t2/01/db"; public final static String DBNAME = "SA"; the error shows like this: java.sql.SQLException: error in script file line: 1 unexpected token: ? at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.&lt;init&gt;(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at HSQLDBManagerImp.getconn(HSQLDBManagerImp.java:48) at TESTHSQLDB.main(TESTHSQLDB.java:15) Caused by: org.hsqldb.HsqlException: error in script file line: 1 unexpected token: ? at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.scriptio.ScriptReaderText.readDDL(Unknown Source) at org.hsqldb.scriptio.ScriptReaderBase.readAll(Unknown Source) at org.hsqldb.persist.Log.processScript(Unknown Source) at org.hsqldb.persist.Log.open(Unknown Source) at org.hsqldb.persist.Logger.openPersistence(Unknown Source) at org.hsqldb.Database.reopen(Unknown Source) at org.hsqldb.Database.open(Unknown Source) at org.hsqldb.DatabaseManager.getDatabase(Unknown Source) at org.hsqldb.DatabaseManager.newSession(Unknown Source) ... 7 more Caused by: org.hsqldb.HsqlException: unexpected token: ? at org.hsqldb.error.Error.parseError(Unknown Source) at org.hsqldb.ParserBase.unexpectedToken(Unknown Source) at org.hsqldb.ParserCommand.compilePart(Unknown Source) at org.hsqldb.ParserCommand.compileStatement(Unknown Source) …
favorite count: 0
accepted answer: http://stackoverflow.com/a/23966068
upvote count: 1

http://stackoverflow.com/q/24055345
score: 1
has comment: http://stackoverflow.com/comment/37090175
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24055421
has comment: http://stackoverflow.com/comment/37090078
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24055421
has body: Looking for the best practice Java approach for the following problem. I have a (relatively) long string and a set of (non-overlapping) changes to make to it - lets say the changes have the signature: change(int startIndex, int endIndex, String replacement); and an example would be assert doChange("aaa",new Change(1,2,"hello")).equals("aHelloa"); My plan is to work backwards (so the changing indexes are avoided) though the string splitting into three peices each time and then stitching in the replacement. But I can imagine this has a much more effective/java-like approach... is there an API call I've missed?
has comment: http://stackoverflow.com/comment/37090149
tagged with: replace
has title: Making a set of changes to a string in Java - best practice approach
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23946921
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6990663
has answer: http://stackoverflow.com/a/23946945
score: 0
answer count: 1
tagged with: url
has body: I am making a game in libdgx and storing a high-score list online in a file. One of my computers is able to access the file online, while the other computer connected to the same router cannot. I tried turning off the firewall but it has not helped. What may be the cause of this problem? try { URL url = new URL("ftp://.............highscores.txt"); InputStream in = url.openStream(); java.util.Scanner s = new java.util.Scanner(in).useDelimiter(" "); for(int i=0;i&lt;5;i++) { scores[i] = s.nextInt(); } for(int i=0;i&lt;5;i++) { names[i] = s.next(); } } catch(java.io.IOException e){} Here is the stack trace java.net.SocketException: Permission denied: recv failed 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) at sun.net.ftp.impl.FtpClient.readServerResponse(FtpClient.java:421) at sun.net.ftp.impl.FtpClient.readReply(FtpClient.java:498) at sun.net.ftp.impl.FtpClient.issueCommand(FtpClient.java:533) at sun.net.ftp.impl.FtpClient.issueCommandCheck(FtpClient.java:544) at sun.net.ftp.impl.FtpClient.openPassiveDataConnection(FtpClient.java:607) at sun.net.ftp.impl.FtpClient.openDataConnection(FtpClient.java:710) at sun.net.ftp.impl.FtpClient.getFileStream(FtpClient.java:1284) at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:428) at java.net.URL.openStream(URL.java:1037)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36888588
has title: Java url.openStream() not working on some computers

http://stackoverflow.com/q/24097678
score: 0
accepted answer: http://stackoverflow.com/a/24097700
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24097700
upvote count: 1
downvote count: 1
type: Question
tagged with: android-arrayadapter
tagged with: java
has comment: http://stackoverflow.com/comment/37168899
has title: Android: Array Adapter not displaying ListView
tagged with: listview
has body: My Adapter: import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; public class NewAdapter extends ArrayAdapter&lt;Presenter&gt; { Context context; List&lt;Presenter&gt; presenterList; private LayoutInflater mmInflater; public NewAdapter(Context context, List&lt;Presenter&gt; data) { super(context, R.layout.listview_item_row_presenters); mmInflater = LayoutInflater.from(context); this.context = context; this.presenterList = data; } @Override public View getView(int position, View convertView, ViewGroup parent) { View itemView = convertView; if (itemView == null) { itemView = mmInflater.inflate(R.layout.listview_item_row_presenters, parent, false); } Presenter currentPresenter = presenterList.get(position); ImageView imageView = (ImageView)itemView.findViewById(R.id.imgIcon); imageView.setImageBitmap(currentPresenter.getImage()); TextView titleText = (TextView) itemView.findViewById(R.id.txtTitle); titleText.setText(currentPresenter.getName()); TextView descripText = (TextView) itemView.findViewById(R.id.txtAbout); descripText.setText(currentPresenter.getInfo()); return itemView; } } The Method which calls &amp; sets adapter to ListView private void populateListView(List&lt;Presenter&gt; presList) { ArrayAdapter&lt;Presenter&gt; adapter = new NewAdapter(this.getBaseContext(), presList); ListView list = (ListView) findViewById(R.id.listViewPres); list.setAdapter(adapter); } I have Logcat output which proves non of the data is null or empty, non errors or anything :/ I can only guess it is any issue with the context &amp; inflator but it eludes me as to why Thank you In Advance

http://stackoverflow.com/q/24007076
has answer: http://stackoverflow.com/a/24095573
tagged with: playframework-2.2
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: playframework-2.3
score: 1
tagged with: java
has body: I have a pretty simple application that I want to upgrade from 2.1.x to 2.3.0 with deadbolt. While Deadbolt hasn't officially came out for 2.3.x, the versions for 2.2.x should be good enough (also, this error occurs on 2.2.x). I have a simple check in a template for if subject is present @subjectPresent() { Hi } Yet I get a compiler error bad symbolic reference. A signature in subjectPresent.class refers to term templates in package play which is not available. It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling subjectPresent.class. Now, this would seemingly point to some sort of path issue, but I am just unsure of how to go about fixing it. My build.sbt has the proper resolvers resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.io/releases/"))(Resolver.ivyStylePatterns), resolvers += Resolver.url("Objectify Play Snapshot Repository", url("http://schaloner.github.io/snapshots/"))(Resolver.ivyStylePatterns) and declares the dependencies val appDependencies = Seq( // ..... "be.objectify" %% "deadbolt-java" % "2.2.1-RC2" ) Any suggestions?
type: Question
tagged with: deadbolt
has title: Play Framework Migrate from 2.1.x to 2.3.0 with Deadbolt
downvote count: 0
answer count: 1

http://stackoverflow.com/q/24005900
has comment: http://stackoverflow.com/comment/37007060
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24008115
has title: How to retrieve maximum value of a integer column from access database in java program?
has comment: http://stackoverflow.com/comment/37006973
score: 1
has comment: http://stackoverflow.com/comment/36998099
tagged with: java
upvote count: 1
tagged with: swing
has body: I am working on a project "Hospital Management System" in java swing. Now I have a text field whose value is supposed to be increased by one whenever page loads. It basically contain the value of patient Id. Now I want to retrieve the maximum or last value from database and increase it by one and want to set that value in a text field whose variable is "textField_1". Here table name is "patient" and column name is "patid" and this snippet is written in page load event. Select query is successfully executed but the problem is not fetching the maximum value from the database. Control reached in the if block but it's not printing the value if "i". Please help!! try { Connection con; Statement st; ResultSet rs; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("Jdbc:Odbc:hos_man"); st=con.createStatement(); rs=st.executeQuery("select * from patient where patid = (select max(patid) from patient);"); if (rs.next()==true) { int i=rs.getInt(1); i++; textField_1.setText(""+i); } else { textField_1.setText(""+100); } con.close(); st.close(); rs.close(); } catch (Exception e) { }
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24008115

http://stackoverflow.com/comment/37132538
comment on: http://stackoverflow.com/a/24076813
has text: It really is awesome.. But what if my app needs a database and how to deploy the database too to the client system (with all table schemas, by handling the burdens of changing port number, user_name, password). I need a solution to create a new war file for each new system I need my app to deploy, as Port number and all changes for each new system.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24027719
has comment: http://stackoverflow.com/comment/37113809
score: 0
answer count: 0
has title: c3p0 more faster in Eclipse and more slow in .jar
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/20716017
has body: I have a Java Swing desktop system, and I try to use the c3p0 for resource pool. In Eclipse, the time for connection in remote MySQL hosted in DigitalOcean droplet is 8 seconds, because the c3p0 use 4 pool connections. The image below show 4 C3P0PooledConnectionPoolManager: But in Jar distribution file, the time for connect in database is over 22 seconds. I try to use BoneCP and others providers (like HikariCP) and not working for me in remote database. My Hibernate configuration file is below: <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> com.mysql.jdbc.Driver org.hibernate.dialect.MySQLDialect org.hibernate.connection.C3P0ConnectionProvider 5 1000 5 1 50 300 180 200 1800 4 true <mapping class="core.UsNameView" /> Edit: i include more information of my desktop Java program: Configuration conf = new Configuration().configure(); //String tipoAtualizacaoT = "update"; // tipoAtualizacaoT = "validate"; // tipoAtualizacaoT = "create"; String tipoAtualizacaoT = "none"; conf.configure("/conexaoMySQL/hibernate.cfg.xml") .setProperty( "hibernate.connection.url", "jdbc:mysql://" + Principal.connectionHost + ":3306/" + Principal.databaseName) .setProperty("hibernate.connection.username", "user") .setProperty("hibernate.connection.password", "valPassword") .setProperty("hibernate.hbm2ddl.auto", tipoAtualizacaoT); serviceRegistry = new StandardServiceRegistryBuilder() .applySettings(conf.getProperties()).build(); sessionFactory = conf.buildSessionFactory(serviceRegistry); And my sourcecode in Login frame (in test connection): SessionFactory sessionFactory1; ServiceRegistry serviceRegistry; Configuration conf = new Configuration() .configure(); conf.configure("/conexaoMySQL/hibernate.cfg.xml") .setProperty( "hibernate.connection.url", "jdbc:mysql://" + Principal.connectionHost + ":3306/" + Principal.databaseName) .setProperty( "hibernate.connection.username", "val") .setProperty( "hibernate.connection.password", "valPass") .setProperty("hibernate.hbm2ddl.auto",…
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/37055184
has comment: http://stackoverflow.com/comment/37039313
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37039439
has comment: http://stackoverflow.com/comment/37039217

http://stackoverflow.com/comment/36880559
score: 2
comment on: http://stackoverflow.com/q/23943102
has text: try `long x = 2147483648;` versus `long x = 2147483648L;` ;-)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37166418
has text: @BartoszKP I think its somewhat happened in `defaultReadObject` method. Let me discover it more.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24096194
type: AnswerComment

http://stackoverflow.com/a/24060077
answers question: http://stackoverflow.com/q/24059266
downvote count: 1
type: Answer
has body: Use Base64 encoding Assuming you got your ByteArrayOutputStream : ByteArrayOutputStream baos =... String s = new String(Base64.Encoder.encode(baos.toByteArray())); See http://docs.oracle.com/javase/8/docs/api/java/util/Base64.Encoder.html
has comment: http://stackoverflow.com/comment/113225705
has comment: http://stackoverflow.com/comment/37099177
has comment: http://stackoverflow.com/comment/56017480
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/81486715

http://stackoverflow.com/comment/37150338
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24087576
has text: Try with [NSRunLoop mainRunLoop] instead of [NSRunLoop currentRunLoop]
score: 0

http://stackoverflow.com/comment/37101481
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/55136/discussion-between-jens-and-wawanopoulos).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24057065

http://stackoverflow.com/comment/37064892
comment on: http://stackoverflow.com/a/24023333
type: AnswerComment
has text: @njzk2 editted in `AsyncTask` which is specifically for UI threads
score: 0
type: Comment

http://stackoverflow.com/a/23944162
has comment: http://stackoverflow.com/comment/36882629
answers question: http://stackoverflow.com/q/23943410
type: Answer
score: 0
has body: It is normal behavior. Maven crate jar from src (only production code). If you want add test .class to jar you have to create your own maven plugin. Check this Guide for maven plugin development

http://stackoverflow.com/comment/36897748
type: Comment
comment on: http://stackoverflow.com/q/23952410
has text: @Mena posting the whole JSON String from the url wouldn't help, here is the String after been parsed by online JSON viewer. You can See that the 'i' is from the first field id
score: 0
type: QuestionComment

http://stackoverflow.com/a/24098058
has body: This doesn't seem like random number generation, it seems like randomly shuffling a Collection. In Java 8: public static void main(String[] args) { final int min = 0; final int max = 10; final List&lt;Integer&gt; nums = IntStream.rangeClosed(min, max). boxed(). collect(toList()); Collections.shuffle(nums); nums.forEach(System.out::println); } Output: 3 10 5 0 8 7 9 2 1 4 6 Each number [0, 10] appears only once in a random order.
score: 2
has comment: http://stackoverflow.com/comment/37193324
downvote count: 1
upvote count: 3
has comment: http://stackoverflow.com/comment/37169573
has comment: http://stackoverflow.com/comment/37193276
answers question: http://stackoverflow.com/q/24097920
type: Answer

http://stackoverflow.com/q/23957644
has body: I want to get some JSON code from my API. I wish to do something like this in the OnCreate: try { String jsonstr = getSomeThingAndPauseAndroid("http://someplace.com/api/xyz"); if (!jsonstr.isEmpty()) JSONObject jsonobj = new JSONObject(jsonstr); } catch { // handle error } But when it happens, Android just go doing stuff and don't wait for the request to complete and response and I get nothing on jsonstr. Is there some way to do that not needing a lot of new class files?
has comment: http://stackoverflow.com/comment/36911701
tagged with: android
tagged with: getjson
has comment: http://stackoverflow.com/comment/36907630
has title: How to receive data from web asynchronous and use the result string in the next line of code?
type: AnsweredQuestion
tagged with: java
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/36908152
has answer: http://stackoverflow.com/a/23959493
accepted answer: http://stackoverflow.com/a/23959493
linked to: http://stackoverflow.com/q/23833977
score: 0
answer count: 1

http://stackoverflow.com/comment/36910934
has text: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740149(v=vs.85).aspx
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23959321

http://stackoverflow.com/comment/37078724
comment on: http://stackoverflow.com/q/24048907
has text: @user3580294 But counting only vowels and leaving the rest to be consonants would lead to the opposite of what you want exactly because you said "letter", not "character" :P
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36969867
type: Comment
comment on: http://stackoverflow.com/a/23991029
type: AnswerComment
has text: post `loadJSONFromAsset()`. It should work. Is getting json as a string code part right?
score: 0

http://stackoverflow.com/q/23984654
has comment: http://stackoverflow.com/comment/36958126
has answer: http://stackoverflow.com/a/34176480
has comment: http://stackoverflow.com/comment/36958142
has answer: http://stackoverflow.com/a/23984789
has answer: http://stackoverflow.com/a/23984813
has answer: http://stackoverflow.com/a/23985063
favorite count: 0
has comment: http://stackoverflow.com/comment/36958255
answer count: 5
accepted answer: http://stackoverflow.com/a/23985063
possible better answer: http://stackoverflow.com/a/23984714
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23984714
has body: I have to write a code for printing all palindrome numbers up to 1000. Here is my code. I have dealt with 3 scenarios: 1-digit number 2-digit number 3-digit number My third scenario is not printing just the palindromes but prints all the numbers. A hint will help me solve this. public class PrintPalindrome { public static void main(String args[]) { Integer[] array=new Integer[1000]; for(int i=0;i&lt;array.length;i++) { array[i]=i+1; printPalindrome(array[i]); //System.out.println(array[i]); } } public static void printPalindrome(Integer a) { String num=Integer.toString(a); int length=num.length()-1; //System.out.println(num); if(num.length()&lt;=1) { System.out.println("" + num); } else if(num.length()==2) { if(num.charAt(0)==num.charAt(1)) System.out.println(num); } else if(num.length()&gt;2) { //now deal with the numbers whose length is greater than 2 for(int i=0;i&lt;=length;i++) { if(num.charAt(i)==num.charAt(length-i)) System.out.println(num); } } } }
has title: How to print all palindromes upto 1000 without using any String,StringBuilder?
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36958134
has comment: http://stackoverflow.com/comment/36958223
tagged with: palindrome

http://stackoverflow.com/comment/36983098
has text: Yes, in fact, I work with stuts2 in this application
type: AnswerComment
comment on: http://stackoverflow.com/a/23994316
score: 0
type: Comment

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/24031383
tag name: android-scrollview

http://stackoverflow.com/q/23953208
score: 1
tagged with: java
tagged with: client-server
has body: I need to add news part to my android application. For example some application shows a notification that says the new version is available or our new product has been released. Some application shows this once and some of the shows each time the Internet is available. Is there a class for server and client side of this parts? thank you for your help
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23953362
type: UnansweredQuestion
upvote count: 1
type: Question
has title: news part of android application

http://stackoverflow.com/q/23977856
upvote count: 10
has comment: http://stackoverflow.com/comment/36945169
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23978150
has answer: http://stackoverflow.com/a/23977876
downvote count: 0
has answer: http://stackoverflow.com/a/23978150
tagged with: java
has answer: http://stackoverflow.com/a/23980860
has answer: http://stackoverflow.com/a/23978104
type: Question
has title: Are hashCodes unique for Strings?
has body: Recently, I came across a piece of code, where Map&lt;Integer, String&gt; is used, where Integer(key) is hashCode of some string and String value corresponding to that. Is this right thing to do? Because now, equals will not be called for the String when calling get. (get is also done using hashCode() method on String object. Or, hashCode(s) are unique for unique Strings? I checked equals od String class. There is logic written for that. I am confused.
has comment: http://stackoverflow.com/comment/36945191
tagged with: hashcode
score: 10
has comment: http://stackoverflow.com/comment/36946085
has comment: http://stackoverflow.com/comment/36945198
favorite count: 0
accepted answer: http://stackoverflow.com/a/23977876
has answer: http://stackoverflow.com/a/23978386
answer count: 5

http://stackoverflow.com/a/24035935
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37055177
type: Answer
has comment: http://stackoverflow.com/comment/37054632
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37055068
has comment: http://stackoverflow.com/comment/37054621
has body: ah yeah I see now :) In that case it's a bit more involved, you need to use application wide actions, or well an application-wide key listener, because KeyListeners won't work on containers when a child component has the focus... See this question Setting up application wide Key Listeners edit: sure there's always a quick and dirty fix :p try this: public class Test2 extends JFrame { private boolean $isPressed; /* * To check if we already listened to a key * press event */ /** * Constructor to make a new quiz */ public Test2() { this.setTitle(""); $isPressed = false; setFocusable(true); getContentPane().setLayout(new BorderLayout()); JButton b = new JButton(); b.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { // TODO Auto-generated method stub } @Override public void focusGained(FocusEvent e) { Test2.this.requestFocus(); } }); getContentPane().add(b); /* Add a keylistener for every team */ addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { System.out.println("TEST"); } }); $isPressed = false; b.grabFocus(); pack(); } /** * @param args */ public static void main(String[] args) { new Test2().setVisible(true); } } so essentially you can add a focus listener to your components.. but then for this particular hack you'll need to do it for all your child components... obviously you'd only need to define one FocusListener and you can reuse it everywhere, but generally there's a reason for why a component has focus so you don't want to just make it lose focus.. but maybe in your case it doesn't matter. so just to clarify, without the FocusListener on the JButton above, "TEST" gets printed in the console until I click on the button, then it no longer works. Then with the FocusListener, it will always work because the JFrame will regain focus when the button has the focus, so the KeyListener on it will work again. Another way to solve this problem would be to define one instance of the KeyAdapter, and set it as KeyList…
has comment: http://stackoverflow.com/comment/37055271
answers question: http://stackoverflow.com/q/24035245
has comment: http://stackoverflow.com/comment/37054169
accepted answer of: http://stackoverflow.com/q/24035245
has comment: http://stackoverflow.com/comment/37054611
has comment: http://stackoverflow.com/comment/37053563
has comment: http://stackoverflow.com/comment/37054341

http://stackoverflow.com/comment/37063977
comment on: http://stackoverflow.com/a/23974333
has text: Dunno who gave me -1, but if you use flags for marking items on place instead of new ArrayList(Arrays.asList(values)) and remaining.remove(picked), it will be more effective. Memory management and GC are not for free.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24049648
type: Answer
answers question: http://stackoverflow.com/q/24049285
has body: I fixed it. Here is the problem: To start the test application, I had made a new project in eclipse. This comes with 2 layouts (activity_main and fragment_main). I had seen the hello world text in the fragment_main layout, and for some reason I had added my linearLayout into that xml incorrectly. While I was thinking I was pointing it to the correct layout, the system was seeing that the layout was, indeed, not existent where I thought it was. Simply overlooked it. Cooked me for about 2 hours on this little mistake.
score: 0

http://stackoverflow.com/q/24015662
has answer: http://stackoverflow.com/a/24015702
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37016067
tagged with: java
type: Question
has title: ${} - Regex Expression
score: 3
has answer: http://stackoverflow.com/a/69749884
possible better answer: http://stackoverflow.com/a/24015702
upvote count: 3
has answer: http://stackoverflow.com/a/24016081
answer count: 3
accepted answer: http://stackoverflow.com/a/24016081
downvote count: 0
favorite count: 0
has body: I really tried to learn Regex expressions correctly, but, it really blows my mind when I need to build one of them. It`s painful and I lost several hours to build them. So, I need the community help. I`ve an XML String, and I want to build a Regex pattern to identify any occurence of: ${Variable1} ${VARIABLE_TEST} etc. So, anything that starts with ${ and ends with }. Could anyone help-me?

http://stackoverflow.com/q/23977688
score: 42
has answer: http://stackoverflow.com/a/78777816
favorite count: 0
has answer: http://stackoverflow.com/a/31880978
tagged with: elasticsearch
upvote count: 42
type: AnsweredQuestion
downvote count: 0
tagged with: liquibase
has title: Liquibase or Flyway database migration alternative for Elasticsearch
type: Question
has body: I am pretty new to ES. I have been trying to search for a db migration tool for long and I could not find one. I am wondering if anyone could help to point me to the right direction. I would be using Elasticsearch as a primary datastore in my project. I would like to version all mapping and configuration changes / data import / data upgrades scripts which I run as I develop new modules in my project. In the past I used database versioning tools like Flyway or Liquibase. Are there any frameworks / scripts or methods I could use with ES to achieve something similar ? Does anyone have any experience doing this by hand using scripts and run migration scripts at least upgrade scripts. Thanks in advance!
tagged with: java
accepted answer: http://stackoverflow.com/a/31880978
tagged with: flyway
answer count: 2
linked to: http://stackoverflow.com/q/43373826
tagged with: migration
possible better answer: http://stackoverflow.com/a/78777816

http://stackoverflow.com/comment/37046606
type: Comment
has text: can you write up some pseudo code or something, im not 100% sure I am following. Your idea of a queue with runnables in them makes sense but I dont follow the "recalling" of them sense launching a new thread is as simple as creating a new thread with a (new or reused) runnable. Or even just calling `Thread.start` one more time
score: 0
comment on: http://stackoverflow.com/q/24031857
type: QuestionComment

http://stackoverflow.com/comment/37049779
type: QuestionComment
has text: you can post the stacktrace since you say app crashes.
comment on: http://stackoverflow.com/q/24033620
score: 0
type: Comment

http://stackoverflow.com/q/24072551
has answer: http://stackoverflow.com/a/24072597
has comment: http://stackoverflow.com/comment/37180558
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37123194
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/37123080
has title: Managing database connections in multi-threaded socket server
accepted answer: http://stackoverflow.com/a/24072597
answer count: 1
has comment: http://stackoverflow.com/comment/37122154
has comment: http://stackoverflow.com/comment/37121985
has comment: http://stackoverflow.com/comment/37234128
has body: I have a simple udp server that accepts packets, decodes the packets and inserts them into the database. Since there can be 100,000 concurrent connections, each with time-sensitive data, the data needs to be inserted into the database as quickly as possible. In order to acheive this, I use a ExecutorService with 50 threads. When packet comes in, one of the threads in pool is used to process the data: // UdpServer public void run() { ExecutorService executor = Executors.newFixedThreadPool(50); while (listening) { try { byte[] buf = new byte[256]; DatagramPacket packet = new DatagramPacket(buf, buf.length); socket.receive(packet); executor.execute(new Responder(socket, packet)); } catch (IOException e) { e.printStackTrace(); } } } Since I have a thread pool, I figured I didn't need a database pool, because at start up each thread can open a database connection. So this is what I did for each Responder thread: // Responder class public void run() { this.connection = DriverManager.getConnection(url, username, password); processPacket(); connection.close(); } private void processPacket(){ Report report = ReportParser.readReport(packet); report.setConnection(connection); report.save(); } // Report class public void save(){ stmt = connection.createStatement(); rs = stmt.executeQuery(...); } The problem is it seems when the program starts, it doesn't immediately establish the database connections for each thread. When the packet is sent to server, there is several seconds delay before data is inserted, and this is only one packet. Imagine 100,000. Would I be better off using a a database pool (like BoneCP) in combination with the thread pool, or would the database pool not aid performance in this situation?
score: 0
tagged with: multithreading

http://stackoverflow.com/q/24100736
has comment: http://stackoverflow.com/comment/37175113
has comment: http://stackoverflow.com/comment/37174770
has comment: http://stackoverflow.com/comment/37174849
has comment: http://stackoverflow.com/comment/37175394
has body: I know that UnsupportedClassVersionError happens when trying to run code compiled with newer versions of the JDK, such as Java 1.7 on a Java 1.6 JDK. I don't understand why this would happen. The compiled code is bytecode and, as I understand bytecode, it is a very simple and minimal version of the code. For example Java's 8 lambdas are just methods in the byte code, since methods are supported from JDK 1.0 there should not be a problem running code compiled in JDK 8 on JDK 1. What changes to later Java versions would preclude a Java class compiled with a newer JDK from running on an older JDK? Thanks!
has comment: http://stackoverflow.com/comment/37174845
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37175160
downvote count: 1
type: Question
has title: Since all Java compiles to bytecode, why would you ever get an UnsupportedClassVersionError?
has comment: http://stackoverflow.com/comment/37175472
has comment: http://stackoverflow.com/comment/37175066
has comment: http://stackoverflow.com/comment/37174989
has comment: http://stackoverflow.com/comment/37174814
has comment: http://stackoverflow.com/comment/37174897
has comment: http://stackoverflow.com/comment/37175505
score: 0
has comment: http://stackoverflow.com/comment/37175097
linked to: http://stackoverflow.com/q/23856770
has comment: http://stackoverflow.com/comment/37175545
favorite count: 0
type: UnansweredQuestion
tagged with: unsupported-class-version

http://stackoverflow.com/q/23960512
tagged with: android
answer count: 0
tagged with: java
has title: Cannot instantiate the type MenuItem
type: Question
tagged with: instantiation
has body: I have a class MenuItem, and a class ContentResolverMenuItem which grabs data from my SQLite database and inserts it into a local MenuItem object. They were working fine until the MenuItem class got deleted somehow. I rewrote the class, and now in ContentResolverMenuItem I'm getting an error when trying to instantiate an instance of MenuItem. MenuItem: public class MenuItem { int menuItemId; int subcategoryId; String name; String description; String picturePath; double price; public MenuItem(){}; public MenuItem(int menuItemId, int subcategoryId, String name, String description, String picturePath, double price) { this.menuItemId = menuItemId; this.subcategoryId = subcategoryId; this.name = name; this.description = description; this.picturePath = picturePath; this.price = price; } public int getMenuItemId() { return menuItemId; } public void setMenuItemId(int menuItemId) { this.menuItemId = menuItemId; } public int getSubcategoryId() { return subcategoryId; } public void setSubcategoryId(int subcategoryId) { this.subcategoryId = subcategoryId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getPicturePath() { return picturePath; } public void setPicturePath(String picturePath) { this.picturePath = picturePath; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } } ContentResolverMenuItem: public class ContentResolverMenuItem { Context context; ArrayList&lt;MenuItem&gt; menuItems = new ArrayList&lt;MenuItem&gt;(); private static ContentResolverMenuItem ref; private ContentResolverMenuItem(Context context) { this.context = context; ContentResolver cr = context.getContentResolver(); String[] projection = new String[]{TabletContentProvider.KEY_ID, TabletContentProvider.KEY_SUBCATEGORY_ID, TabletContentProvider.KEY_NAME, T…
score: 0
has comment: http://stackoverflow.com/comment/36913268
has comment: http://stackoverflow.com/comment/36913187
has comment: http://stackoverflow.com/comment/36913185
type: UnansweredQuestion

http://stackoverflow.com/comment/42525510
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26995970
has text: That didn't work either. I've switched to MoPub, but that also won't work. Very frustrated.
score: 0

http://stackoverflow.com/q/24038683
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: tcp
tagged with: java
tagged with: checksum
type: Question
has comment: http://stackoverflow.com/comment/37065831
has comment: http://stackoverflow.com/comment/37065092
has comment: http://stackoverflow.com/comment/37058775
upvote count: 2
accepted answer: http://stackoverflow.com/a/31730460
answer count: 1
has comment: http://stackoverflow.com/comment/37066175
has comment: http://stackoverflow.com/comment/37066464
favorite count: 0
has answer: http://stackoverflow.com/a/31730460
has comment: http://stackoverflow.com/comment/37065355
has title: Wireshark checksum does not match
tagged with: wireshark
has body: I have written a function that computes the checksum for a given tcp packet. However, when I capture a tcp packet sent over ipv4 from wireshark and let my function compute its checksum, then its not the same checksum as in the wireshark captured packet. I checked and the bytes I give to the computeChecksum function are exactly the same as the tcp packet bytes i captured with wireshark. I computed the checksum according to the RFC 793. Does anybody see if there's anything wrong in my code? public long computeChecksum( byte[] buf, int src, int dst ){ int length = buf.length; // nr of bytes of the tcppacket in total. int pseudoHeaderLength = 12; // nr of bytes of pseudoheader. int i = 0; long sum = 0; long data; buf[16] = (byte)0x0; // set checksum to 0 bytes buf[17] = (byte)0x0; // create the pseudoheader as specified in the rfc. ByteBuffer pseudoHeaderByteBuffer = ByteBuffer.allocate( 12 ); pseudoHeaderByteBuffer.putInt( src ); pseudoHeaderByteBuffer.putInt( dst ); pseudoHeaderByteBuffer.put( (byte)0x0 ); // store the 0x0 byte pseudoHeaderByteBuffer.put( (byte)PROTO_NUM_TCP ); // stores the protocol number pseudoHeaderByteBuffer.putShort( (short) length ); // store the length of the packet. byte[] pbuf = pseudoHeaderByteBuffer.array(); // loop through all 16-bit words of the psuedo header int bytesLeft = pseudoHeaderLength; while( bytesLeft &gt; 0 ){ // store the bytes at pbuf[i] and pbuf[i+1] in data. data = ( ((pbuf[i] &lt;&lt; 8) &amp; 0xFF00) | ((pbuf[i + 1]) &amp; 0x00FF)); sum += data; // Check if the sum has bit 17 or higher set by doing a binary AND with the 46 most significant bits and 0xFFFFFFFFFF0000. if( (sum &amp; 0xFFFFFFFF0000) &gt; 0 ){ sum = sum &amp; 0xFFFF; // discard all but the 16 least significant bits. sum += 1; // add 1 (because we have to do a one's complement sum where you add the carry bit to the sum). } i += 2; // point to the next two bytes. bytesLeft -= 2; } // loop through all 16-bit words of the TCP packet (ie. until there's only 1 or …

http://stackoverflow.com/comment/37048791
type: AnswerComment
comment on: http://stackoverflow.com/a/24033087
type: Comment
has text: Works like charm. Thank you Sir. Can you please elaborate the thing about binary and source .jar files?
score: 0

http://stackoverflow.com/comment/36919728
type: Comment
comment on: http://stackoverflow.com/a/23959658
score: 1
type: AnswerComment
has text: That looks to be the goods. At first we just want to ensure that a connected STOMP client cannot subscribe to the root queue and get other people's messages, and I should be able to do this by looking at that app.

http://stackoverflow.com/a/24081787
has body: You have an extra ) as it's said before. And your List is not parameterized with Integer. public static List&lt;Integer&gt; subList(List&lt;Integer&gt; l) { List&lt;Integer&gt; evenL = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; l.size(); i++) { if (l.get(i) % 2 ==0) { evenL.add(i); } } return evenL; }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24081717
answers question: http://stackoverflow.com/q/24081717
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/23977645
upvote count: 15
score: 14
has body: Exception message guides you. Change long type to Long
downvote count: 1
answers question: http://stackoverflow.com/q/23977629
type: Answer

http://stackoverflow.com/q/24058031
accepted answer: http://stackoverflow.com/a/24058204
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24058204
tagged with: jsch
upvote count: 1
favorite count: 0
has title: error with read .pem file?
has body: Here is my code: public class ConnectToDB { private static final URL PEM_FILE_DIR = Thread.currentThread().getContextClassLoader().getResource("line_scrapper.pem"); private static final Logger LOGGER = Logger.getLogger(ConnectToDB.class); private static void doSshTunnel(String strSshUser, String strSshPassword, String strSshHost, int nSshPort, String strRemoteHost, int nLocalPort, int nRemotePort) throws JSchException, IOException, URISyntaxException { JSch jsch = new JSch(); jsch.addIdentity(PEM_FILE_DIR.getPath()); Session session = jsch.getSession(strSshUser, strSshHost, 22); session.setPassword(strSshPassword); final Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); session.setPortForwardingL(nLocalPort, strRemoteHost, nRemotePort); } public static void ssh() { try { // System.out.println("start"); String strSshUser = "ec2-user"; // SSH loging username String strSshPassword = "smartbites"; // SSH login password String strSshHost = "54.204.144.132"; // hostname or ip or SSH // server int nSshPort = 22; // remote SSH host port number String strRemoteHost = "127.0.0.1"; // hostname or ip of your // database server int nLocalPort = 3366; // local port number use to bind SSH tunnel int nRemotePort = 3306; // remote port number of your database String strDbUser = "root"; // database loging username String strDbPassword = "smartbites"; // database login password ConnectToDB.doSshTunnel(strSshUser, strSshPassword, strSshHost, nSshPort, strRemoteHost, nLocalPort, nRemotePort); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:" + nLocalPort + "/okpanda_teachers_accounts", strDbUser, strDbPassword); con.prepareCall(""); con.close(); } catch (Exception e) { LOGGER.error("error ", e); } // finally // { // System.exit(0); // } } } I would like to connect to the DB (not local but which is on the server) and store data, for test i create such …
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/24018086
type: Answer
has comment: http://stackoverflow.com/comment/37020427
upvote count: 3
has body: In addition to the answers given, you're closing a Button after a TextView. Se what blackbelt says about closing tags.
score: 3
answers question: http://stackoverflow.com/q/24017853
downvote count: 0

http://stackoverflow.com/a/24085819
answers question: http://stackoverflow.com/q/24085701
has body: Your second attempt is almost correct. You created the array but without giving it the correct size. The String[] dealerstats size should be the size of the ArrayList dealerhand: public String[] getStats() { String[] dealerstats = new String[ dealerhand.size() ]; for( int i = 0; i &lt; dealerstats.length; ++i ) dealerstats[i] = dealerhand.get(i).showstats(); return dealerstats; }
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/36983149
type: Comment
type: QuestionComment
score: 0
has text: It does not work, because spring data rest webmvc version 1.0.0.RELEASE does not use `MappingJacksonHttpMessageConverter` but `RepositoryAwareMappingHttpMessageConverter` which has its own `ObjectMapper` instance.
comment on: http://stackoverflow.com/q/23996776

http://stackoverflow.com/comment/37113910
comment on: http://stackoverflow.com/q/24067558
score: 0
type: QuestionComment
has text: @SotiriosDelimanolis json has a JSON serialized object with lots of stuff in it. Yes, the KEY_VALUE items are the same object.
type: Comment

http://stackoverflow.com/q/24047242
tagged with: orm
tagged with: java
tagged with: hibernate
score: 4
type: Question
upvote count: 4
answer count: 1
tagged with: jpa
downvote count: 0
has title: How to make Hibernate reuse or recreate temporary tables during bulk updates
favorite count: 0
has answer: http://stackoverflow.com/a/42751836
tagged with: oracle-database
has body: Hibernate handles UPDATE and DELETE operations on tables that are joined by the JOINED inheritance strategy by automatically creating temporary tables for storing the IDs of updated or deleted records (an excellent blog post on this is here: http://in.relation.to/Bloggers/MultitableBulkOperations). In one transation, Hibernate creates a temporary table (named HT_mytable), inserts record IDs, deletes the entries from mytable with the stored IDs, and clears HT_mytable. However, in my case it tries to create the table on every update, without first checking if it exists, by executing: Hibernate: create global temporary table HT_child (record_id number(10,0) not null) on commit delete rows So Oracle throws an exception: ERROR spi.SqlExceptionHelper - ORA-00955: name is already used by an existing object How to tell Hibernate not to create the table if it already exists?
type: UnansweredQuestion

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24019290
type: Tag
tags question: http://stackoverflow.com/q/24056060

http://stackoverflow.com/q/23953468
type: Question
tagged with: android
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23953598
answer count: 1
has title: How to process columns of an SQLite table in Java android?
tagged with: sql-update
type: AnsweredQuestion
tagged with: sqlite
has body: I have an SQLite table like: +---+-------------+----------------+ |_id| lap_time_ms |formatted_elapse| +---+-------------+----------------+ | 1 | 5600 | 00:05.6 | | 2 | 4612 | 00:04.6 | | 3 | 4123 | 00:04.1 | | 4 | 15033 | 00:15.0 | | 5 | 4523 | 00:04.5 | | 6 | 6246 | 00:06.2 | Where lap_time_ms is an of the type long and represents the amount of time in milliseconds for a lap while formatter_elapse is a String that represents the formatted (displayable) form of the first column (elapse). My question is that if I want to add (say) 5 seconds (5000) to each lap_time_ms then I use a statement like: DB.execSQL("update table_name set KEY_ELAPSE=KEY_ELAPSE+5000); Which works fine however the problem is that formatted_elapse still retains its outdated value! So, what is the best way to update the values in the formatted_elapse column if I have a function like: public static String getFormattedTime(long milliseconds) { // custom code that processes the long return processedString; } It may be a long shot (metaphorically speaking of course ;) but is it possible to have SQLite link the two columns such that if I update a lap_time_ms row, the formatted_elapse will automatically update appropriately. Thanks in advance!
has answer: http://stackoverflow.com/a/23953598

osx-mavericks
type: Tag
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/23966418

http://stackoverflow.com/comment/36881552
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23943024
has text: If you use Json, there are heaps of Json libs available. json-simple https://code.google.com/p/json-simple/ or google Gson https://code.google.com/p/google-gson/ are 2 options.

http://stackoverflow.com/q/23950564
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23950816
tagged with: ios
tagged with: bigdecimal
score: 0
has answer: http://stackoverflow.com/a/23951248
tagged with: objective-c
has body: Server has a Java Bean, it has a instance variable type BigDecimal, but Objective-C cannot map it! I have tried NSNumber, but doesn't work. Does anybody know how to fix it?
type: UnansweredQuestion
tagged with: hessian
tagged with: java
has title: How Objective-C support Java BigDecimal via Hessian?

http://stackoverflow.com/comment/36931703
has text: @DwB True. Agreed. Dropped the idea :P
comment on: http://stackoverflow.com/q/23958113
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37239301
type: Comment
comment on: http://stackoverflow.com/a/24083747
score: 1
type: AnswerComment
has text: Ended up working perfectly once I added the other attributes and the jsp version and tlib version to the tag file. Thanks :)

http://stackoverflow.com/a/24080624
has comment: http://stackoverflow.com/comment/37136964
has body: You could try xmllint The xmllint program parses one or more XML files, specified on the command line as xmlfile. It prints various types of output, depending upon the options selected. It is useful for detecting errors both in XML code and in the XML parser itself. It allows you select elements in the XML doc by xpath, using the --pattern option. I have just give you the method now how to use it and get required data is your responsibility. if you face any problem post it. It's installed by default on Ubuntu.
type: Answer
has comment: http://stackoverflow.com/comment/37137261
downvote count: 0
answers question: http://stackoverflow.com/q/24080560
score: 1
has comment: http://stackoverflow.com/comment/37137761
has comment: http://stackoverflow.com/comment/37139424
has comment: http://stackoverflow.com/comment/37137356
upvote count: 1

http://stackoverflow.com/comment/36987199
comment on: http://stackoverflow.com/a/23985350
score: 0
type: AnswerComment
type: Comment
has text: @chiperortiz Indeed the example is sequential, but it's improper for code to give correct results sequentially and incorrect results in parallel, especially in a book that's trying to explain this stuff. (Also, I suspect even the sequential code violates some restrictions, and it's just lucky that it happens to give the correct result.)

http://stackoverflow.com/q/23976797
has comment: http://stackoverflow.com/comment/36943230
has answer: http://stackoverflow.com/a/23976981
has title: Inheritance (Late Binding) via Dependency Injection in Java
has answer: http://stackoverflow.com/a/23976893
tagged with: java
has comment: http://stackoverflow.com/comment/36943310
type: Question
downvote count: 0
tagged with: inheritance
has comment: http://stackoverflow.com/comment/36945102
score: 13
has answer: http://stackoverflow.com/a/23977833
has answer: http://stackoverflow.com/a/23979460
favorite count: 0
linked to: http://stackoverflow.com/q/23560845
answer count: 5
tagged with: spring
tagged with: late-binding
tagged with: soa
has body: I am using Spring DI to wire my components and I came across this issue. I have a BaseService class which has multiple implementations. And the layer above it, has a builder which calls the service to get data to populate POJOs. Service implementation I need to call (ServiceA,ServiceB) changes according to the type of POJO I need to build. In such case, how can I autowire the service, as it requires late binding the service. How can I tackle this kind of scenario? (Example in Spring DI would really help) I read similar questions but could not find the answer. And I read that SOA patterns such as Service Host provide different solutions to exact use case. Please help. Thanks
upvote count: 13
has answer: http://stackoverflow.com/a/23992224
accepted answer: http://stackoverflow.com/a/23977833
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23976893

http://stackoverflow.com/comment/37131208
comment on: http://stackoverflow.com/q/24077391
has text: We had the very same question in our java seminars. The thing here is that the main method is static. That means it is not a method of your instantiated object but of your class and is only called once on startup by the jvm (unless you want to call it manually). On startup you only have one object of First.
type: Comment
type: QuestionComment
score: 0

model-view-controller
tags question: http://stackoverflow.com/q/23973673
tag name: model-view-controller
tags question: http://stackoverflow.com/q/23967022
tags question: http://stackoverflow.com/q/23991775
tags question: http://stackoverflow.com/q/24095424
tags question: http://stackoverflow.com/q/24086645
tags question: http://stackoverflow.com/q/24063286
tags question: http://stackoverflow.com/q/24046205
tags question: http://stackoverflow.com/q/24057023
tags question: http://stackoverflow.com/q/23942895
type: Tag
tags question: http://stackoverflow.com/q/24032156
tags question: http://stackoverflow.com/q/24018880
tags question: http://stackoverflow.com/q/23987017

http://stackoverflow.com/q/23975643
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36943852
type: Question
upvote count: 2
has body: I know there are lots of answers to this question and I have already tried most of the solutions and couldn't get a solution at this point. I am trying to show an ad on my Android Activity and I keep getting this message Not enough space to show ad. Needs 480x75 pixels, but only has 480x0 pixels. My XML file for the activity is as follows: &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:id="@+id/content_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" /&gt; &lt;com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adUnitId="***" ads:adSize="BANNER"/&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@+id/listview_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="#111" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; And I am creating it with: adView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder() .addTestDevice("my_device_id") .build(); adView.loadAd(adRequest); I can't seem to have it shown on my screen. Can someone help me with this? Thanks in advance! UPDATE I managed to do it using a RelativeLayout and this is how i did it: &lt;RelativeLayout android:id="@+id/content_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;FrameLayout android:id="@+i…
tagged with: admob
has comment: http://stackoverflow.com/comment/36999237
tagged with: smartbanner
has comment: http://stackoverflow.com/comment/36940942
favorite count: 0
has comment: http://stackoverflow.com/comment/36999631
has title: Android Not enough space to show ad - admob
has comment: http://stackoverflow.com/comment/36940898
has comment: http://stackoverflow.com/comment/36968812
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/36995430
has text: IKR :P it's mostly the 3rd party libs that I'm using
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24004375
score: 0

http://stackoverflow.com/q/23945193
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36884485
has title: Why do we need Java Plugin to download videos from YouTube, Vimeo etc
tagged with: java
has answer: http://stackoverflow.com/a/23945287
accepted answer: http://stackoverflow.com/a/23945287
type: Question
has comment: http://stackoverflow.com/comment/36884705
score: 0
answer count: 1
has body: There are websites like http://keepvid.com/ which let us download videos but they required us to install Java plugin, whereas there are websites like http://dirpy.com/ which does the same but without any Java plugin. What is the difference here? What exactly is the Java plugin doing here?
favorite count: 0
has comment: http://stackoverflow.com/comment/36884513
tagged with: download
upvote count: 1
tagged with: plugins
tagged with: youtube
downvote count: 1
tagged with: video

http://stackoverflow.com/q/24048341
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24052572
has comment: http://stackoverflow.com/comment/37080447
type: Question
has comment: http://stackoverflow.com/comment/37082170
answer count: 2
has title: Variables from properties.file not being passed - TestNG - WebDriver Test
has answer: http://stackoverflow.com/a/24069131
score: 0
has body: I am using Webdriver + TestNG. I created a class where you can run any test with the browser of your choice just by using the method below where you enter which browser to run and what test to run as your variables. Now I am trying to feed my "browser" variable and "test" variable from a properties file. When I run it I just get a Pass but nothing happens. If I manually enter the variables it works fine. How come it wont take the values from the properties file? If I do a print - it prints the correct value... This is the contents of the properties file: browser="BROWSER GOES HERE" test="TEST GOES HERE" Here is my method to run the test: @Test public void runTest() throws IOException { Properties prop = new Properties(); prop.load(new FileInputStream( "path\\test.properties")); localBrowser(prop.getProperty("browser")); masterTest(driver, prop.getProperty("test")); } Here is a sandbox example of my test: If I put the variables in myself the browser will open and execute the test. If I use the property loader it will just print the variables but will not run the test. Here is a sandbox example so you can try it. Package Structure: -src/test/java --SandboxTest -src/test/resources --test.properties Properties File example: browser=firefox test=test1 Class example: public class SandboxTest { private WebDriver driver; InputStream input = null; Properties prop = new Properties(); @Test public void runTest() throws FileNotFoundException, IOException { input = new FileInputStream( (new File( "C:INSERT_PATH_HERE\\test.properties"))); prop.load(input); //This doesnt run the test System.out.println(prop.getProperty("browser")); System.out.println(prop.getProperty("test")); localBrowser(prop.getProperty("browser")); masterTest(driver, prop.getProperty("test")); /* * This works * localBrowser("firefox"); * masterTest(driver, "test1"); */ } public void localBrowser(String browser) { if (browser == "firefox") { driver = new FirefoxDriver(); } else if (browser == "chrome") { System…
has comment: http://stackoverflow.com/comment/37078123
possible better answer: http://stackoverflow.com/a/24069131
has comment: http://stackoverflow.com/comment/37077544
tagged with: testng
has comment: http://stackoverflow.com/comment/37103403
accepted answer: http://stackoverflow.com/a/24052572
has comment: http://stackoverflow.com/comment/37078483

http://stackoverflow.com/a/24276112
downvote count: 0
score: 6
has body: The IntelliJ configuration for a local Tomcat instance has a checkbox for "Preserve sessions across restarts". Check that, and the sessions should be preserved. By the way, I've seen a number of developers waste a lot of time over the years messing around with the Tomcat plugins in Eclipse and IntelliJ, trying to figure out how to get them to work in a manner similar to production. The easiest answer by far is to just use a regular Tomcat instance, and forego the IDE integration. One easy thing to do to replace this, if you are using Maven (you are using a build tool, aren't you?) is to use the maven tomcat plugin.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24102017
has comment: http://stackoverflow.com/comment/37511377
answers question: http://stackoverflow.com/q/24102017
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/37560761

http://stackoverflow.com/comment/37183058
score: 0
type: Comment
has text: That's really smart, I'll try doing it
type: AnswerComment
comment on: http://stackoverflow.com/a/24104587

http://stackoverflow.com/q/24019845
linked to: http://stackoverflow.com/q/8637285
accepted answer: http://stackoverflow.com/a/24020068
score: 11
upvote count: 11
type: AnsweredQuestion
has body: This is perhaps a relatively simple thing to do but for some reason I don't seem to get it right. How does one get an element from an arrayList in jstl based on an index. In pure java, lets say I have this arralist ArrayList&lt; String &gt; colors = new ArrayList&lt; String &gt;(); colors.add("red"); colors.add("orange"); colors.add("yellow"); colors.add("green"); colors.add("blue"); if I do System.out.println(colors.get(1)); I get the first color from the arrayList based on the index I supplied which happens to be red. Wondering how to achieve that in jstl. I played with the foreach tag in jstl but did not quite get it right. &lt;c:forEach items="colors" var="element"&gt; &lt;c:out value="${element.get(1)}"/&gt; &lt;/c:forEach&gt;
tagged with: java
has comment: http://stackoverflow.com/comment/37023838
possible better answer: http://stackoverflow.com/a/24019892
type: Question
tagged with: jstl
has answer: http://stackoverflow.com/a/24019892
has answer: http://stackoverflow.com/a/24020068
duplicate of: http://stackoverflow.com/q/8637285
has comment: http://stackoverflow.com/comment/37023799
has title: Getting elements of arraylist based on index in jstl
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24019896

http://stackoverflow.com/a/24015875
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24013913
answers question: http://stackoverflow.com/q/24013913
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37017740
has body: It does not look like you can. Only Configs prefixed with "topology" can be set thru the API at the topology level. On another note, if you use the apache release netty is the default transport and ZeroMQ will probably be deprecated in future releases.
type: Answer
score: 2

http://stackoverflow.com/comment/37030002
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24023098
has text: About `Part 1` of your question, it is already on a separate thread, it shouldn't have any influence on the layout being inflated to the screen for your active Activity unless the content displayed is dependent on the information being obtained in your thread.

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/23984752
type: Tag

http://stackoverflow.com/q/24079134
tagged with: algorithm
score: 0
has title: iterate on sets of string in java
has comment: http://stackoverflow.com/comment/37133695
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/37134934
accepted answer: http://stackoverflow.com/a/24079568
has body: i have program that makes operations on string and this is the principal function of one of those operations,this works perfectly,but it is not efficient: private void printString(ArrayList&lt;String&gt; operations, ArrayList&lt;String&gt; set) { int numerOfStrings = 0; int numberOfletters = 0; String toPrint = operations.get(1); outOfLoop: for (int i = 0; i &lt; set.size(); i++) { String[] toFind = set.get(i).split(" "); for (int k = 0; k &lt; toFind.length; k++) { if (toPrint.equals(toFind[k])) { String[] splited = set.get(i).split(" "); for (int j = 0; j &lt; splited.length; j++) { numberOfletters += splited[j].length(); } numerOfStrings = splited.length; break outOfLoop; } } } System.out.println(numerOfStrings + " " + numberOfletters); } explanation: this function takes as parameter a an arrayList of operations, and an arraylist of set: for the arraylist of operations i get always a specific position so,i don't iterate , it is always O(1) for the arrayList of set i have to iterate,or rather, as I think of that to proceed: so , for example, if have as operation print foo i have to do these steps: first of all i have to find where foo is : inside set i can have this situation: position 1 : {car tree hotel} ... position n : {foo lemon coffee} when i find the string foo i have to print the number of strings inside that position and the number of letters of each string,so in this case i will print : 3(number of strings) 14(number of letters) my program works,and also this function works, but it is a nasty solution,and not efficent,what do you think, how can I improve in efficiency in my program? question inserted on code Review
has comment: http://stackoverflow.com/comment/37133702
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37133774
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24079568

http://stackoverflow.com/q/23955837
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23965129
has comment: http://stackoverflow.com/comment/36940691
has comment: http://stackoverflow.com/comment/36921058
score: 0
has comment: http://stackoverflow.com/comment/36921217
answer count: 1
has title: Parallel creation of a match-table
accepted answer: http://stackoverflow.com/a/23965129
tagged with: java-8
has body: I have two sets of Objects (X,Y) and I want to compare all of the elements in X with all of the elements in Y and write the resulting values into a match-table. My first approach was to have to have two for loops, which iterate over the sets and write the result to a table. Table&lt;Object, Object, Double&gt;matchTable = TreeBasedTable.create(new ObjectComparator(), new ObjectComparator()); for (Object x : X) { for (Object y : Y) { double diff = comparator.diff(x, y); matchTable.put(x, y, diff); } } Since with Java 8 there are more possibilities for parallel processing I wanted to do the same thing but in parallel. My first attempt looks like this, but I think this is not the way it should be, I think it would be better to use some Collector to create the table and write to it. Function&lt;Pair&lt;Object&gt;, Boolean&gt; colF = pair -&gt; { double diff = comparator.diff(pair.x, pair.y); matchTable.put(pair.x, pair.y, diff); return true; }; Function&lt;Object, Long&gt; rowF = x -&gt; { return Y.parallelStream().map(y -&gt; { return colF.apply(new Pair&lt;Object&gt;(x, y)); }).count(); }; long count = X.parallelStream().map(rowF).count(); (I just call the count() because else it would be lazy execution. Pair is just a class which holds two objects.)
tagged with: parallel-processing
type: AnsweredQuestion
tagged with: guava

http://stackoverflow.com/q/24040859
has comment: http://stackoverflow.com/comment/37087375
tagged with: java
type: Question
tagged with: jasper-reports
tagged with: websphere
has answer: http://stackoverflow.com/a/24063258
tagged with: jasperserver
score: 0
answer count: 1
has title: Could not load the following font on WebSphere
tagged with: fonts
type: UnansweredQuestion
has body: Getting the following error while trying to export to a PDF using JasperReports. Error when the error message is being printed is as follows: Could not load the following font : pdfFontName : Arial.ttf pdfEncoding : Identity-H isPdfEmbedded : true] My JRXML &lt;textElement&gt; &lt;font pdfFontName="Arial.ttf" isPdfEmbedded ="true" pdfEncoding ="Identity-H"/&gt; &lt;/textElement&gt; Using: WebSphere Application Server version 7 JasperReports version 3 jar The Arial.ttf font file is present in the .../web-inf/classes and the default location of fonts in a unix machine. I have almost no knowledge in JasperReports and need to debug this issue. Kindly help me with the things I might be missing/overlooked or of more specific information is required about any part.

http://stackoverflow.com/a/24047902
type: Answer
answers question: http://stackoverflow.com/q/24047733
score: 0
has body: Where will you create the AppContainer object? If you are creating that object in a class which extends to Activity, you can pass the context when creating this object. Basically it looks like this: public class AppContainer extends Application{ private Context c; public AppContainer(Context context){ this.c = context; } ............. } In the class which extends to Activity: public class theClass extends Activity{ AppContainer container = new AppContainer(this); }

http://stackoverflow.com/comment/37121733
comment on: http://stackoverflow.com/a/24056733
type: Comment
has text: Is that so. What do you suggest I do in order to correct this? Is it possible to pass the updates to a new object?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37055706
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24036783
has text: Ideally it should work. Have you tried giving event="change" in p:ajax. Also set immediate=true and try.

http://stackoverflow.com/q/23964045
has comment: http://stackoverflow.com/comment/36928886
has comment: http://stackoverflow.com/comment/36920159
type: UnansweredQuestion
has title: Java - Read files outside a jar file
tagged with: netbeans
answer count: 0
has comment: http://stackoverflow.com/comment/36920220
has body: I'm in troubles. I worked on a project on a wiktionary dump (that is a reaaaally huge file). Requirements asked that the dump file had to be passed as argument from command line. For making it easier I worked on NetBeans, I set all the parameters, put the dump file into the 'src' folder and everything went fine. Requirements asked that the project had to be delivered as a jar file. I'm quite a newbie with jars, so I just copied netbeans src folder, compiled the code (from shell), removed the dump file -as it wasn't needed to be into the jar - and just did "compress as jar file". Now comes the problem: When I run it from shell I get java.lang.reflect.InvocationTargetException caused by a java.net.MalformedURLException . I think the problem is that it looks for the dump only inside the jar, but actually the dump will be outside.. How can I fix it? Don't know if it matters.. I'm working on ubuntu Thanks everyone for your help!
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36920282
score: 0
has comment: http://stackoverflow.com/comment/36920087
tagged with: jar
has comment: http://stackoverflow.com/comment/36920677

http://stackoverflow.com/comment/37093947
type: QuestionComment
has text: Best choice is probably to attach the listener to the source component you are most interested in. MouseListeners block those components below, just so your aware...
comment on: http://stackoverflow.com/q/24057419
score: 0
type: Comment

lambda
tags question: http://stackoverflow.com/q/24095875
tags question: http://stackoverflow.com/q/24003674
tags question: http://stackoverflow.com/q/24054773
tags question: http://stackoverflow.com/q/24098035
tags question: http://stackoverflow.com/q/23996479
tags question: http://stackoverflow.com/q/23962625
tags question: http://stackoverflow.com/q/24095451
tag name: lambda
tags question: http://stackoverflow.com/q/23964639
tags question: http://stackoverflow.com/q/23978676
tags question: http://stackoverflow.com/q/24102340
type: Tag
tags question: http://stackoverflow.com/q/23968736
tags question: http://stackoverflow.com/q/23954702
tags question: http://stackoverflow.com/q/23952292
tags question: http://stackoverflow.com/q/24005411

http://stackoverflow.com/a/24093516
has body: for-each does not work based on array index but implements an iterative solution, the int i variable will be representative of a single element of data from your supplied array. So in the loop, you effectively call: anArray[1] = 1 + 1; anArray[2] = 2 + 1; anArray[3] = 3 + 1; anArray[4] = 4 + 1; anArray[5] = 5 + 1; As you can see, anArray[5] would be out of bounds, as the length of the array is only 5 long (0-4) If you want to change the values, you do not use a for-each loop (could hackily do it using a Box of some sort, but with an array it would be silly to). So with an array, this would be the advisable solution: for (int i = 0; i &lt; anArray.length; i++) { anArray[i]++; } As you have already mentioned
answers question: http://stackoverflow.com/q/24093488
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37161385
accepted answer of: http://stackoverflow.com/q/24093488
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/37161371

http://stackoverflow.com/comment/36980447
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23996352
has text: I used: `Matcher matcher = pattern.matcher(phraseTOReplace.toUpperCase()); System.out.println(matcher.matches());`, and it returned true...
score: 1

http://stackoverflow.com/q/23975093
has body: I want to print a box into the Java console using Unicode characters, but for some reason it gives me this runtime error: --------------------Configuration: PacManGame - JDK version 1.7.0_25 &lt;Default&gt; - &lt;Default&gt;-------------------- Exception in thread "main" java.lang.NullPointerException at Scoreboard.genTopLine(Scoreboard.java:35) at Scoreboard.&lt;init&gt;(Scoreboard.java:17) at PacManGame.main(PacManGame.java:36) Process interrupted by user. code: http://pastebin.com/nuAsH857 Does anyone know what's wrong?
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/36939801
has comment: http://stackoverflow.com/comment/36939842
tagged with: null
has comment: http://stackoverflow.com/comment/36939897
has comment: http://stackoverflow.com/comment/36939992
tagged with: runtime-error
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36939697
has comment: http://stackoverflow.com/comment/36939851
has answer: http://stackoverflow.com/a/23975151
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/36939908
has comment: http://stackoverflow.com/comment/36940305
linked to: http://stackoverflow.com/q/10985462
has comment: http://stackoverflow.com/comment/36939927
has comment: http://stackoverflow.com/comment/36939836
has comment: http://stackoverflow.com/comment/36939807
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
has title: Java Unicode String is null?
has comment: http://stackoverflow.com/comment/36939830
tagged with: java
tagged with: unicode-string
has comment: http://stackoverflow.com/comment/36940265
type: Question

http://stackoverflow.com/q/24042224
type: UnansweredQuestion
tagged with: maven
has body: Hello Im working with Eclipse Kepler, but I have working with Hellios a lot of time. I have a problem with some projects, its very hard to explain but I will try. Well the problem is: You can do a lot of thing under this projects, the result in MAVEN Console is always the same: [INFO] Using NULL lifecycle mapping for MavenProject. -I create the "lifecycle-mapping-metadata.xml" under the folder C:{myWorkspace}.metadata.plugins\org.eclipse.m2e.core\, restart eclipse and nothing change. -I edit the "pom.xml" of the project adding the pluginManagment with lifecycle NOTHING! -I change the .project and .classpaht of the project.... NOTHING! -I change my eclipse (Hellios to Kepler)..... NOTHING- Reading this text maybe you can thing about the problem is the project, but no ! :( But here the strange thing, if u create a new MAVEN PROJECT you can see in the MAVEN Console this text: [INFO] Using org.eclipse.m2e.jdt.JarLifecycleMapping lifecycle mapping for MavenProject: foo.myExample:myExample:0.0.1-SNAPSHOT @ C:{myWorkspace}\myExample\pom.xml. Obviously this project is perfect, with a perfect dependencies, etc. I add the images of my LifeCycling Mapping in the Maven View of Eclipse http://www.subirimagenes.net/i/140604060132785641.jpg &lt; wrong project http://www.subirimagenes.net/i/140604060134738146.jpg &lt; good project I think its something about the project structure, i got : Project Father ( with pom.xml, with 2 modules) &lt; plugin doestn detect lifeCycle Project Son JAR ( with pom.xml) &lt; plugin detect lifeCycle to build a JAR file Project Son WAR ( with pom.xml) &lt; plugin detect lifeCycle to build a WAR file Thanks in advance!
has comment: http://stackoverflow.com/comment/37067147
tagged with: java
tagged with: m2e
tagged with: eclipse
type: Question
upvote count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/7409823
favorite count: 0
has title: "Using NULL lifecycle mapping for MavenProject"
tagged with: lifecycle
has comment: http://stackoverflow.com/comment/38368444
score: 2
answer count: 0

http://stackoverflow.com/q/23960451
favorite count: 0
tagged with: linux
score: 20
possible better answer: http://stackoverflow.com/a/23960859
has answer: http://stackoverflow.com/a/23960859
tagged with: permissions
answer count: 4
has answer: http://stackoverflow.com/a/23961144
type: AnsweredQuestion
tagged with: root
tagged with: java
has body: I'm trying to run multiple jvms (including tomcat) under different users on one linux box. I'm not seeing too many issues, but in catalina.out I keep seeing this: May 30, 2014 1:16:16 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 7626 ms May 30, 2014 1:16:37 PM java.util.prefs.FileSystemPreferences$2 run WARNING: Could not create system preferences directory. System preferences are unusable. May 30, 2014 1:16:55 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode WARNING: Could not lock System prefs. Unix error code -158097957. May 30, 2014 1:16:55 PM java.util.prefs.FileSystemPreferences syncWorld WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock. I did some digging/reading and deduced the following: An administrator with root access must create the system preferences directory /etc/.java/.systemPrefs with drwxr-xr-x access. Java's looking for /etc/.java/.systemPrefs/.system.lock and /etc/.java/.systemPrefs/.systemRootModFile Manually creating the above files (use "touch" to create empty files) and their containing directories should fix. Rights to the files should be 544, rights to their directories should be 755, owner and group are root for all. But I am not root, getting someone to run root is expensive and I have multiple users running jvms, does that mean i have to create those files and set up permissions just so that all users have access with those privileges? Has anyone ever run into this issue and if they have is there a simpler solution i am missing?
linked to: http://stackoverflow.com/q/15004954
type: Question
upvote count: 20
accepted answer: http://stackoverflow.com/a/23961144
has answer: http://stackoverflow.com/a/67432545
has title: java system preferences under different users in linux
downvote count: 0
has answer: http://stackoverflow.com/a/53699634
tagged with: tomcat

cxf
tags question: http://stackoverflow.com/q/24077934
tags question: http://stackoverflow.com/q/24036717
tags question: http://stackoverflow.com/q/24015265
type: Tag
tags question: http://stackoverflow.com/q/23996351
tags question: http://stackoverflow.com/q/23950134
tags question: http://stackoverflow.com/q/24095236
tags question: http://stackoverflow.com/q/24015397
tags question: http://stackoverflow.com/q/24032319
tags question: http://stackoverflow.com/q/24043279
tags question: http://stackoverflow.com/q/24017038
tag name: cxf
tags question: http://stackoverflow.com/q/23961421
tags question: http://stackoverflow.com/q/23942990
tags question: http://stackoverflow.com/q/23988523
tags question: http://stackoverflow.com/q/24042784

http://stackoverflow.com/q/23942624
tagged with: java
tagged with: date
has title: getting and setting dates with Java
has answer: http://stackoverflow.com/a/23942809
duplicate of: http://stackoverflow.com/q/212321
has comment: http://stackoverflow.com/comment/36879629
linked to: http://stackoverflow.com/q/6650240
has body: First off thank you for taking the time to scroll through this. I am basically a greenhorn when it comes to Java but I am working on a program that asks the user some basic info then sets a start date and then schedules service dates at bi weekly intervals between March and October from their start date. For the start date variable, I simply set it up as: STARTDATE = getDate(); to give the current date when the user signs up. I have been sifting through my searches for days but I cannot figure out how to increment the service dates by 14 days to save my life. I tried using SERVICEDATE = STARTDATE + (0, 14, 0); but I cant make sense of whats really happening here. Any ideas?
linked to: http://stackoverflow.com/q/7654151
has answer: http://stackoverflow.com/a/23942742
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23942715
linked to: http://stackoverflow.com/q/212321
has comment: http://stackoverflow.com/comment/36879783
type: UnansweredQuestion
type: Question
duplicate of: http://stackoverflow.com/q/7654151

http://stackoverflow.com/a/24027655
type: Answer
answers question: http://stackoverflow.com/q/24027542
has body: If I understand your question correctly, the variable writer should be a class variable instead of in the scope of the constructor for Client: public class Client { private OutputStreamWriter writer; private String host; private int port; public Client(String host2, int port2) throws IOException { // ... } public void readAndWrite() { // ... writer.write(); } }
score: 0

http://stackoverflow.com/comment/36934029
has text: "or this here is a thread object?" Yes, that is exactly what happens here. `this` refers to current Thread and since you have many threads you are synchronizing each of them on themselves, not on some external but **one** object/lock/monitor which they all have access to. That is why you have no real synchronization in your code.
comment on: http://stackoverflow.com/a/23971194
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24000732
has comment: http://stackoverflow.com/comment/36990074
has comment: http://stackoverflow.com/comment/36988520
type: Answer
has comment: http://stackoverflow.com/comment/36995381
has body: Seeing as it's homework, I believe I can point you in the general direction. To start, keep a two-dimensional array (or a data structure that can represent the grid), and keep track of the values that can go there. Let's say it's a class named "possibilities": public class Possibilities { //Keep track of the numbers possible internally, with an accessor } The way sudoku works, there will usually be a square with only a single answer (in some cases, this won't be available, which means you need to potentially make a copy of the data and play out a little bit, or have a way to roll back). Simply put, fill in the answer, and then iterate over the adjacent squares to remove the freshly put number as a possibility (And check those squares simultaneously as new potential answers).
answers question: http://stackoverflow.com/q/24000619
score: 0
has comment: http://stackoverflow.com/comment/36988768

http://stackoverflow.com/comment/37007240
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24009530
score: 0
has text: I originally started on a video series of 200 videos on thenewboston but soon realized it was from 2011, and didn't want to continue there in case it was outdated (no point in learning something obsolete). Any links you have would be greatly appreciated, as looking for something not only relevant but also up to date and well written has been a bit hard to find.

http://stackoverflow.com/comment/37194643
type: Comment
has text: @sinsi one of the suggestions there was to use the "net" command and parse the output. That one should definitely work as that command will show you the UNC path for each mapped drive letter.
type: QuestionComment
comment on: http://stackoverflow.com/q/24103250
score: 0

http://stackoverflow.com/comment/37187963
type: Comment
comment on: http://stackoverflow.com/a/24101331
type: AnswerComment
has text: @BrettOkken Beware, OP asked about `getNumericValue` which is **not** the same as code point. For example numeric value so 'a' and 'A' is 10 whereas code point of 'A' is 65 and code point of 'a' is 97
score: 0

http://stackoverflow.com/a/31121011
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/24058371
upvote count: 5
type: Answer
has body: The only thing you need to do is to add @EnableAspectJAutoProxy(proxyTargetClass = true) to your Spring Configuration.

http://stackoverflow.com/comment/37162285
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24093955
has text: myArray={11, 4, 9, 2, 8}; in this myarray there are two odd number 11 and 9 both are greater than every even number i.e 4,2,8. i want this comparssion if even number greater than odd number then return 0 otherwise return 1.

http://stackoverflow.com/comment/37063343
type: QuestionComment
comment on: http://stackoverflow.com/q/24040700
score: 0
has text: @user3690061 package != package private.
type: Comment

http://stackoverflow.com/comment/37071751
type: QuestionComment
comment on: http://stackoverflow.com/q/24045046
score: 0
has text: No its not using any Source control,The project was developed in Myeclipse and i am using eclipse. I think that might causing to set class path to read only.
type: Comment

http://stackoverflow.com/q/24073335
score: -1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24074149
possible better answer: http://stackoverflow.com/a/24073435
has body: I have been asked to convert this code with a throw exception IF to a try/catch block. I have set it up but am not sure what to put in lieu of the word output so that it may run. I am not sure after reading the book and oracles info try/catch I see what needs to be done so the txt file will print. I will post code to be modified and then my change with try/catch. thanks for any help. public class WriteData { public static void main(String[] args) throws Exception { java.io.File file = new java.io.File("scores.txt"); if (file.exists()) { System.out.println("File already exists"); System.exit(0); } // Create a file java.io.PrintWriter output = new java.io.PrintWriter(file); // Write formatted output to the file output.print("John T Smith "); output.println(90); output.print("Eric K Jones "); output.println(85); // Close the file output.close(); } } Here is the code changed for the Try/Catch import java.io.FileNotFoundException; public class WriteData { public static void main(String[] args) { java.io.File file = new java.io.File("scores.txt"); try { output = new java.io.PrintWriter(file); } catch (FileNotFoundException ex) { ex.printStackTrace(); } // Create a file java.io.PrintWriter output = new java.io.PrintWriter(file); // Write formatted output to the file output.print("John T Smith "); output.println(90); output.print("Eric K Jones "); output.println(85); // Close the file output.close(); } }
has answer: http://stackoverflow.com/a/24073435
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37123438
has answer: http://stackoverflow.com/a/24074145
tagged with: java
has comment: http://stackoverflow.com/comment/37123453
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/37123741
favorite count: 0
has comment: http://stackoverflow.com/comment/37123436
accepted answer: http://stackoverflow.com/a/24074145
has title: Not 100% sure on Try /Catch

http://stackoverflow.com/comment/37165431
comment on: http://stackoverflow.com/q/24088625
score: 0
type: Comment
has text: I'm not sure what you mean about the paths? I want to be able to run this report using jasper files within the jar itself. As it currently stands they are being called at their local folder location which obviously won't work on a separate machine. I thought using InputStreams would work but I keep getting a null pointer exception - seems the files can't be found!
type: QuestionComment

http://stackoverflow.com/comment/36924292
type: Comment
has text: If the output is too long, consider replacing the contents of 'textArea' with the output, rather than appending. Also, I would limit the speed, with Thread.sleep or similar
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23966159

http://stackoverflow.com/comment/44845801
type: AnswerComment
has text: Could you please reference the specific documentation of Play2 in your answer
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27562285

http://stackoverflow.com/q/23990942
tagged with: database-design
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37225463
has body: Which database best suits the following scenario: I have created a java application which stores audio calls to the local file system. The application, in order to play audio calls, retrieves the metadata from a database (MySQL), which has one column with the location to the call on the local HD. The issue I have now is that the amount of audio calls is HUGE (around 50 TB) What should I do to handle such amount of data The application is built in JAVA SWING EDIT: I am interested in which database can handle such amount of data. I have heard about Hadoop but seems it is very good only for batch processing not for real time querying. Any suggestion? Thanks
has answer: http://stackoverflow.com/a/23991027
tagged with: java
tagged with: mysql
type: Question
answer count: 1
tagged with: database
tagged with: data-structures
score: 0
has title: Which data store can handle TB of audio calls in SWING
linked to: http://stackoverflow.com/q/10485696

http://stackoverflow.com/comment/115040967
comment on: http://stackoverflow.com/a/63806719
type: Comment
score: 0
has text: I revised my answer according to yankee comment. Now the answer should be correct.
type: AnswerComment

http://stackoverflow.com/q/24036662
type: Question
tagged with: pdf-generation
score: 4
has title: How to make a particular sub-string Bold while printing a string in Pdf using iText in java eclipse?
accepted answer: http://stackoverflow.com/a/24037058
tagged with: java
has comment: http://stackoverflow.com/comment/37055882
tagged with: itext
answer count: 1
has comment: http://stackoverflow.com/comment/37056169
has comment: http://stackoverflow.com/comment/37056581
has comment: http://stackoverflow.com/comment/37055640
has comment: http://stackoverflow.com/comment/37055625
upvote count: 4
has body: I am using iText in Java to convert a HTML to PDF. I want a particular paragraph which has some words as Bold and some as Bold+Underlined to be passed as a string to the Java code and to be converted to PDF using the iText library. I am unable to find a suitable method for this. How should I do this?
has comment: http://stackoverflow.com/comment/37055368
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37055061
has comment: http://stackoverflow.com/comment/37056544
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/24037058
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37055682

http://stackoverflow.com/q/24061674
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/37101500
upvote count: 0
answer count: 1
tagged with: runtime
favorite count: 0
has body: I'm trying to implement a button to make both my JFrame and JPanel bigger (by the same amount), but it doesn't quite seem to work. myPanel.setPreferredSize(new Dimension(50, 50)); button1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ getContentPane().remove(myPanel); myPanel.invalidate(); myPanel.setMinimumSize(new Dimension(myPanelWidth, myPanelHeight+100)); myPanel.setBounds(new Rectangle(myPanel.getBounds().getX(), myPanel.getBounds.getY(), myPanel.getBounds().getWidth(), myPanel.getBounds().getHeight+100)); getContentPane().setBounds(new Rectangle(myFrameX, myFrameY, myFrameWidth, myFrameHeight+100)); getContentPane().add(myPanel, BorderLayout.SOUTH); System.out.println(myPanel.getBounds().getHeight()); myPanel.validate(); myPanel.repaint(); The problem is that my frame resizes properly - it becomes 100 units bigger, but the panel doesn't. I'm not sure I'm validating and repainting properly. What am I doing wrong? Edit: Fixed! I needed a setPreferredSize() update inside of my ActionListener.
has comment: http://stackoverflow.com/comment/37102575
has comment: http://stackoverflow.com/comment/37101642
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
downvote count: 1
has title: Resizing JPanel within JFrame at runtime
tagged with: java
has answer: http://stackoverflow.com/a/24062135
tagged with: jpanel
score: -1
type: Question

http://stackoverflow.com/q/23948133
has answer: http://stackoverflow.com/a/23948213
favorite count: 0
score: 0
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
has body: This is my XML file: MYapp qwe 1234 system security tyas qwewe 1235 asd wetry This is my Java code: package trial; import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class parsing { public static void main(String args[]) { try { File applications = new File("appdetails.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(applications); doc.getDocumentElement().normalize(); System.out.println("application details:"); NodeList nodes = doc.getElementsByTagName("apps"); System.out.println("==================="); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; System.out.println("app name: " + getValue("appname", element)); String uname = getValue("uname",element); String host = getValue("server",element); String passwd = getValue("passwd",element); String clu = getValue("clustername",element); String path = getValue("path",element); String cmd = getValue("cmd" ,element); String port = getValue("port" ,element); String user= getValue("user",element); System.out.println(user); String pswd= getValue("pswd" ,element); System.out.println(pswd); }}} catch (Exception ex) {ex.printStackTrace(); } } private static String getValue(String tag, Element element) { NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes(); Node node = (Node) nodes.item(0); return node.getNodeValue(); } } the output I get iterates through both the nodes. How do I modify this code to display just the details of the node I select? If I select MYapp it should display only details of Myapp.
has answer: http://stackoverflow.com/a/23948330
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23948434
has title: how do I parse one node at a time from XML file through Java code?
downvote count: 1
type: Question
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23949034

http://stackoverflow.com/a/24010226
answers question: http://stackoverflow.com/q/24010157
downvote count: 0
type: Answer
score: 3
has body: Your run() method is belong to NewClass which is not a Thread, it's a worker. So, no body going to call run() method of NewClass In java, when you are creating a worker by implementing Runnable, you should override the run() method only. And pass an instance of this worker to a Thread, like new Thread(new NewClass()).start(); So you can do the following public class NewClass implements Runnable{ public static void main(String[] agrg){ NewClass n =new NewClass(); n.start(); } void start(){ Thread th=new Thread(this); th.start(); } @Override public void run() { System.out.println("Thread"); } }
upvote count: 3

http://stackoverflow.com/comment/37030031
comment on: http://stackoverflow.com/q/24022925
score: 0
has text: updated with location adapter
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37017905
type: Comment
comment on: http://stackoverflow.com/q/24016692
has text: You might want to look at Spring Profiles. These allow you to create specific beans for specific configuration (dev, prod, ..). See [this blog post](http://gordondickens.com/wordpress/2012/06/12/spring-3-1-environment-profiles/) or [the docs](http://docs.spring.io/spring/docs/4.0.5.RELEASE/spring-framework-reference/htmlsingle/#beans-definition-profiles)
score: 0
type: QuestionComment

http://stackoverflow.com/q/23961652
type: Question
has answer: http://stackoverflow.com/a/23966305
score: -1
has title: Image Interpolation Help Needed
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36915738
type: UnansweredQuestion
tagged with: android
has body: I'm trying to figure out how to use my thermal sensor to change colors to an overlay that I have over the Android camera. The problem is that the data I get back is in a 16x4 array. How do I resize this 16x4 grid to a different resolution? Such as 32x8, 48x12...etc. Edit: For instance, I have this as my draw method: public void onDraw(Canvas canvas){ super.onDraw(canvas); for(int x = 0; x &lt; 4; x++){ for(int y = 0; y &lt; 16; y++){ // mapping 2D array to 1D array int index = x*GRID_WIDTH + y; tempVal = currentTemperatureValues.get(index); // 68x68 bitmap squares to display temperature data if(tempVal &gt;= 40.0) bitmaps[x][y].eraseColor(Color.RED); else if(tempVal &lt; 40.0 &amp;&amp; tempVal &gt; 35.0) bitmaps[x][y].eraseColor(Color.YELLOW); else bitmaps[x][y].eraseColor(Color.BLUE); } } combinedBitmap = mergeBitmaps(); // combinedBitmap = fastblur(combinedBitmap, 45); paint.setAlpha(alphaValue); canvas.drawBitmap(combinedBitmap, xBitmap, yBitmap, paint); Log.i(TAG,"Done drawing"); } The current implementation is to draw to a 16x4 overlay over my camera preview, but resolution is very low, and I'd like to improve it the best I can.
tagged with: java
tagged with: image-processing
downvote count: 1

http://stackoverflow.com/q/23948925
has comment: http://stackoverflow.com/comment/36897991
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23958180
has comment: http://stackoverflow.com/comment/36897229
has comment: http://stackoverflow.com/comment/36892640
type: Question
tagged with: java
tagged with: jaxb
has title: JAXB marshalling a map without adapter
has comment: http://stackoverflow.com/comment/36902063
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a Map and I want to marshal it to XML. As long as there are plenty of maps of different types I really don't want to write a custom XmlAdapter for each map. I have XmlAdapters for all classes that I use as keys. When I marshal this classes standalone they work perfectly, but when I marshal the maps the keys are just ignored. All I get is the following XML: 1 something What I want instead is: something 1 something Is there a way to achieve the required result without coding a custom XmlAdapter for each map?

http://stackoverflow.com/q/23984048
has body: Well as the title says, I was asked to perform an application with electronic signature PAdES. Sign PDF documents with this, but they know how to interpret these signatures in java, if someone have worked with something like this to tell me how I can validate PAdES. Thanks, Greetings!
upvote count: 1
answer count: 1
favorite count: 0
tagged with: pades
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23989891
accepted answer: http://stackoverflow.com/a/23989891
tagged with: electronic-signature
type: Question
score: 1
has title: PAdES electronic signature in java
tagged with: java

http://stackoverflow.com/a/24028550
answers question: http://stackoverflow.com/q/24028481
type: Answer
score: 2
downvote count: 0
has body: Technically it's not. Both are heavy weight components, but because JFrame has been setup to support the JRootPane, which contains the content pane (and possibly) the glass pane (as well as the JMenuBar), it is consider "light weight", because it's been deliberately configured to support light weight components Essentially JFrame and JWindow have been modified as light weight containers that support light weight components
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24028481

http://stackoverflow.com/a/23951880
has comment: http://stackoverflow.com/comment/36908288
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23951763
has body: See the Javadoc. Scanner.next() doesn't return null. You have to check hasNext() before calling next(). 95% of your code isn't relevant to the question, including all the Swing code.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37113516
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24067825
score: 0
has text: Question 2 is kind of tricky, you wouldn't have the methods in the subclass. However, you could still call them from the super class (making it the exact same).

http://stackoverflow.com/a/23944016
upvote count: 2
has body: When you rotate, it rotates the entire scene. So to rotate a single object, you rotate the entire scene, draw your object, then rotate your screen back. glRotatef(i, 0, 1, 0); // Draw object. glRotatef(-i, 0, 1, 0); As Reto Koradi pointed out, if you continually do this you might have floating point rounding errors that accumulate over time. HolyBlackCat's answer offers a better solution.
answers question: http://stackoverflow.com/q/23943941
has comment: http://stackoverflow.com/comment/36882362
has comment: http://stackoverflow.com/comment/36887176
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23943941

http://stackoverflow.com/comment/37127415
has text: but what can I do If this is being handled by a TOMCAT server which handles the thread generation and even after putting the thread to close for more than an hour this exception is still there
type: AnswerComment
comment on: http://stackoverflow.com/a/24075122
type: Comment
score: 0

http://stackoverflow.com/comment/36994038
comment on: http://stackoverflow.com/q/24003490
score: 0
has text: can you help me enhance my code to avoid this exception.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37180014
type: QuestionComment
has text: BreezySwing handles addButton() in the constructor. xobutton = addButton ("[ ]", 1,1,1,1);
comment on: http://stackoverflow.com/q/24102939
score: 0
type: Comment

http://stackoverflow.com/q/23977678
has comment: http://stackoverflow.com/comment/36944955
favorite count: 0
tagged with: netbeans-platform
has body: While making a desktop application,I want it to be able to download a video file from server and save it in client's PC. How to do it?I have no idea. What tools to use?Please guide I am looking forward to some kind of integrated FTP like thing.I am not clear how it will work.
has answer: http://stackoverflow.com/a/23977889
type: AnsweredQuestion
tagged with: java
score: -4
has title: Java Desktop file download
type: Question
tagged with: desktop-application
accepted answer: http://stackoverflow.com/a/23977889
downvote count: 4
upvote count: 0
answer count: 1

http://stackoverflow.com/a/23985630
has comment: http://stackoverflow.com/comment/36960209
has comment: http://stackoverflow.com/comment/36960324
has comment: http://stackoverflow.com/comment/36960743
has comment: http://stackoverflow.com/comment/36960212
has comment: http://stackoverflow.com/comment/36960360
has comment: http://stackoverflow.com/comment/36960205
has comment: http://stackoverflow.com/comment/36960514
has comment: http://stackoverflow.com/comment/36960237
has body: A BufferedImage is an Image, in other words it extends from the Image abstract class. You don't need to convert anything. Please check out the BufferedImage API for the details. Edit You state in comment: When I run this code, I get spammed with errors in my console. Why would it do this? When the java file is converted into a class it has no errors found. Then you'll want to post any error/exception messages that you receive, and also indicate for us which line(s) throw them. Also as an aside, you will never want to read in an image from within a paintComponent method. This method should be lean, mean, and fast as hell, and it should concern itself with painting and painting only. Why read in the image multiple times when you only need to read it into a variable once say in the constructor? Edit 2 Your error is a NullPointerException that occurs on engine.java:51, on line 51 of your engine.java class. Note that this has nothing to do with use of BufferedImage vs. Image, and everything to do with trying to use a null reference variable. As I suspected, the key to the problem is in the exception message. In your future questions, you will want to post any and all exception messages and indicate which line throws them. Edit 3 NEVER do this: try{ image = ImageIO.read(new File("spells.png")); } catch(IOException e) { } never leave your catch block blank. At least print the stack trace. Otherwise you will have no clue if something wrong occurs. Edit 4 You state in comment: Note on your edit: when declarations of the spritesheet and the sprites are put outside the paintComponent method. 20 parts of the code have unnecessary errors at variables and sometimes curly brackets saying "engine.java:&lt;line&gt;: class, interface, or enum expected" From your error, I'm guessing that you've got code that calls methods, sitting out naked in the class outside of any constructor or method, where it doesn't belong. I suggest that you declare your Image variable in the class, and initi…
upvote count: 7
has comment: http://stackoverflow.com/comment/36959935
has comment: http://stackoverflow.com/comment/36959972
score: 7
has comment: http://stackoverflow.com/comment/36960318
has comment: http://stackoverflow.com/comment/36960537
has comment: http://stackoverflow.com/comment/36960399
accepted answer of: http://stackoverflow.com/q/23985626
has comment: http://stackoverflow.com/comment/36960729
has comment: http://stackoverflow.com/comment/36960102
has comment: http://stackoverflow.com/comment/36960346
has comment: http://stackoverflow.com/comment/36960751
has comment: http://stackoverflow.com/comment/36960073
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23985626
downvote count: 0
has comment: http://stackoverflow.com/comment/36960694
type: Answer

jpa
tags question: http://stackoverflow.com/q/23958333
tags question: http://stackoverflow.com/q/24000740
tags question: http://stackoverflow.com/q/24089075
tags question: http://stackoverflow.com/q/24035404
tags question: http://stackoverflow.com/q/24055723
tags question: http://stackoverflow.com/q/23993921
tags question: http://stackoverflow.com/q/23941914
tags question: http://stackoverflow.com/q/23961205
tags question: http://stackoverflow.com/q/24015626
tags question: http://stackoverflow.com/q/23982044
tags question: http://stackoverflow.com/q/24001951
tags question: http://stackoverflow.com/q/24006357
tags question: http://stackoverflow.com/q/23957674
tags question: http://stackoverflow.com/q/23985945
tags question: http://stackoverflow.com/q/23949030
tags question: http://stackoverflow.com/q/23984968
tags question: http://stackoverflow.com/q/23945908
tags question: http://stackoverflow.com/q/24065450
tags question: http://stackoverflow.com/q/24059491
tags question: http://stackoverflow.com/q/24098649
tags question: http://stackoverflow.com/q/23957828
tags question: http://stackoverflow.com/q/24015079
tags question: http://stackoverflow.com/q/24091946
tags question: http://stackoverflow.com/q/24084175
tags question: http://stackoverflow.com/q/24047242
tags question: http://stackoverflow.com/q/23973872
tags question: http://stackoverflow.com/q/24045342
tags question: http://stackoverflow.com/q/23954979
tags question: http://stackoverflow.com/q/23992949
tags question: http://stackoverflow.com/q/24014036
tags question: http://stackoverflow.com/q/24073182
tags question: http://stackoverflow.com/q/24099904
tags question: http://stackoverflow.com/q/23977909
tags question: http://stackoverflow.com/q/24020916
tags question: http://stackoverflow.com/q/24010152
tags question: http://stackoverflow.com/q/24019427
tags question: http://stackoverflow.com/q/24085653
tags question: http://stackoverflow.com/q/24070183
tags question: http://stackoverflow.com/q/24066153
tags question: http://stackoverflow.com/q/23957295
type: Tag
tags question: http://stackoverflow.com/q/24078508
tags question: http://stackoverflow.com/q/24023655
tags question: http://stackoverflow.com/q/24074749
tags question: http://stackoverflow.com/q/24078369
tags question: http://stackoverflow.com/q/24024633
tags question: http://stackoverflow.com/q/24001269
tags question: http://stackoverflow.com/q/24011759
tags question: http://stackoverflow.com/q/23975966
tags question: http://stackoverflow.com/q/23981799
tags question: http://stackoverflow.com/q/24060782
tags question: http://stackoverflow.com/q/24065284
tags question: http://stackoverflow.com/q/24007873
tags question: http://stackoverflow.com/q/24103497
tags question: http://stackoverflow.com/q/24053894
tags question: http://stackoverflow.com/q/24060498
tags question: http://stackoverflow.com/q/24038665
tags question: http://stackoverflow.com/q/23994515
tags question: http://stackoverflow.com/q/24020326
tags question: http://stackoverflow.com/q/24065524
tag name: jpa
tags question: http://stackoverflow.com/q/23948707
tags question: http://stackoverflow.com/q/24053526
tags question: http://stackoverflow.com/q/24011055
tags question: http://stackoverflow.com/q/23976763
tags question: http://stackoverflow.com/q/24040208
tags question: http://stackoverflow.com/q/24021606
tags question: http://stackoverflow.com/q/23996149
tags question: http://stackoverflow.com/q/23994275
tags question: http://stackoverflow.com/q/23974517
tags question: http://stackoverflow.com/q/24081636
tags question: http://stackoverflow.com/q/24019854
tags question: http://stackoverflow.com/q/24046913
tags question: http://stackoverflow.com/q/24054517
tags question: http://stackoverflow.com/q/24034960
tags question: http://stackoverflow.com/q/24072111
tags question: http://stackoverflow.com/q/24046856
tags question: http://stackoverflow.com/q/24073418
tags question: http://stackoverflow.com/q/24057666
tags question: http://stackoverflow.com/q/24095083

http://stackoverflow.com/a/24061680
score: 11
downvote count: 0
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/37101604
has comment: http://stackoverflow.com/comment/37101913
has comment: http://stackoverflow.com/comment/37101559
has body: You can replace spaces and use equalsIgnoreCase: if (a.replace(" ", "").equalsIgnoreCase(b.replace(" ", ""))) { If you want to also disregard other whitespace characters you can use replaceAll: if (a.replaceAll("\\s", "").equalsIgnoreCase(b.replaceAll("\\s", ""))) { If you want instead to check for containment, use contains and toLowerCase: if (a.replace(" ", "").toLowerCase().contains(b.replace(" ", "").toLowerCase())) { Again, if you want to disregard other whitespace character use replaceAll("\\s", "") as shown above.
has comment: http://stackoverflow.com/comment/37101842
answers question: http://stackoverflow.com/q/24061638
has comment: http://stackoverflow.com/comment/37101624

http://stackoverflow.com/comment/36932759
comment on: http://stackoverflow.com/q/23970951
type: Comment
has text: Mm i would throw an exception,
type: QuestionComment
score: 0

http://stackoverflow.com/a/23963551
has comment: http://stackoverflow.com/comment/36922333
upvote count: 3
score: 3
has body: Generally any time you have repeated functionality like that, you want to extract that code out into a helper method like this: private JButton makeJButton(String label, String toolTip, Color bgColor, final Color highlight) { JButton button = new JButton(label); button.setToolTipText(toolTip); button.setBackground(bgColor); button.setHorizontalAlignment(JButton.CENTER); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Highlighter.shadeSymmetric(currentCell, highlight); } }); return button; } Then your makeScoremasterBonuses() method becomes much simpler: private void makeScoremasterBonuses() { pnlBonuses = new JPanel(new GridLayout(1, 6)); pnlBonuses.setSize(6, 1); pnlBonuses.add(new JLabel("Legend: ")); pnlBonuses.add(makeJButton("3W", "This is a triple-word cell.", TRIPLE_WORD, TRIPLE_WORD)); pnlBonuses.add(makeJButton("3L", "This is a triple-letter cell.", TRIPLE_LETTER, TRIPLE_LETTER)); pnlBonuses.add(makeJButton("2W", "This is a double-word cell.", DOUBLE_WORD, DOUBLE_WORD)); pnlBonuses.add(makeJButton("3L", "This is a double-letter cell.", DOUBLE_LETTER, DOUBLE_LETTER)); pnlBonuses.add(makeJButton("", "No bonus.", WHITE, B_NORMAL)); }
answers question: http://stackoverflow.com/q/23963455
has comment: http://stackoverflow.com/comment/36921187
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23963455
type: Answer

http://stackoverflow.com/comment/36972567
type: QuestionComment
comment on: http://stackoverflow.com/q/23992615
score: 0
has text: This can actually be done in O(nLogn). Sort in ascending order (nLogn for mergeSort) . Get array[k] which is O(1).
type: Comment

http://stackoverflow.com/comment/74420529
type: AnswerComment
comment on: http://stackoverflow.com/a/24092481
type: Comment
has text: Also sl4j dependency
score: 0

http://stackoverflow.com/q/24019889
has body: I'm trying to setup entity manager with Spring 4 and I always get NullPointerException when I try to inject EntityManager with @PersistenceContext annotation. I have Maven web application. Here's my applicationContext.xml configuration com.mysite.ecommerceapp.domain com.mysite.ecommerceapp.domain.* com.mysite.ecommerceapp.domain.*.* com.mysite.ecommerceapp.domain.*.*.* create-drop org.hibernate.dialect.PostgreSQL9Dialect <tx:annotation-driven transaction-manager="transactionManager" /> applicationContext.xml is located under WEB-INF folder. Because I use NetBeans 8 I added Spring Framework support to my project from project properties -> Frameworks. I'm using EntityManager injection with file called GenericDaoImpl and here's it's code: public abstract class GenericDaoImpl<E extends EntityClass> implements GenericDao<E> { private Class<E> entityClass; @PersistenceContext() private EntityManager entityManager; //Constructor public GenericDaoImpl(final Class<E> entityClass) { this.entityClass = entityClass; } //Getters and Setters public Class<E> getEntityClass() { return entityClass; } public void setEntityClass(final Class<E> entityClass) { this.entityClass = entityClass; } public EntityManager getEntityManager() { return entityManager; } public void setEntityManager(final EntityManager entityManager) { this.entityManager = entityManager; } public void checkEntityManager() { System.out.println("em: " + this.entityManager); } } I have one test file where I simply print entity manager with checkEntityManager() method. Whenever I run it I always get null value for EntityManager. What could be wrong? My biggest doubt is that my applicationContext.xml is in wrong place or it is not used anywhere and thus it can't find configuration properties in applicationContext. I have tested moving applicationContext.xml file to resources folder but it didn't helped either. Other questions that I also have are following: Do I need to have persistence.xml? Since I use Spring 4 with pac…
has title: Null EntityManager Spring 4
type: Question
answer count: 1
downvote count: 0
tagged with: entitymanager
has comment: http://stackoverflow.com/comment/37033133
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/37025824
has answer: http://stackoverflow.com/a/24183571
tagged with: spring
has comment: http://stackoverflow.com/comment/37043669
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24183571
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37030996
tagged with: web-applications

http://stackoverflow.com/a/24098325
has body: You need to change the TextField's color attribute. Assuming it is defined in XML: &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/your_green" android:text="Hello"/&gt; Assuming you want it set programmatically: int c = Color.parseColor("#ff0000"); mTextView.setTextColor(c); or int c = getResources().getColor(R.color.your_green); mTextView.setTextColor(c);
has comment: http://stackoverflow.com/comment/37170421
answers question: http://stackoverflow.com/q/24098261
upvote count: 0
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/37170335
score: -1

http://stackoverflow.com/q/24089677
has answer: http://stackoverflow.com/a/24090023
answer count: 2
upvote count: 0
tagged with: arrays
possible better answer: http://stackoverflow.com/a/24090109
has comment: http://stackoverflow.com/comment/37154209
has comment: http://stackoverflow.com/comment/37154377
has answer: http://stackoverflow.com/a/24090109
has title: how to read 1 line of numbers and convert it to an array with all consecutive ints java?
accepted answer: http://stackoverflow.com/a/24090023
favorite count: 0
has body: I have 2500 text files that all need to be read in these 4 for loops. the first 2 for loops are for looping trough the 2500 files named: 1_1.txt, 1_2.txt and so on to 1_50.txt and then it goes on like this: 2_1.txt, 2_2.txt etc... The other 2 for loops are for drawing a square of 16X16 pixels. the colors of these pixels are being determined by the numbers in the text files which all have 1 row of 256 numbers. color(number) returns the color it should be. somehow the array returns all random numbers between 47 and 52 which are not stated in any text file. I want it to read all the numbers 1 by 1 and store it into an int array because the char array is not doing the trick. int counter = 0; for(int plotZ = 1; plotZ < 50; plotZ ++) { for(int plotX = 1; plotX < 50; plotX ++) { String theString = ""; String filename = "maps/" + plotX + "_" + plotZ + ".txt"; File file = new File(filename); Scanner scanner; char[] charArray = null; try { scanner = new Scanner(file); theString = scanner.nextLine(); while (scanner.hasNextLine()) { theString = theString + "\n" + scanner.nextLine(); charArray = theString.toCharArray(); } } catch (FileNotFoundException e) { e.printStackTrace(); } counter = 0; for(int blockX = plotX * 16; blockX < plotX * 16 + 16; blockX ++) { for(int blockZ = plotZ * 16; blockZ < plotZ * 16 + 16; blockZ ++) { int number = charArray[counter]; g2d.setColor(color(number)); g2d.drawLine(blockX, blockZ, blockX, blockZ); counter ++; } } } }
downvote count: 1
tagged with: text
type: AnsweredQuestion
tagged with: java
tagged with: file
score: -1
tagged with: loops
has comment: http://stackoverflow.com/comment/37154212
type: Question

http://stackoverflow.com/comment/37072963
has text: @ElliottFrisch we have some tool for deployment, but in general it just puts war file in the tomcat web folder
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24045540
type: QuestionComment

phrase
type: Tag
tag name: phrase
tags question: http://stackoverflow.com/q/23944612

http://stackoverflow.com/q/24017257
favorite count: 0
has comment: http://stackoverflow.com/comment/37018843
has body: I have been attempting to use a quadratic sort in java, to sort an arraylist of messages. I have used the following code, however it will not compile for me. The error I keep getting is cannot find symbol variable length Below is the sort and the swap I am using: public static void quadraticSort(ArrayList&lt;Message&gt; m) { String s1 = "abcd"; String s2 = "efgh"; int val = "abcd".compareTo("efgh"); for (int i = 0; i &lt; s1.length; i += 1) { for (int s2 = i; s2 &lt; s1.length; s2 += 1) { if ((int)s1[s2].messageText.compareTo(0) &lt;(int)s2[i].messageText.compareTo(0)) { swap(s1, i, s2); } } } } private static void swap(ArrayList&lt;Message&gt; list, int to, int from) { Message temp = list[to]; list.set(to , from); list.set(from , temp); }
type: UnansweredQuestion
has title: Quadratic sort of ArrayList
downvote count: 4
upvote count: 0
tagged with: java
score: -4
type: Question
has answer: http://stackoverflow.com/a/24017307
tagged with: sorting
has comment: http://stackoverflow.com/comment/37018746
tagged with: arraylist
answer count: 2
has comment: http://stackoverflow.com/comment/37018764
has answer: http://stackoverflow.com/a/24017632

http://stackoverflow.com/a/23971644
has comment: http://stackoverflow.com/comment/36934474
has comment: http://stackoverflow.com/comment/36933937
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23971589
accepted answer of: http://stackoverflow.com/q/23971589
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36933910
has body: format has been a member method of String since Java 1.5. Ensure you are using this version or greater and that you don't have another String class on your classpath.
has comment: http://stackoverflow.com/comment/36933955
type: Answer

http://stackoverflow.com/comment/37142910
type: Comment
has text: I think that this part of code make this problem:if( params.outputStatistics() == 3 || params.useGui()) { _jobTimes.put(job.toString(), new Long(duration)); _jobTimesWithQueue.put(job.toString(), new Long(durationWithQueue)); _jobFiles.put( job.toString(), filesAccessed); }
comment on: http://stackoverflow.com/a/23975008
type: AnswerComment
score: 0

http://stackoverflow.com/a/25248698
score: 1
accepted answer of: http://stackoverflow.com/q/23963525
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23963525
upvote count: 1
has body: UPDATE and ANSWER. Well it turned out that we were doing everything right.(almost) When creating the service bus using the service management console I had added my username as a Windows user. On the client side I was using the same username and its password in the connection string. I would pass the authetication step without problem. The connection would be created. If I changed my password to a wrong password, I would get authetication error. I was convinced at that time that security is not the issue here. But with the right username and password I was still not able to create a consumer or producer. Then, I enabled the Qpid JMS package logging. The log showed amqp:unauthorized-access Attempted to perform an unauthorized operation Why would that be? It turned out (by trial and error) when you are using your username in the connection string you are supposed to use fully qualified as it appears in the service management console. i.e. username@domainname.com. And you will need to URL encode that as well) Below in the answers, Aurvoir, says if they create the queues programtically things work out. I have not tried this solution. But I can see how it would work if you create your own queue using your own credentials and put messages in the same queue using the same credentials on the connection.
has comment: http://stackoverflow.com/comment/80517407
type: Answer
downvote count: 0

http://stackoverflow.com/a/23970554
type: Answer
answers question: http://stackoverflow.com/q/23970272
has body: You defined a String object with the following code: public String texto; but you never initialized the variable with a value. A String class is a nullable which means it can be NULL. At the following line you use this variable while it hasn't been initialized anywhere in your code. if(texto.length()&lt;1){ This is where java throws a NULLPointerException.
score: 0

http://stackoverflow.com/q/23960479
linked to: http://stackoverflow.com/q/5244839
tagged with: regex
tagged with: java
has title: Why "\r\n".split("\r\n") returns an empty array?
type: Question
tagged with: newline
tagged with: text-processing
score: 4
has answer: http://stackoverflow.com/a/23960606
upvote count: 4
answer count: 2
downvote count: 0
tagged with: string
has body: I've got a regex "[\r\n\f]+" to find the number of lines contained in a String. My code is like this: pattern = Pattern.compile("[\\r\\n\\f]+") String[] lines = pattern.split(texts); In my unit test I've got sample strings like these: "\t\t\t \r\n \n" "\r\n" The result of parsing the first string is 2, however it becomes 0 when it's parsing the second string. I thought the second string includes 1 line although the line is "blank" (suppose I'm editing a file which begins with "\r\n" in a text editor, should the caret be placed at the second line?). Is my regex incorrect for parsing lines? or am I missing something here? Edit: I think I'll make the question more obvious: Why // notice the trailing space in the string "\r\n ".split("\r\n").length == 2 // results in 2 strings {"", " "}. So this block of text has two lines. but // notice there's no trailing space in the string "\r\n".split("\r\n").length == 0 // results in an empty array. Why "" (empty string) is not in the result and this block of text contains 0 lines?
favorite count: 0
has answer: http://stackoverflow.com/a/23960683
type: UnansweredQuestion

http://stackoverflow.com/q/24075301
tagged with: mysql
answer count: 0
type: UnansweredQuestion
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37126873
has body: I am having issues with the inconsistent result when I retrieve data from the database. These are the two cases: 1) There are times when it outputs the complete expected rows and sometimes it's not complete. For example, there are really 5 rows in the database but there are times when this is retrieved from the search function of my system, it is only 3 and sometimes it returns the complete 5 rows. It will return the complete 5 rows for some time but after a while, it will return just the 3. The search button that triggers this retrieval is clicked just milliseconds after the first search. This seems to happen randomly. I am using the same search function on my system. 2) There are times when the data retrieved has the new values just saved, and sometimes it has the old values. Again, this seems to happen randomly. Is this has anything to do with the cache? Sometimes it gets from the cache but sometimes it gets from the actual database? Or is it the mysql-connector installed? This is a GWT-developed system installed on a tomcat server. The tomcat server is installed using the bitnami stack tomcat installer. The following is the context.xml: &lt;Resource name="MYSQLDB" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" auth="Container" type="javax.sql.DataSource" maxActive="500" maxIdle="30" maxWait="60000" username="f1db" password="systema01" driverClassName="com.mysql.jdbc.Driver" poolPreparedStatements="true" maxOpenPreparedStatements="20" validationQuery="SELECT 1" testOnBorrow="true" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" url="jdbc:mysql://localhost:3306/f1db?autoReconnect=true"/&gt; Does anyone know what's causing this inconsistency in data retrieval? I already spent days debugging this but still can't figure out what's wrong. Thanks in advance.
type: Question
score: 0
has title: MySQL Inconsistent Data Retrieval
has comment: http://stackoverflow.com/comment/37127164
tagged with: gwt
tagged with: java

http://stackoverflow.com/a/24085914
has body: You most likely have some of MyOtherObjects, not implementing Serializable, the fact that MyObj implements Serializable, does not guarantee, that it could actually be Serialized, not unless all of it's members, can be serialized as well. Check the hierarchy of MyOtherObjects, there you should find some unserializable object.
type: Answer
answers question: http://stackoverflow.com/q/24085194
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/24044903
answer count: 0
has title: Native crash on an Android-Java based app?
has comment: http://stackoverflow.com/comment/47314968
has comment: http://stackoverflow.com/comment/43572477
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/29545557
has comment: http://stackoverflow.com/comment/42513219
has comment: http://stackoverflow.com/comment/37071235
has comment: http://stackoverflow.com/comment/47133993
tagged with: java-native-interface
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/42512425
has comment: http://stackoverflow.com/comment/37086986
type: Question
has comment: http://stackoverflow.com/comment/42514334
score: 5
has comment: http://stackoverflow.com/comment/47144179
has comment: http://stackoverflow.com/comment/65285442
downvote count: 0
has body: Background My app has 100% code written in Java, it doesn't need to make any heavy operations. The app itself uses only the next libraries, yet non of them have JNI code: ActionBarSherlock google-play-services_lib The problem Today I got a weird crash report, which doesn't show any normal exception information . The report was sent via a "Galaxy S5 (klte)" device, with Android 4.4 . Here's the crash report title: Native crash at /dev/ashmem/dalvik-jit-code-cache in /dev/ashmem/dalvik-jit-code-cache (deleted) And here is the crash content : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/kltexx/klte:4.4.2/KOT49H/G900FXXU1ANE2:user/release-keys' Revision: '14' pid: 11904, tid: 11904, name: .lb.app_manager &gt;&gt;&gt; com.lb.app_manager &lt;&lt;&lt; signal 7 (SIGBUS), code 2 (BUS_ADRERR), fault addr 6d7b97cc SOME_NUMBERS backtrace: #00 pc 00026a56 /dev/ashmem/dalvik-jit-code-cache (deleted) #01 pc 00026a55 /dev/ashmem/dalvik-jit-code-cache (deleted) code around pc: SOME_NUMBERS code around lr: SOME_NUMBERS where "SOME_NUMBERS" look like a lot of random hexadecimal numbers. What I've tried Some websites claim people should decode images in a synchronized manner (yet I have made many apps that do it and never got this error). The thing is, for this app I already decode the bitmaps using a single thread, so this can't be it. I didn't find any other thing that can be related to things I do on the app, that have anything to do with native handling of code. I thought, maybe since it's Android 4.4, the user moved to "ART" runtime, but the crash report has the word "dalvik" in it, so that's probably not it (and even if it was this, I have no idea how to handle it). To make things even more unclear, the user wrote "Not sure" in the report... :( The question How could this be? Why does it occur? How can I fix it? Anyone else had this issue before?
has comment: http://stackoverflow.com/comment/37106504
favorite count: 0
tagged with: dalvik
has comment: http://stackoverflow.com/comment/37109126
tagged with: android
has comment: http://stackoverflow.com/comment/47313252
has comment: http://stackoverflow.com/comment/37109913
has comment: http://stackoverflow.com/comment/42513821
tagged with: crash-reports

http://stackoverflow.com/comment/93353852
type: AnswerComment
comment on: http://stackoverflow.com/a/24096493
has text: @Shameer Java always had multiple inheritance of _types_. What default methods add is multiple inheritance of _behavior_. The problems we typically associate with "multiple inheritance" in languages like C++ come from multiple inheritance of _state_, which Java does not have.
type: Comment
score: 0

http://stackoverflow.com/a/24084696
type: Answer
score: 0
has body: I think the best and most common approach is to have all the data in the JTable and use a filter which is based on the combobox selection. In this question someone has done this based on a Text box. Changing for a combo would be simple. How can I filter rows in a JTable? Or for a tutorial look at http://docs.oracle.com/javase/tutorial/uiswing/components/table.html and select "Sorting and Filtering"
answers question: http://stackoverflow.com/q/24081941

http://stackoverflow.com/q/24001048
tagged with: methods
has comment: http://stackoverflow.com/comment/36989336
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/24001085
accepted answer: http://stackoverflow.com/a/24001085
has comment: http://stackoverflow.com/comment/36989370
has comment: http://stackoverflow.com/comment/36989185
has body: I have a problem using a variable surrounded with a try : Here's the beginning of my method : public static word[] countWords(String text) { try { text = Preprocesseur.preprocess(text); } catch (IOException e) { System.out.println("Error méthod countWords"); e.printStackTrace(); } Actually i need to use the String text (preprocessed) several line after, but java doesn't affect the value Preprocesseur.preprocess(text) to the whole method --> it stays in the try/catch block I was wondering : how to call my method Preprocesseur.preprocess and affect its return String to the whole countWords method ? Because a try/catch block is required (or throws declaration which leads to the same result)
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/40480
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36989343
has title: Get a variable out of a try
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36989179
linked to: http://stackoverflow.com/q/40480

http://stackoverflow.com/comment/37092559
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24056657
has text: What warning of null pointers are you worried about? Can you explain that a bit more? Do you want a warning that it might throw a NPE when trying to check something like this: `StringUtils.isEmpty(null)`? Because if that's the case, then you needn't worry about it as `StringUtils.isEmpty()` handles `null` by itself and thus *FindBugs* will not bug you with unnecessary warnings. [Read the docs](http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isEmpty(java.lang.CharSequence)) for more info.

http://stackoverflow.com/q/24077901
answer count: 3
has comment: http://stackoverflow.com/comment/86772795
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37134786
has answer: http://stackoverflow.com/a/24078078
linked to: http://stackoverflow.com/q/2566350
tagged with: android
tagged with: android-activity
tagged with: service
has answer: http://stackoverflow.com/a/24078150
score: 9
type: UnansweredQuestion
has body: My question is how to create an always running background service. I created an IntentService which runs in background as long as the app is running. However, when app is killed, service is gone as well. What i want to create is to create a background service that always runs and posts notifications. (Similar to whatsapp, facebook or any other similar applications.) When the notification is clicked, it should start the application as well. How can i do it?
has title: How to create an always running background service?
has comment: http://stackoverflow.com/comment/37131904
type: Question
linked to: http://stackoverflow.com/q/12016623
upvote count: 9
linked to: http://stackoverflow.com/q/35200081
has answer: http://stackoverflow.com/a/24078387
tagged with: java
duplicate of: http://stackoverflow.com/q/12016623

http://stackoverflow.com/a/24045085
score: 5
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24045046
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24045046
has body: Change to "Navigator" view. And under your project ,right-click on the classpath file and uncheck the "read-only" option. BTW, you do know that you need ALL the Jars for your project to compile right?

http://stackoverflow.com/a/35293961
score: 3
upvote count: 3
has body: You can use implicit implicit def int2byte(int: Int) = { int.toByte } And that will convert all Int values in scope in places where byte is required.
downvote count: 0
answers question: http://stackoverflow.com/q/24010140
type: Answer

http://stackoverflow.com/comment/36918667
type: QuestionComment
comment on: http://stackoverflow.com/q/23943025
has text: @BoristheSpider The video support, is, obvious, a in built support of the new "video", access to the hardware would come down o the implementation, remember Adobe and Apples bickering about Flash performance, which Adobe put den to Apples reluctance o provide direct access to the hardware, so it would be implementation specific. File access (save/upload) is pretty much support since early versions of HTML. Not sure that this is what the op is after, but the details are thin :P
score: 0
type: Comment

http://stackoverflow.com/a/24157756
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23950492
answers question: http://stackoverflow.com/q/23950492
type: Answer
has body: Since your primary need is to be able to cancel all running tasks at once you should be able to use shutdownNow() of the ExecutorService. Default ExecutorService implementations will call Thread.interrupt() in order to abort the running threads so you should handle InterrputedException properly (by closing any resources used and exiting the thread).
score: 1
upvote count: 1

http://stackoverflow.com/q/24043361
type: Question
has comment: http://stackoverflow.com/comment/37069067
linked to: http://stackoverflow.com/q/4585867
score: -1
has answer: http://stackoverflow.com/a/24043453
answer count: 2
has answer: http://stackoverflow.com/a/24043414
accepted answer: http://stackoverflow.com/a/24043414
has comment: http://stackoverflow.com/comment/37067793
favorite count: 0
has body: I want to make the white circles of JRadioButtons transparent. How can I do that? setOpaque(false) only removes the background from text and not the circle.
tagged with: jradiobutton
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24043453
tagged with: java
downvote count: 2
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37067800
has title: How to make JRadioButton transparent

http://stackoverflow.com/comment/37034905
score: 0
type: Comment
type: QuestionComment
has text: Try sticking another pair of parentheses around `(TextView)findViewById(R.id.myText)`
comment on: http://stackoverflow.com/q/24025596

http://stackoverflow.com/q/24023986
score: 0
tagged with: java
tagged with: hibernate
type: Question
has title: subsets in spring/hibernate entity mappings
answer count: 2
has answer: http://stackoverflow.com/a/24030804
has answer: http://stackoverflow.com/a/24027101
possible better answer: http://stackoverflow.com/a/24027101
tagged with: spring
has body: In spring/hibernate, what is the best way to handle subsets of data that need to be used in different situations? I have a spring mvc app using hibernate to create an interface for a massive database in MySQL with millions of rows per table. Some of the JSP views in the app will only interact with a given subset of perhaps 100,000 of the rows in a given table that might have 10,000,000 rows in total. I want the view to retrieve data quickly, so I tried creating a new database table with the 100,000 rows, matched by a new entity to map to the new database table. But this will likely lead to complicated code. What is a better way to get the speed improvements of only working with a subset of the data? Here is what I have so far: @Entity @Table(name = "conc_dual_key") public class ConcDualKey { @Id @Column(name="dualkey") private String name; @ManyToMany(cascade = {CascadeType.ALL})// @JoinTable(name="conc_dual_key_junction_new", joinColumns={@JoinColumn(name="dualkey")}, inverseJoinColumns={ @JoinColumn(name = "conceptid", referencedColumnName="id", insertable = false, updatable = false), @JoinColumn(name="effectiveTime", referencedColumnName="effectiveTime", insertable = false, updatable = false)}) private Set&lt;Concept&gt; concepts = new HashSet&lt;Concept&gt;(); //getters and setters } I then just made a copy of this entity with different table mappings in the database, to new tables that I created to contain the subset data: @Entity @Table(name = "conc_finding_dual_key") public class ConcFindingDualKey { @Id @Column(name="dualkey") private String name; @ManyToMany(cascade = {CascadeType.ALL})// @JoinTable(name="conc_finding_dual_key_junction_new", joinColumns={@JoinColumn(name="dualkey")}, inverseJoinColumns={ @JoinColumn(name = "conceptid", referencedColumnName="id", insertable = false, updatable = false), @JoinColumn(name="effectiveTime", referencedColumnName="effectiveTime", insertable = false, updatable = false)}) private Set&lt;Concept&gt; concepts = new Has…
accepted answer: http://stackoverflow.com/a/24030804
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/36928886
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23964045
has text: So there is no way to make it work without editing the code?

http://stackoverflow.com/a/24010567
type: Answer
has body: You can optimize arbitrary JavaScript code using the GWT compiler, just use the appropriately named LinkerContext.optimizeJavaScript(TreeLogger, String) method. LinkerContext objects are available inside Linkers, which are pieces of custom code run during the compilation. Here's a minimal example on how to write one: @LinkerOrder(LinkerOrder.Order.POST) public class ScriptOptimizer extends AbstractLinker { @Override public String getDescription() { return "Optimizes external JavaScript files."; } @Override public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException { // This is some arbitrary JavaScript code you'd probably want to read // from a static file in your classpath String script = "var foobar = 1; for (var i = foobar; i &lt; 5; i++) alert(1);"; // Do the optimizations script = context.optimizeJavaScript(logger, script); // Create an Artifact from the optimized JavaScript string ArtifactSet newArtifacts = new ArtifactSet(artifacts); newArtifacts.add(emitString(logger, script, "example.js")); return newArtifacts; } } Then, to include the Linker in your GWT compilation process, add this to your *.gwt.xml: &lt;define-linker name="scriptoptimizer" class="com.example.ScriptOptimizer" /&gt; &lt;add-linker name="scriptoptimizer" /&gt; The result will be a compiled file called example.js. You can of course generate as many files as you want or, for optimal results, concatenate all your scripts into one and compile that into a single output file.
score: 0
answers question: http://stackoverflow.com/q/24005486

http://stackoverflow.com/a/24078590
downvote count: 1
answers question: http://stackoverflow.com/q/24077524
score: 21
accepted answer of: http://stackoverflow.com/q/24077524
has body: On How to Speed up FXML Performance I'll make this answer community wiki, if anybody else has further ideas, please edit it and add them. One should NOT use the static FXMLLoader.load() but should instead create an instance of FXMLLoader and reuse that one using the instance loader.load() method. The reason is that the FXML-Loader caches, e.g. class lookups, and hence is faster on loading the next FXML-File. Use a tool to compile the FXML to Java, such as Tom Schindl's FXML compiler or the NetBeans FXML to Java converter. Don't load any more FXML than you need to at any given time, e.g. if you aren't going to be displaying it right now, don't load it. Load the FXML in a background thread (doesn't work for some control types, e.g. Tooltip, in Java 8). Load an initial login or splash screen first and then load the rest of the FXML while the splash or login screen is displayed. I load FXML in some apps after the credentials are accepted at the login screen. Reduce the complexity of your application UI by removing unnecessary nodes. Ensure you aren't doing unnecessary work (e.g. reading a database) on the JavaFX UI thread in the initialize methods of your controllers. The FXMLLoader.load() documentation in JavaFX 8 includes a reference to FXML templates, but I don't think that was ever implemented, so maybe it won't help you. I heard mention that referring to static methods from FXML is slow. Use the latest development version of JavaFX. Once you have loaded a node hierarchy from FXML, reuse the hierarchy later rather than throwing it away and loading a new one (e.g. if you have a dialog window with contents constructed using FXML, when the user closes the dialog, just hide it and when you need to show a similar dialog again, just show the hidden dialog rather than constructing a whole new dialog and scene graph). Reflection is why FXML is Slow I think the key reason the Java 8 FXML implementation is slow is that it relies so heavily on reflection and reflection is slow…
has comment: http://stackoverflow.com/comment/37133042
upvote count: 22
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/67537779
has comment: http://stackoverflow.com/comment/69543248
type: Answer
has comment: http://stackoverflow.com/comment/73914104
has comment: http://stackoverflow.com/comment/103802516

http://stackoverflow.com/q/24050231
answer count: 1
tagged with: spring
tagged with: rabbitmq
has body: I have a multi user Spring web application in which I need each logged in user to be able to receive messages on their own rabbitmq vHost so no other user can view another users message. I have this working currently with no vHost but every user can get any message. By my understanding using a vHost is the simplest way to do this (please correct me if I am wrong). Currently it is setup like this. localhost <property name="username" value="guest" /> <property name="password" value="guest" /> <property name="virtualHost" value="/" /> <property name="port" value="5672" /> That actually has two problems as it connects when the application is launched in a browser before anyone even logs in. I am trying to wrap my head around implementing the dynamic connection with vHost solution and only connecting per that user once he logs in. So far the only thing I could find on google was the SimpleRoutingConnectionFactory using the AbstractRoutingConnectionFactory, however I can find no example of how to use them online at all. I would really appreciate any help anyone could provide, thanks.
accepted answer: http://stackoverflow.com/a/24051320
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: Spring RabbitMQ Connection Per User
type: Question
tagged with: spring-amqp
score: 0
has answer: http://stackoverflow.com/a/24051320

http://stackoverflow.com/comment/37059873
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24038033
score: 0
has text: Yes, that was the problem. The filtering Linear was different from MipMapLinear. I switched it and now I have no flickering.

http://stackoverflow.com/comment/36944477
type: Comment
has text: If they are primitives then you need to check whether they are 0. Note though that your model may allow zeros. So every time you deserialize a legal 0 may cause a server lookup for the value.
type: AnswerComment
comment on: http://stackoverflow.com/a/23976664
score: 1

http://stackoverflow.com/a/24991266
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24017673
type: Answer
has body: Since Spring-Batch v3.0.1 you can use @JobScope Marking a @Bean as @JobScope is equivalent to marking it as @Scope(value="job", proxyMode=TARGET_CLASS)
answers question: http://stackoverflow.com/q/24017673
upvote count: 7
score: 7

http://stackoverflow.com/a/24052600
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24052241
has comment: http://stackoverflow.com/comment/37085933
has body: Lets Check your Exception Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 9&lt;-----(1) at java.lang.String.substring(String.java:1907) at &lt;------(2) StringIndexOutOfBoundException Name of The Exception you are getting java.lang.String.substring(String.java:1907) Cause of Exception the problem is that when i try to write in the jTextField more than 8 letters it throws an error called... In your code at desBd = selArt.substring(0, cdes); for cdec &gt;8 say 9 Exception is generated because selArt's length is 8. int cdes = desBD.length(); So cdec you are getting from JTextField's String selArt = (String) jTable1.getValueAt(i, 1); and selArt you are getting from JTable So to Use cdes which is length of String of JTextField which may be &gt;lengthOfString'selArt'
score: 0
accepted answer of: http://stackoverflow.com/q/24052241

http://stackoverflow.com/comment/37047298
comment on: http://stackoverflow.com/q/24032423
has text: You can configure log4j.properties to send the stacktrace into file or write to file using PrrintWriter. What do you want?
score: 0
type: QuestionComment
type: Comment

facebook
tags question: http://stackoverflow.com/q/23951800
tags question: http://stackoverflow.com/q/24087245
tags question: http://stackoverflow.com/q/23979751
type: Tag
tags question: http://stackoverflow.com/q/24086131
tags question: http://stackoverflow.com/q/23960617
tags question: http://stackoverflow.com/q/23998937
tags question: http://stackoverflow.com/q/24102039
tag name: facebook
tags question: http://stackoverflow.com/q/23946482
tags question: http://stackoverflow.com/q/24011849
tags question: http://stackoverflow.com/q/23957521
tags question: http://stackoverflow.com/q/24095786
tags question: http://stackoverflow.com/q/23977013
tags question: http://stackoverflow.com/q/24077436
tags question: http://stackoverflow.com/q/24008870
tags question: http://stackoverflow.com/q/23948237

http://stackoverflow.com/comment/37043506
has text: @Pphoenix You can, just not through the list itself
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24030239

http://stackoverflow.com/comment/37114399
comment on: http://stackoverflow.com/q/24068183
score: 0
type: Comment
type: QuestionComment
has text: Yes, please expand on your issue. Why can you only read one json object from this file? Is there an error?

http://stackoverflow.com/q/23999900
has answer: http://stackoverflow.com/a/24000129
has answer: http://stackoverflow.com/a/24100344
has answer: http://stackoverflow.com/a/24127167
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24000809
has comment: http://stackoverflow.com/comment/36986882
possible better answer: http://stackoverflow.com/a/24000129
score: 1
tagged with: java
tagged with: file
upvote count: 1
has body: I've been trying to create a simple program, in java, that replaces some words into a file. To change the text into the file I created, I create a String and set it to the file text: Path path = Paths.get("somePath/someFile.someExtension"); Charset charset = StandardCharsets.UTF_8; String s = new String(Files.readAllBytes(path), charset); EDIT: To save to the file with s, I used Files.write(path, s.getBytes(charset));. Then I change the String with commands like s.replaceAll("A", "B"). But now, I'm stuck. I want to make a more complicated then just replacing "A" with "B". I'll try to explain has best I can: I need to find at the file if wall someNumber someNumer someNumber is in there, and if there are three arguments (someNumber someNumber someNumber), then get the value of "someNumber" at the center. For example: If the commands are: wall 200 500 100 wall 200 500 100 Then I want to get the argument from the center (in the first case 500 and in the second 500), and store it into a variable, then delete it from the String. After that, on the top of these commands (in the example wall 200 500 100 wall 200 500 100), I want to write: usemtl texture ceil (someNumber that we stored, in the case, 500) Note that if the arguments wall wall don't have any kind of separation (for example #other wall), then the someNumber at the center will be equal (500 and 500 are equal). So, the command below will just appear per group (if wall wall wall... isn't separed with #other wall, for example). Other example, this would be the file before / after: Before: wall 100 300 50 wall 100 300 100 wall 100 300 400 After: usemtl texture ceil 300 wall 100 50 wall 100 100 wall 100 400 So, how can I make this replace? Please answer! I have no idea how! EDIT: question to @Roan, owner of most of this code: Now, after the answers @Roan code transformed into: package com.fileConverter.main; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFound…
type: Question
tagged with: replace
has answer: http://stackoverflow.com/a/24000317
downvote count: 0
tagged with: string
accepted answer: http://stackoverflow.com/a/24000809
has comment: http://stackoverflow.com/comment/36987055
has title: Replacing text from a file in Java
favorite count: 0
answer count: 5

http://stackoverflow.com/a/24099388
score: 1
answers question: http://stackoverflow.com/q/24099357
upvote count: 1
type: Answer
has body: You must not close the database from inside the onCreate callback; the caller still has an active transaction. Just use the db parameter for all database operations.
downvote count: 0

http://stackoverflow.com/q/23946171
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23946196
upvote count: 2
tagged with: colors
tagged with: paintcomponent
favorite count: 0
has comment: http://stackoverflow.com/comment/36886725
has title: Painting JFrame Difficulty
tagged with: swing
linked to: http://stackoverflow.com/q/22283462
has body: In my code I am trying to paint by JFrame but it is not painting correctly. I tell the frame to paint in the beginning where I create it however it is the normal grey color once it is created. I think it may have to do with the fact that I am repainting it, if so how can I make sure it is repainted yellow? Could someone try to figure out why my code is not painting the JFrame Yellow? Thank you! public class EvolutionColor { public static void main(String args[]) { JFrame frame = new JFrame("Bouncing Ball"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BallPanel bp = new BallPanel(); frame.add(bp); frame.setSize(600, 600); // set frame size frame.setVisible(true); // display frame frame.setBackground(Color.YELLOW); } class BallPanel extends JPanel implements ActionListener { private int delay = 10; protected Timer timer; private int x = 0; // x position private int y = 0; // y position private int radius = 15; // ball radius private int dx = 2; // increment amount (x coord) private int dy = 2; // increment amount (y coord) public BallPanel() { timer = new Timer(delay, this); timer.start(); // start the timer } public void actionPerformed(ActionEvent e) { repaint(); } public void paintComponent(Graphics g) { super.paintComponent(g); // call superclass's paintComponent g.setColor(Color.red); // check for boundaries if (x &lt; radius) { dx = Math.abs(dx); } if (x &gt; getWidth() - radius) { dx = -Math.abs(dx); } if (y &lt; radius) { dy = Math.abs(dy); } if (y &gt; getHeight() - radius) { dy = -Math.abs(dy); } // adjust ball position x += dx; y += dy; g.fillOval(x - radius, y - radius, radius * 2, radius * 2); } }
possible better answer: http://stackoverflow.com/a/23946196
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23946201
accepted answer: http://stackoverflow.com/a/23946201
tagged with: java
tagged with: jpanel

http://stackoverflow.com/a/23971816
has comment: http://stackoverflow.com/comment/36935622
has comment: http://stackoverflow.com/comment/36934497
downvote count: 1
score: 15
has body: getFirstDayOfWeek() returns which day is used as the start for the current locale. Some people consider the first day Monday, others Sunday, etc. This looks like you'll have to just set it for DAY_OF_WEEK = MONDAY and DAY_OF_WEEK_IN_MONTH = 1 as that'll give you the first Monday of the month. To do the same for the year, first set the MONTH value to JANUARY then repeat the above. Example: private static Calendar cacheCalendar; public static int getFirstMonday(int year, int month) { cacheCalendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); cacheCalendar.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); cacheCalendar.set(Calendar.MONTH, month); cacheCalendar.set(Calendar.YEAR, year); return cacheCalendar.get(Calendar.DATE); } public static int getFirstMonday(int year) { return getFirstMonday(year, Calendar.JANUARY); } Here's a simple JUnit that tests it: http://pastebin.com/YpFUkjQG
accepted answer of: http://stackoverflow.com/q/23971439
has comment: http://stackoverflow.com/comment/36935589
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23971439
upvote count: 16
has comment: http://stackoverflow.com/comment/36934334
has comment: http://stackoverflow.com/comment/93188079

http://stackoverflow.com/a/38644200
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24058913
has body: Spent hours to find correct configuration. Apparently it is as following: Hibernate property should be in the following format: hibernate.cache.infinispan.&lt;prefix&gt;.&lt;full-class-name&gt;.&lt;property-name&gt; where: &lt;prefix&gt; - by default it is in the name that you see in a sort of JNDI name. In case of Wildfly, it is ear-name.ear/ejb-jar-name.jar#persistence-unit-name However, it can be controlled by hibernate.cache.region_prefix property. Set region_prefix to "" and ignore the prefix. &lt;property-name&gt; - String as it appears in org.hibernate.cache.infinispan.InfinispanRegionFactory class and in official Infinispan documentation. In short, official Infinispan documentation is correct only when you set hibernate.cache.region_prefix to ""
type: Answer
score: 1

http://stackoverflow.com/comment/36884716
score: 0
has text: My guess is that i >= inputLineLengths.length
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23945234

http://stackoverflow.com/comment/104846421
type: AnswerComment
has text: This is where mostly people mistake. forget to mention package name in runner if hooks created in separate package. Nice answer. +1
comment on: http://stackoverflow.com/a/49712180
type: Comment
score: 2

http://stackoverflow.com/a/23957015
has body: The problem is that both the redisTemplate and the jedisConnectionFactory need to have afterPropertiesSet() called. Usually this is called by Spring configuration, but since that wasn't working for me, it has to be called explicitly. Also, theses lines factory.setHostName("localhost") factory.setPort(6379) factory.setUsePool(true) are unnecessary because they are the default values.
upvote count: 11
answers question: http://stackoverflow.com/q/23943191
type: Answer
score: 11
downvote count: 0

http://stackoverflow.com/comment/37066462
score: 0
type: Comment
has text: If you are only calling the replaceAll() method ~10 times, this is a very small efficiency problem which is why you didn't notice much difference.
type: QuestionComment
comment on: http://stackoverflow.com/q/24042516

http://stackoverflow.com/comment/37077154
type: Comment
has text: what can't be extended?
type: AnswerComment
comment on: http://stackoverflow.com/a/24047985
score: 0

http://stackoverflow.com/comment/37038088
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24027276
has text: You can't nest a method inside a constructor.
type: QuestionComment

http://stackoverflow.com/q/24012560
has comment: http://stackoverflow.com/comment/37010788
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24012883
has title: Java JDBC getting old values after deleting and inserting new rows
has body: I have a table with more than 7 million of rows in mysql (InnoDB) and I do some operations with Java. Everything was working correctly until I had to delete some rows and insert some new rows. The problem is that when I do a select, I keep getting the old values instead of the news. For example if I try to do a count(*), I get 2760, instead of 2786. Any idea? Thanks for your time.
score: 0
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37010479
has answer: http://stackoverflow.com/a/24013139
accepted answer: http://stackoverflow.com/a/24013139
has answer: http://stackoverflow.com/a/24012883
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37010438
tagged with: mysql
has comment: http://stackoverflow.com/comment/92005219

http://stackoverflow.com/q/24067825
has comment: http://stackoverflow.com/comment/37115211
tagged with: java
has comment: http://stackoverflow.com/comment/37114854
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37113516
tagged with: inheritance
upvote count: 3
answer count: 3
has body: I found these questions online (university of waterloo exam study questions https://www.student.cs.uwaterloo.ca/~cs125/S08/Resources/Exams/StudyQuestions/W07ExamReview/inheritance_questions.txt) but they were posted without any answers so I'd just like to know if I am correct or not. Suppose the class named SportsCar is a subclass of a class called Automobile. Suppose the class Automobile has instance variables named speed, manufacturer, and numberOfCylinders. Will an object of the class SportsCar have instance variables named speed, manufacture, and numberOfCylinders? Suppose the class named SportsCar is a subclass of a class called Automobile, and suppose the class Automobile has public methods named accelerate and addGas. Will an object of the class SportsCar have methods named accelerate and addGas? If so, do these methods have to perform the exact same actions in the class SportsCar as in the class Automobile? True because a subclass inherits all of the superclass methods and variables class SportsCar would have the method addGas but it wouldn't perform the 'exact' same action as the method in the class Automobile. Thank you in advance!
has comment: http://stackoverflow.com/comment/37115128
has answer: http://stackoverflow.com/a/24068216
has title: Java Inheritance subclass and superclass
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24067978
has comment: http://stackoverflow.com/comment/37115279
has answer: http://stackoverflow.com/a/24067972
has comment: http://stackoverflow.com/comment/37113831
score: 3

http://stackoverflow.com/a/23992429
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37006125
has body: You can put an interceptor in front to set the bean in Session scope. Try implementing org.springframework.web.servlet.HandlerInterceptor to prehandle and posthandle of requests processing scenarios. You can set the tenantID in the prehandle method
has comment: http://stackoverflow.com/comment/37003298
has comment: http://stackoverflow.com/comment/36972108
upvote count: 1
answers question: http://stackoverflow.com/q/23992299
type: Answer

http://stackoverflow.com/comment/37066400
score: 0
type: AnswerComment
has text: Why it is not complaining object and only collections like arrays?
type: Comment
comment on: http://stackoverflow.com/a/24040908

http://stackoverflow.com/comment/36977572
type: QuestionComment
comment on: http://stackoverflow.com/q/23968830
has text: try out :http://stackoverflow.com/questions/8238661/how-to-convert-date-time-from-one-time-zone-to-another-time-zone
score: 0
type: Comment

http://stackoverflow.com/q/24042589
has answer: http://stackoverflow.com/a/49493265
answer count: 2
has body: I have a code like below where I'm doing multiple must in bool query. Here I'm passing the must term queries in field "address". Now the ip address will come to me as a list from other api and I have to pass for all the ip's in the list as a must term query. Here I'm not getting a way how to pass the address values dynamically when creating the QueryBuilder. Please suggest how to do this. public static SearchResponse searchResultWithAggregation(String es_index, String es_type, List&lt;String&gt; ipList, String queryRangeTime) { Client client = ESClientFactory.getInstance(); QueryBuilder qb = QueryBuilders.boolQuery() .must(QueryBuilders.termQuery("address", "10.203.238.138")) .must(QueryBuilders.termQuery("address", "10.203.238.137")) .must(QueryBuilders.termQuery("address", "10.203.238.136")) .mustNot(QueryBuilders.termQuery("address", "10.203.238.140")) .should(QueryBuilders.termQuery("client", "")); queryRangeTime = "now-" + queryRangeTime + "m"; FilterBuilder fb = FilterBuilders.rangeFilter("@timestamp") .from(queryRangeTime).to("now"); SearchResponse response = client .prepareSearch(es_index) .setTypes(es_type) .setQuery(qb) .setPostFilter(fb) .addAggregation( AggregationBuilders.avg("cpu_average").field("value")) .setSize(10).execute().actionGet(); System.out.println(response.toString()); return response; }
upvote count: 11
tagged with: elasticsearch
favorite count: 0
score: 11
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/49493265
downvote count: 0
has answer: http://stackoverflow.com/a/24053031
accepted answer: http://stackoverflow.com/a/24053031
tagged with: java
has title: elasticsearch QueryBuilder with dynamic list value in term query
type: Question

http://stackoverflow.com/q/24080680
type: AnsweredQuestion
tagged with: java
score: -4
tagged with: swing
has body: Can someone tell me how to add 3 buttons under the txtArea in the TextLine class present in this link : https://stackoverflow.com/a/18780743/3649438 I am new to GUI programming and I have problems in adding them. I tried to add JButtons to pane1 or contentPane, but it seems that the code automatically resizes the window and it is not possible to add the buttons. I just need to add simple JButton which I will edit with my own code. My possible solution was the one of making a button (repeating the procedure for each button) in this way: JButton cancelBtn = new JButton("Cancel"); and then add it to the panels in this way. cancelBtn.setVisible(true); contentPane.add(cancelBtn); but when I run it, it doesn't display it. I tried many other different ways with no success.
type: Question
tagged with: jtextarea
linked to: http://stackoverflow.com/q/18768649
accepted answer: http://stackoverflow.com/a/24081481
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/37160469
has comment: http://stackoverflow.com/comment/37142642
has title: Add buttons in a panel under the JtextArea of the provided code
has comment: http://stackoverflow.com/comment/37136406
favorite count: 0
has comment: http://stackoverflow.com/comment/37136484
possible better answer: http://stackoverflow.com/a/24080773
has comment: http://stackoverflow.com/comment/37137254
has answer: http://stackoverflow.com/a/24080773
has comment: http://stackoverflow.com/comment/37149826
has answer: http://stackoverflow.com/a/24081481

http://stackoverflow.com/comment/37183609
type: Comment
has text: *"i want to search data from jtable.."* See [`JTable`: Sorting and Filtering](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting).
score: 0
comment on: http://stackoverflow.com/q/24103513
type: QuestionComment

libgdx
tags question: http://stackoverflow.com/q/24068513
tags question: http://stackoverflow.com/q/24021604
tags question: http://stackoverflow.com/q/24015221
tags question: http://stackoverflow.com/q/24047172
tags question: http://stackoverflow.com/q/23980174
tags question: http://stackoverflow.com/q/24016707
tags question: http://stackoverflow.com/q/24092598
tags question: http://stackoverflow.com/q/24044760
tags question: http://stackoverflow.com/q/23981237
tag name: libgdx
tags question: http://stackoverflow.com/q/24038805
tags question: http://stackoverflow.com/q/24080272
tags question: http://stackoverflow.com/q/23976022
tags question: http://stackoverflow.com/q/24044983
tags question: http://stackoverflow.com/q/24004212
tags question: http://stackoverflow.com/q/24040233
tags question: http://stackoverflow.com/q/24003582
tags question: http://stackoverflow.com/q/24092753
type: Tag
tags question: http://stackoverflow.com/q/24069677
tags question: http://stackoverflow.com/q/24075800
tags question: http://stackoverflow.com/q/24021850
tags question: http://stackoverflow.com/q/24025846
tags question: http://stackoverflow.com/q/24102317
tags question: http://stackoverflow.com/q/24077771
tags question: http://stackoverflow.com/q/24098977
tags question: http://stackoverflow.com/q/23971972
tags question: http://stackoverflow.com/q/23963681
tags question: http://stackoverflow.com/q/24021980
tags question: http://stackoverflow.com/q/24034352
tags question: http://stackoverflow.com/q/23944088
tags question: http://stackoverflow.com/q/23986630
tags question: http://stackoverflow.com/q/23944569
tags question: http://stackoverflow.com/q/23978277
tags question: http://stackoverflow.com/q/24021404
tags question: http://stackoverflow.com/q/24099103
tags question: http://stackoverflow.com/q/24092482
tags question: http://stackoverflow.com/q/23979257
tags question: http://stackoverflow.com/q/24038033
tags question: http://stackoverflow.com/q/24036928

http://stackoverflow.com/comment/36904242
comment on: http://stackoverflow.com/a/23955304
score: 0
type: AnswerComment
type: Comment
has text: can you see if your server is accepting the client socket? before you read /write on the stream

apache-zookeeper
tags question: http://stackoverflow.com/q/24033682
tags question: http://stackoverflow.com/q/23985386
tag name: apache-zookeeper
tags question: http://stackoverflow.com/q/24049296
type: Tag

http://stackoverflow.com/a/23977898
type: Answer
has comment: http://stackoverflow.com/comment/36970947
has body: your can alse passing the value this way $.ajax({ url:"Project", data: {"proj" : "optionSelected"}, ............................. }); after getting value.simply set into textfield. $("#prj_change").change(function(){ var optionSelected = $("option:selected", this).val(); alert ("change event occured with value: " + optionSelected); if(){ $.ajax({ url:"Project?proj=optionSelected", success: function(response){ alert ("change event occured with value: " + optionSelected); $("#date1").val(&lt;s:property value="data1"/&gt;); $("#date2").val(&lt;s:property value="data2"/&gt;); $("#date3").val(&lt;s:property value="data3"/&gt;); } }); }else{ slert("you are selected NONE"); } });
score: 0
has comment: http://stackoverflow.com/comment/36972935
answers question: http://stackoverflow.com/q/23977256

executorservice
type: Tag
tags question: http://stackoverflow.com/q/24002015
tags question: http://stackoverflow.com/q/23999093
tag name: executorservice
tags question: http://stackoverflow.com/q/24005755
tags question: http://stackoverflow.com/q/24081417
tags question: http://stackoverflow.com/q/24005008
tags question: http://stackoverflow.com/q/24082639
tags question: http://stackoverflow.com/q/24006595
tags question: http://stackoverflow.com/q/24022713

http://stackoverflow.com/comment/93080925
has text: Here the `future.cancel(true)` in `TimeoutException` handling part will just set the interrupt flag of future thread to `true` right? It wouldn't guarantee the future actually stops and kills the task in progress.
score: 7
type: AnswerComment
comment on: http://stackoverflow.com/a/24028051
type: Comment

http://stackoverflow.com/a/24063155
score: 0
answers question: http://stackoverflow.com/q/24062991
type: Answer
has body: slim answer is quite simple to implement and deploy: map the window server share as a drive and access it as you would access a normal folder if you do not want/cannot do that for permission or any other reason, look into this library which allow java to operate directly on window shares: jCIFS see this answer for a short sample: access to file using Java with Samba JCIFS

http://stackoverflow.com/comment/37012067
comment on: http://stackoverflow.com/a/24013623
has text: That makes a lot of sense. Thank you very much.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36945829
type: AnswerComment
comment on: http://stackoverflow.com/a/23974631
has text: @T.J.Crowder Thanks for the support and taking the time to respond :)
type: Comment
score: 0

geography
type: Tag
tag name: geography
tags question: http://stackoverflow.com/q/24036050

http://stackoverflow.com/comment/37055953
comment on: http://stackoverflow.com/a/24036932
has text: Thanks a lot Thomas, Currently Application Server is in Solaris box and another server is in UNIX...Will this solution work for the same..?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24046040
answers question: http://stackoverflow.com/q/24044619
has body: I would pull the external data only when its needed. So only when the useful situation or pattern completes. You can do this in listener code or you can add expressions to the select clause or you could use "insert into" to populate another stream. If you populate another stream then you can use EPL to join that output stream to external resources such as relational database. You could use extension APIs to plug in your own expressions.
has comment: http://stackoverflow.com/comment/37076073
score: 0
has comment: http://stackoverflow.com/comment/37104243
has comment: http://stackoverflow.com/comment/37075861
has comment: http://stackoverflow.com/comment/37075493
has comment: http://stackoverflow.com/comment/37073593
type: Answer
has comment: http://stackoverflow.com/comment/37075286

http://stackoverflow.com/comment/41414818
type: Comment
comment on: http://stackoverflow.com/a/26379595
has text: Giving a little more information than just posting a link would be great as this answer doesn't meet the standards of this site. http://stackoverflow.com/help/how-to-answer
type: AnswerComment
score: 0

http://stackoverflow.com/q/23982687
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37264632
has comment: http://stackoverflow.com/comment/37190983
has title: Trying to generate C header using javah
has comment: http://stackoverflow.com/comment/37062616
tagged with: java
has comment: http://stackoverflow.com/comment/36968021
has comment: http://stackoverflow.com/comment/37057266
has comment: http://stackoverflow.com/comment/36955219
linked to: http://stackoverflow.com/q/9940381
has comment: http://stackoverflow.com/comment/37190386
tagged with: javah
tagged with: eclipse
type: Question
tagged with: native
has body: About a year ago I started work on a Java project which required a native C library. I used javah to generate the header file and then wrote the library. This was all done in Windows 7. Now I'm trying to revisit the project and add to the native library, I've modified the java, saved the project and exported creating a new jar file. I wrote a batch file to generate the C header file, however this is the problem, it no longer works and I'm not sure why or how to resolve the error. My batch file, 'mkhdr.bat' contains: "D:\Program Files\Java\jdk1.7.0_25\bin\javah" cantley.co.uk.clsMain The path to javah is correct and the batch file is run from the root of the project which resides in eclipse workspace. But when I try to run this I get: Error: Could not find class file for 'cantley.co.uk.clsMain'. I've tried adapting the javah call including -classpath but nothing works. The project folder contains the following: |-.settings (eclipse settings) |-cantley (top folder of my package) | |-co | |-uk | |-clsMain.java (all the java files as well as class files) |-libsr (my native library build and source files) |-.classpath (eclipse classpath configuration xml) |-.project (eclipse project xml) |-flipmngr (my eclipse project configuration) |-flipmngr.jar (my exported jar) |-mkhdr.bat (batch file to produce native C header file) Thank you,
downvote count: 0
has comment: http://stackoverflow.com/comment/37028696
score: 1
has comment: http://stackoverflow.com/comment/37029001
has comment: http://stackoverflow.com/comment/37189792
favorite count: 0
has comment: http://stackoverflow.com/comment/36967541

http://stackoverflow.com/comment/36893610
comment on: http://stackoverflow.com/a/23950064
has text: Ohhhhh and because DOWN and RIGHT are the last if statements for their respective axes they prevent me from moving UP and LEFT because the else statements will nullify dy and dx unless it is DOWN and RIGHT that are called. Thanks!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24076075
tagged with: java
has comment: http://stackoverflow.com/comment/37128388
has comment: http://stackoverflow.com/comment/37128209
has comment: http://stackoverflow.com/comment/37128274
score: -3
has answer: http://stackoverflow.com/a/24076253
type: Question
has comment: http://stackoverflow.com/comment/37128181
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/24080946
has comment: http://stackoverflow.com/comment/37128981
has answer: http://stackoverflow.com/a/24080946
has comment: http://stackoverflow.com/comment/37128184
favorite count: 0
has comment: http://stackoverflow.com/comment/37128412
has comment: http://stackoverflow.com/comment/37128640
has title: When does "new" create new object and when it copies reference?
accepted answer: http://stackoverflow.com/a/24076253
has comment: http://stackoverflow.com/comment/37128162
downvote count: 3
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/37128206
has comment: http://stackoverflow.com/comment/37128188
has body: I have the following code, there is a class P as follows: class P { char c; P (char c){ this.c = c; } } Then in the program there is: P p = new P('a'); void m1 (P p, char z){ p = new P(z); } m1(p, 'd'); My question is after method m1 is executed, then would my initial object p (to which has 'a'), will change its reference and will point to another p, which have whatever z holds. Or will I have two objects p, one which has 'a' and the other z (whatever z holds). And if I have two object, why would that be? I mean I am really confused… m1(p, 'd'); takes my p, which I initialized at the beginning and it should now make it point to another object?
type: AnsweredQuestion

http://stackoverflow.com/comment/36917638
comment on: http://stackoverflow.com/q/23961437
type: Comment
type: QuestionComment
has text: If you're gonna touch the body of a question like this, @1000000000, then fix *everything* - put a description of the problem at the top, make sure the grammar and capitalization are correct, etc. Don't waste folks' time reviewing half-hearted edits.
score: 0

http://stackoverflow.com/q/23982436
has body: I have root android device. I want to download and install another application through my Application. I have the SUPERUSER Application installed on my device. After downloading complete I am using the following code for Application Installation. Process p = Runtime.getRuntime().exec("su"); InputStream es = p.getErrorStream(); DataOutputStream os = new DataOutputStream( p.getOutputStream()); final String libs = "LD_LIBRARY_PATH=/vendor/lib:/system/lib "; final String[] commands = {libs + "pm install -r " + result,"reboot" }; for (String command : commands) { Log.d(LOG_TAG, " command : " + command); os.writeBytes(command + "\n"); } os.writeBytes("exit\n"); Log.d(LOG_TAG, " DataOutputStream.writebytes "); os.flush(); The above coed is working in Android 4.0. But When i run the same code on Andorid 4.2.2. I run in to sceurity exception. java.lang.SecurityException: Permission Denial: broadcast asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS How can I deal with this exception? Thanking in an Anticipation, Regards, AK
score: -1
has comment: http://stackoverflow.com/comment/36953957
tagged with: android-securityexception
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android
type: UnansweredQuestion
has title: Security exception in Android 4.2.2
has answer: http://stackoverflow.com/a/23982955
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/36927032
comment on: http://stackoverflow.com/q/23967588
type: Comment
type: QuestionComment
has text: `unless the parent you're loading is a parent that you've just created, in the same transaction,` Exactly what it is. I created the parent and the child in the same unit test and then find it back (please have a look at complete test case - just edited). If I remove the saving part and use the old database, then it works. Thank you very much. You can make your comment into answer if you like @JBNizet
score: 0

http://stackoverflow.com/q/24058867
tagged with: http://stackoverflow.com/tag/xml
tagged with: web-services
type: AnsweredQuestion
has title: How to get Soap output data with a java client created with wsdl2java
tagged with: java
tagged with: apache-axis
accepted answer: http://stackoverflow.com/a/24059166
type: Question
has body: I'm creating a simple java client to call a webservice. To create the stub classes I used wsdl2java. Many classes have been created, I execute the webservice correctly passing the input. The problem is that I don't know how to get the webservice result. I have the following classes for my operation: MyOperationResponse (correctly valorized by the webservice) MyOperationResult_type0 (obtained by MyOperationResponse.getMyOperationResult, the abstract class is org.apache.axis2.databinding.ADBBean) Now in MyOperationResult_type0 I don't see any method to get output values! I see a getOMElement method in which I have to pass some parameters QName and OMFactory... Is it the way to go? If it is, why it is so complicate? Is it not possible to work directly with the dom xml of the response? Thank you!
has answer: http://stackoverflow.com/a/24059166
score: 0
answer count: 1
tagged with: soap

http://stackoverflow.com/q/24076877
has comment: http://stackoverflow.com/comment/37133437
favorite count: 0
tagged with: apache-httpclient-4.x
has comment: http://stackoverflow.com/comment/37132909
has answer: http://stackoverflow.com/a/24079236
has comment: http://stackoverflow.com/comment/37132180
has comment: http://stackoverflow.com/comment/37133673
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37131102
accepted answer: http://stackoverflow.com/a/24079236
has title: Java Multithreading HttpClient-4.3.3 problems
has comment: http://stackoverflow.com/comment/37130947
has body: try{ // create new httpPost request with url of his class HttpPost httpPost = new HttpPost( "http://192.168.1.229:8080/flightcache/flightcache" ); // create params and add it to httpPost List&lt;NameValuePair&gt; paramList = new ArrayList&lt;NameValuePair&gt;(); paramList.add( new BasicNameValuePair( "json_req", format ) ); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity( paramList ); httpPost.setEntity( formEntity ); // execute request and save response CloseableHttpResponse response = httpclient.execute( httpPost, context ); HttpEntity entity = response.getEntity(); for( Header header : response.getAllHeaders() ){ System.out.println( header.getName() + ":" + header.getValue() ); } resp = entity.getContent().available() &gt; 0; response.close(); httpclient.close(); // return the response } catch( Exception e ){ e.printStackTrace(); } I'm trying to send multiple HttpPost request concurrently to my Servlet but only one Thread executing the code above is receiving a response. I checked my Servlet but the responses are written correctly. httpClient was created as following. PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build(); Can anyone please help/explain me why only one Thread is receiving a response? Thank in advance public static void main( String[] args ) throws Exception{ FileUtil.init(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal( 200 ); cm.setDefaultMaxPerRoute( 200 ); CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager( cm ).build(); HTTPThread.THREAD_COUNT = 2; HTTPThread.start = new CountDownLatch( HTTPThread.THREAD_COUNT ); Thread[] threads = new Thread[ HTTPThread.THREAD_COUNT ]; for( int i = 0; i &lt; HTTPThread.THREAD_COUNT; i++ ){ threads[ i ] = new Thread( new HTTPThread( httpClient ) ); } for( Thread thread : threads ){ thread.start(); } for( Thread …
tagged with: servlets
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24094467
has body: Since main is static, is it possible to access instanceOfB in order to access the value of _nonStaticInt? "No." Local variables (being in a static method or not) cannot be accessed with the Java Reflection API. Reflection only works at the type level, not the byte-code level2. The stated understanding of the linked question is correct; reflection access of a non-static (instance) field logically requires an instance. That is, the issue then isn't about reflecting on the B type, the issue is about obtaining the B instance (which is assigned to a local variable) to reflect upon. To do this the B instance has to be "bled" somehow - e.g. assigned to a static field or passed as an argument to a method/constructor from main1 - so that it can be used with reflection later as the object who's instance members are to be accessed. The cleanest approach would probably be to pass the B instance down through the appropriate context (or "DI"), perhaps with the aide of IoC .. and maybe changing the type to avoid the use of reflection entirely. 1 Another possible way to "bleed" the B instance is to attach a debugger and inspect/use the local variable within the main methods executing frame - but this sounds like trying to swat a fly with a club. 2 Even tooling like BCEL/ASM wouldn't immediately help during the execution of the main method. Rather it would be used to deconstruct the method, add in the required hooks/code to "bleed" or use the instance created, and then construct a modified method to execute.
has comment: http://stackoverflow.com/comment/37163271
score: 6
accepted answer of: http://stackoverflow.com/q/24094298
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24094298
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37163215
upvote count: 6

http://stackoverflow.com/comment/37171755
comment on: http://stackoverflow.com/q/24099103
score: 0
has text: The image is a simple png sprite with fixed colors, what I want to do is not modifying the source or the color pixel by pixel. I think I need a mask or something like that
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24008426
has body: I'd advise using the Scene Graph and the built-in NumberAxis nodes rather than writing your own cartesian axis renderer using a Canvas. The code below is not meant to be a general purpose function plotter, but instead just provides an illustrative sample of how you might create one. import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.geometry.*; import javafx.scene.Scene; import javafx.scene.chart.NumberAxis; import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.shape.*; import javafx.stage.Stage; import java.util.function.Function; // Java 8 code public class CartesianPlot extends Application { public static void main(String[] args) { launch(args); } @Override public void start(final Stage stage) { Axes axes = new Axes( 400, 300, -8, 8, 1, -6, 6, 1 ); Plot plot = new Plot( x -> .25 * (x + 4) * (x + 1) * (x - 2), -8, 8, 0.1, axes ); StackPane layout = new StackPane( plot ); layout.setPadding(new Insets(20)); layout.setStyle("-fx-background-color: rgb(35, 39, 50);"); stage.setTitle("y = \u00BC(x+4)(x+1)(x-2)"); stage.setScene(new Scene(layout, Color.rgb(35, 39, 50))); stage.show(); } class Axes extends Pane { private NumberAxis xAxis; private NumberAxis yAxis; public Axes( int width, int height, double xLow, double xHi, double xTickUnit, double yLow, double yHi, double yTickUnit ) { setMinSize(Pane.USE_PREF_SIZE, Pane.USE_PREF_SIZE); setPrefSize(width, height); setMaxSize(Pane.USE_PREF_SIZE, Pane.USE_PREF_SIZE); xAxis = new NumberAxis(xLow, xHi, xTickUnit); xAxis.setSide(Side.BOTTOM); xAxis.setMinorTickVisible(false); xAxis.setPrefWidth(width); xAxis.setLayoutY(height / 2); yAxis = new NumberAxis(yLow, yHi, yTickUnit); yAxis.setSide(Side.LEFT); yAxis.setMinorTickVisible(false); yAxis.setPrefHeight(height); yAxis.layoutXProperty().bind( Bindings.subtract( (width / 2) + 1, yAxis.widthProperty() ) ); getChildren().setAll(xAxis, yAxis); } public NumberAxis getXAxis() { return xAxis; } public NumberAxis g…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/107369385
type: Answer
has comment: http://stackoverflow.com/comment/107369121
upvote count: 19
has comment: http://stackoverflow.com/comment/37025347
has comment: http://stackoverflow.com/comment/37025224
score: 19
accepted answer of: http://stackoverflow.com/q/24005247
answers question: http://stackoverflow.com/q/24005247

http://stackoverflow.com/comment/37113853
type: AnswerComment
score: 0
type: Comment
has text: I never used this method. I only know that it used for internal event processin in Swing. So it's not a good idea to call this method manually.
comment on: http://stackoverflow.com/a/24063768

http://stackoverflow.com/comment/37139608
comment on: http://stackoverflow.com/q/24080077
score: 0
has text: now it throws null exception on floatone.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/49178026
score: 3
answers question: http://stackoverflow.com/q/24062443
has body: (int)Math.ceil(3/2.0) will give answer 2 (int)Math.ceil(3/2) will give answer 1 In order to get the float value, you need to cast (or add .0) to one of the arguments
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/23949493
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36893065
has comment: http://stackoverflow.com/comment/36893121
type: Answer
has comment: http://stackoverflow.com/comment/36893045
has comment: http://stackoverflow.com/comment/36892584
accepted answer of: http://stackoverflow.com/q/23949440
has comment: http://stackoverflow.com/comment/36892567
answers question: http://stackoverflow.com/q/23949440
has comment: http://stackoverflow.com/comment/36893395
has comment: http://stackoverflow.com/comment/36893363
has comment: http://stackoverflow.com/comment/36893177
score: 0
has comment: http://stackoverflow.com/comment/36892476
has body: What you need to do is to override the default implementation of the .toString() method in the objects you want to print out: @Override public String toString() { return "Name: " + this.name; } EDIT: I do not know exactly where you are printing, and you naming convention doesn't really help out, but from what I am understanding, you would need to implement it in all of you classes since they all seem to be related to each other. So, in your methodOne class (can also be applied to methodTwo): @Override public String toString() { return "Name: " + this.name + " Age: " + this.age + " Address: + " this.address; } In your methodThree class: private methodTwo methodTwoInMethodThree; private methodOne methodOneInMethodThree; @Override public String toString() { StringBulder sb = new StringBuilder(); if(this.methodTwoInMethodThree != null) { sb.append("Method 2:").append(methodTwoInMethodThree.toString()); } if(methodOneInMethodThree != null) { sb.append("Method 1:").append(methodOneInMethodThree.toString()); } return sb.toString(); }

http://stackoverflow.com/q/24068360
score: 1
tagged with: string
favorite count: 0
has title: Java: Find a certain character and get substring
has comment: http://stackoverflow.com/comment/37114664
upvote count: 1
tagged with: python
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37114865
has body: I have a string 4.9.14_05_29_16_21 and I need to get 4.9 only. The numbers vary so I can't simply get the first three elements of this char array. I have to find the right most . and substring it till there. I'm from Python so I'll show Python approach to this. def foobar(some_string): location = some_string.rfind('.') new_string = some_string[0:location] return new_string How would I do this in Java?
tagged with: java
has answer: http://stackoverflow.com/a/24068409
type: Question
possible better answer: http://stackoverflow.com/a/24068416
has answer: http://stackoverflow.com/a/24068416
has answer: http://stackoverflow.com/a/24068426
answer count: 3
has comment: http://stackoverflow.com/comment/37114653
downvote count: 0
accepted answer: http://stackoverflow.com/a/24068409

http://stackoverflow.com/q/23968882
tagged with: criteria
has body: I have a class called task which is as: public class task { int id; Date dueDate; int treshold; } treshold is how much hour before dueDate user want to get notification in terms of hour. I created a quartz job which starts every hour and should get all task which are as follows now > dueDate-treshold How can I do that?
has answer: http://stackoverflow.com/a/23970411
score: 0
answer count: 1
type: UnansweredQuestion
has title: Hibernate criteria calculation of two columns
tagged with: java
tagged with: hibernate
tagged with: hibernate-criteria
type: Question

http://stackoverflow.com/comment/90487144
score: 1
comment on: http://stackoverflow.com/q/24068688
has text: 1. you should ask one question at a time, not mix them 2. you should accept answer which helped you (and probably upvote it) 3. don't post a solution in original question - better do in in separate answer if you think it's worth it (you can even accept you solution then if it's the best in your opinion)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37141688
type: QuestionComment
has text: Do you really need an ABC with a dynamically typed language like Python? See http://en.wikipedia.org/wiki/Abstract_type#Use_of_abstract_types.
comment on: http://stackoverflow.com/q/24083409
score: 0
type: Comment

http://stackoverflow.com/q/24096924
tagged with: java
linked to: http://stackoverflow.com/q/14836600
tagged with: spring-data
type: Question
has comment: http://stackoverflow.com/comment/37168540
has comment: http://stackoverflow.com/comment/37170210
has comment: http://stackoverflow.com/comment/37171046
has answer: http://stackoverflow.com/a/24122525
answer count: 2
tagged with: spring-data-rest
downvote count: 0
has body: I have to convert the incoming parameter value to Repository interface into desired format, is it possible to do it. My Domain Class, @DynamoDBTable(tableName = "test") public class Test implements Serializable{ @Id private String id; private String name; private String date; @DynamoDBHashKey(attributeName = "id") @DynamoDBAutoGeneratedKey public String getId() { return id; } @DynamoDBAttribute(attributeName = "name") public String getName() { return name; } @DynamoDBAttribute(attributeName = "date") @JsonSerialize(using = StringDateSerializer.class) public String getDate() { return date; } public void setId(String id) { this.id = id; } public void setName(String name) { this.name = name; } @JsonDeserialize(using = StringDateDeserializer.class) public void setDate(String date) { this.date = date; } } And my repository interface, @EnableScan @RestResource(path="test", rel="test") public interface TestRepository extends PagingAndSortingRepository&lt;Test, String&gt;{ @RestResource(path="testsearch", rel="test") public Page&lt;Test&gt; findByNameAndDateLessThan(@Param("name") String name, @Param("date") String date, Pageable pageable); } Here I have to convert the incoming date String to time using getTime() method of Java. Is it possible to achieve this without using controller and am not interested in sending from client side because timezone problem may occur. My Convertors: public class StringDateSerializer extends JsonSerializer&lt;String&gt; { private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); @Override public void serialize(String time, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonProcessingException { Date date = new Date(Long.parseLong(time)); String formattedDate = dateFormat.format(date); gen.writeString(formattedDate); } } public class StringDateDeserializer extends JsonDeserializer&lt;String&gt; { private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); @Override p…
favorite count: 0
has comment: http://stackoverflow.com/comment/37168695
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24105630
has comment: http://stackoverflow.com/comment/37168744
has title: How to format @param String in Spring Data Rest
tagged with: spring
has comment: http://stackoverflow.com/comment/37168313
score: 2

http://stackoverflow.com/q/24081448
has comment: http://stackoverflow.com/comment/37138169
type: Question
score: 3
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/674041
has body: I have following code in my Java application to convert 2 letter ISO639 language code to 3 letter ISO639 language code. Locale locale = new Locale("fr"); String langCode = locale.getISO3Language(); System.out.println(langCode); The above code will print out 'fra' only which is ISO639-2/T language code. java.util.Locale supports only ISO639-2/T language code. Therefore, Locale cannot convert 2 letter language code to 3 letter ISO639-2/B language code. So, in my case, I cannot use java.util.Locale class. Reference of ISO639-2/B and ISO639-2/T language codes: http://loc.gov/standards/iso639-2/php/code_list.php Is there any Java library which can handle both ISO639-2/T and ISO639-2/B language code, so I can get both 'fre' and 'fra' according to above code snippet?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37137831
answer count: 0
upvote count: 3
tagged with: java
has title: Is there way to convert 2 letter browser language code (Accept-Language) to 3 letter ISO639-2/B and ISO639-2/T without using java.util.Locale class?

http://stackoverflow.com/a/23996447
has body: Because it's procedurally generated, you have a very good way to optimize your save files. You can do the minecraft version: save your seed, so you don't have to save your whole map, and then save the tiles that were modified after generation of each chunk of the map. Then when you load, generate the needed chunks based on your seed, and apply the modifications.
type: Answer
answers question: http://stackoverflow.com/q/23994265
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/q/23958548
accepted answer: http://stackoverflow.com/a/23958802
has title: How can I delete a file from an ftp server using a java program that are N weeks old
tagged with: ftps
tagged with: delete-file
answer count: 1
score: 0
tagged with: ftp-client
has answer: http://stackoverflow.com/a/23958802
type: AnsweredQuestion
has body: Our server is Unix server. Using jdk 1.7 and I am looking for a solution to delete files on the ftp server that are N weeks old. Found Apache FTPClient example but this not using date to delete files: FTPClient client = new FTPClient(); client.connect(host, port); client.login(loginname, password); client.deleteFile(fileNameOnServer); client.disconnect(); I need example of how to delete files on ftp server based on date (like all file 3 weeks back).
has comment: http://stackoverflow.com/comment/36909707
tagged with: java
linked to: http://stackoverflow.com/q/3824983
type: Question
tagged with: apache

http://stackoverflow.com/comment/37115144
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24068096
has text: `String[] args` is the standard signature for a `main` static method that can be run from the top level. Likely `main` is just implemented so it can be the main task of an app.

http://stackoverflow.com/comment/37018390
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24017029
has text: could be some kind of unsigned char -> char problem. I don't know how you format your strings.

http://stackoverflow.com/comment/37104809
comment on: http://stackoverflow.com/q/24063270
score: 0
has text: @Sotirios I'm a newbie, forgive-me. What is the new version of spring? I'm using Maven, and my spring dependencie is for 4.0.5 release.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37026863
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis Yup, that's #2 in my attempted solutions list. I just can't be 100% sure that the reference will be saved before it is changed.
comment on: http://stackoverflow.com/q/24021352
score: 0

http://stackoverflow.com/q/24036471
tagged with: java
type: Question
tagged with: jersey
has body: I am using Java jersey Restful service running on Tomcat server... In my service i have a method like this @Produces("text/plain") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile( @FormDataParam("file") InputStream fileInputStream, @HeaderParam("Filename") String Filename) { String uploadedFileLocation = "D://FileUpload/" + Filename; ImageUpload filewrite = new ImageUpload(); } But I am getting the error Missing dependency for method public javax.ws.rs.core.Response Restservice_Java.Hello.uploadFile(java.io.InputStream,java.lang.String) at parameter at index 0 Can anyone help me in this..
score: 0
linked to: http://stackoverflow.com/q/24054200
has answer: http://stackoverflow.com/a/24074251
answer count: 1
tagged with: tomcat
tagged with: rest
tagged with: web-services
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24074251
has title: Java jersey rest Service

http://stackoverflow.com/q/23958956
possible better answer: http://stackoverflow.com/a/23959121
has answer: http://stackoverflow.com/a/23959127
type: Question
tagged with: algorithm
has title: problems with reading input and storing it in an array
has comment: http://stackoverflow.com/comment/36910175
tagged with: arrays
has answer: http://stackoverflow.com/a/23959121
score: 0
has answer: http://stackoverflow.com/a/23959191
has answer: http://stackoverflow.com/a/23959075
accepted answer: http://stackoverflow.com/a/23959075
has answer: http://stackoverflow.com/a/23959183
answer count: 5
has comment: http://stackoverflow.com/comment/36910061
has body: Hi I have an algorithm which should read user input save it in an array and count letters used A used 3 b used 3 ..... but my algorithm does not work with 1 , 3 , any odd number and work with 2, 4, even numbers.. Any ideas how to fix this error Thanks guys for help code: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int i = 0; char c; int counta = 0; int countb = 0; int countc = 0; int countd = 0; char [] array = new char [4]; array[0]='a'; array[1]='b'; array[2]='c'; array[3]='d'; while (reader.read()!='\n') { int x = 1+i; char[] cbuf = new char[x]; c = (char) reader.read(); cbuf[i] = c; if (cbuf[i]==array[0]){ counta++; } if (cbuf[i]==array[1]){ countb++; } if (cbuf[i]==array[2]){ countc++; } if (cbuf[i]==array[3]){ countd++; } System.out.println(cbuf); i++; }
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/57381331
answers question: http://stackoverflow.com/q/24096331
has body: Those of you who are using MacOS ( in my case ), Go to JavaFx from preferences then browse to application folder and select scene builder. Doing other ways wont open the exact file you are trying to edit (It may make a new file which will be untitled and you have to save it manually on the project directory). Also right clicking the fxml file, you wont be able to use the option (open with scenebuilder).
score: 0
type: Answer

http://stackoverflow.com/a/24007378
has comment: http://stackoverflow.com/comment/37001052
has body: In SWT you can not reuse buttons however you can reuse images. Write a singleton class say ImageCache and cache all the images in it and fetch images from this class wherever required. I faced the same problem and solved it this way. Also create your custom dispose methods in your UI components and dispose UI components yourself because SWT does not disposes them properly and resources leak in most cases. SWT best practice says that "all resources must be cached" so your fonts, colors, images must be cached and used properly in respective ItemRenderers.
type: Answer
answers question: http://stackoverflow.com/q/24007294
has comment: http://stackoverflow.com/comment/37002848
has comment: http://stackoverflow.com/comment/37003399
has comment: http://stackoverflow.com/comment/37000635
upvote count: 1
has comment: http://stackoverflow.com/comment/37003383
score: 1
has comment: http://stackoverflow.com/comment/37001950
downvote count: 0

http://stackoverflow.com/comment/37077663
has text: Would it work if I were to import the Compiler API into the lib folder? (I have a dedicated folder for libraries).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24047507

http://stackoverflow.com/comment/36918082
comment on: http://stackoverflow.com/q/23962433
type: QuestionComment
has text: @user3692652 We don't want to see what you could do, but what you have done!
type: Comment
score: 0

http://stackoverflow.com/comment/36940254
type: Comment
score: 0
has text: How does it "not work"? Is it giving incorrect amount of words? One immediate problem I see is that if you have two consecutive spaces, it won't recognise that.
type: QuestionComment
comment on: http://stackoverflow.com/q/23975374

http://stackoverflow.com/comment/36933686
score: 0
type: Comment
has text: I looked into that before. It leaves me a bit confused because according to some tutorials, this java code is supposed to be in MainActivity.java, not in fragment.xml. When I place the pothole.setOnClickListener code (the block under "Link UI elements to action in code") in fragment.xml, I get a warning saying "Unexpected text found in layout file". Is that what you meant to say?
type: QuestionComment
comment on: http://stackoverflow.com/q/23971163

http://stackoverflow.com/a/24050196
score: 1
accepted answer of: http://stackoverflow.com/q/24049997
upvote count: 1
answers question: http://stackoverflow.com/q/24049997
has body: Say you have a class of kind User List&lt;User&gt; users = null; mgr = getPersistenceManager(); Query query = mgr.newQuery(User.class); // Will query all from User class. Replace User with your class users = (List&lt;User&gt;) query.execute(); users will then contain a list of all type User objects. You can then do what you want with it.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37103061
type: Comment
type: QuestionComment
has text: Please provide a full stacktrace so we can help you
comment on: http://stackoverflow.com/q/24061656
score: 0

http://stackoverflow.com/a/24003596
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37072928
has comment: http://stackoverflow.com/comment/36994856
type: Answer
has comment: http://stackoverflow.com/comment/36997401
has comment: http://stackoverflow.com/comment/36994259
has body: The reason for that behavior is that you are starting multiple threads. FillLocations preExecute --&gt; SHOW ProgressBar BitmapWorkerTask_1 --&gt; new thread BitmapWorkerTask_2 --&gt; new thread ... BitmapWorkerTask_N --&gt; new thread FillLocations postExecute --&gt; HIDE ProgressBar BitmapWorkerTask_K --&gt; continue execution BitmapWorkerTask_K+1 --&gt; continue execution etc. If you want the list to be displayed until it's all loaded, Simply make BitmapWorker's processing synchronous. If you still want to display the list right away but keep the spinner until it's all finished, then keep a counter in your activity and increase it in preexecute and decrease it in postExecute of BitmapWorker via a setter. Once the counter hits 0, remove hide the progressBar. In activity: private int asynchCounter = 0; private void updateCounter(int delta){ asynchCounter+=delta; if(asynchCounter&lt;=0){ progress.setVisibility(View.GONE); }else{ progress.setVisibility(View.VISIBLE); } } And instead of BitmapWorkerTask use class CountedBitmapWorkerTask extends BitmapWorkerTask { protected void onPreExecute() { super.onPreExecute(); updateCounter(1); } protected void onPostExecute(String msg) { super.onPostExecute(); updateCounter(-1); } }
has comment: http://stackoverflow.com/comment/36994088
accepted answer of: http://stackoverflow.com/q/24002066
score: 0
has comment: http://stackoverflow.com/comment/37000687
has comment: http://stackoverflow.com/comment/36994003
answers question: http://stackoverflow.com/q/24002066

http://stackoverflow.com/q/24086840
has answer: http://stackoverflow.com/a/24088348
type: Question
tagged with: c#
tagged with: ikvm
tagged with: mono
upvote count: 2
answer count: 1
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has body: I want to make simple example of java calling .net assembly created with mono on linux. I have this very simple C# class called MyClass in ClassLibrary project called MonoLib using System; namespace MonoLib { public class MyClass { public static void TestDotNet() { Console.WriteLine ("Hi I am from .Net"); } } } In order to use the class functionality I entered command ikvmstub Desktop/Mono/MonoLib/MonoLib/bin/Debug/MonoLib.dll as it is explained on http://mono-project.com/Java which created MonoLib.jar Then I want to test MonoLib.jar in pure java class called Demo.js import cli.MonoLib.*; public class Demo { public static void main(String[] args) { MyClass.TestDotNet(); } } When I try to compile it with command: javac -classpath MonoLib.jar Demo.java I get this error: Demo.java:4: cannot access cli.System.Object class file for cli.System.Object not found MyClass.TestDotNet(); ^ Please tell me what am I doing wrong ans is this correct approach. EDIT1: From answer below I concluded that problem is that my java application does not see mscorlib functionality thus it says "cli.System.Object not found" That is why I need to extend this command javac -classpath MonoLib.jar Demo.java to add mscorlin.jar to classpath. Can I add multiple jars with one command? Because I need mscorlib.jar added as well. I have tried to add them in one folder called MonoTest and run this command javac -classpath /home/user/MonoTest/* Demo.java The result was javac: invalid flag: /home/user/MonoTest/mscorlib.jar Usage: javac use -help for a list of possible options EDIT2 Idealy I would like to have like bridge class that facades all .net functionality for java like: import cli.MonoLib.*; public class Demo { public static void DotNetViaJava { MyClass.TestDotNet(); } } public class DemoTest { public static void main(String[] args){ Demo.DotNetViaJava(); } } I need java class in this example Demo.java that once compiled with IKVM can be used with in any java app with out IKVM. EDIT3 I have found o…
has title: Java application in Linux that call .NET Mono with IKVM
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/a/39587021
has body: I also have the same issue. In my case i did following: 1. open .classpath file and copy its all content. 2. Delete .classpath file. 3. copy .classpath file from any of your other project and paste in current project. 4. open .classpath file and paste the content you copied from previous file. now you can do changes in build path without any error
downvote count: 0
answers question: http://stackoverflow.com/q/24045046
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/23956809
type: UnansweredQuestion
has body: I have problem with display jTextArea1. When file has loaded, the textArea is resize and looks like this: TextArea is added into jScrollPane. Code of load file: public class program extends javax.swing.JFrame { private String textEncode; ... private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fch = new JFileChooser(); int choose = fch.showOpenDialog(this); if(choose == JFileChooser.APPROVE_OPTION) { String help = fch.getSelectedFile().getPath(); jTextField2.setText(help); try { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(help), "UTF-8")); String line; String readed = ""; while((line = in.readLine()) != null) { readed = readed + line + "\n"; } jTextArea1.setText(readed); } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(this, "Nie znaleziono pliku", "Błąd wczytywania", JOptionPane.ERROR_MESSAGE); } catch (UnsupportedEncodingException ex) { Logger.getLogger(aes.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(aes.class.getName()).log(Level.SEVERE, null, ex); } } } jTextArea1 code was generated by NetBeans: jTextArea1 = new javax.swing.JTextArea(); jTextArea1.setColumns(20); jTextArea1.setRows(5); jTextArea1.setMaximumSize(new java.awt.Dimension(104, 64)); jScrollPane1.setViewportView(jTextArea1);
tagged with: swing
tagged with: jtextarea
has answer: http://stackoverflow.com/a/33814582
tagged with: java
type: Question
score: 0
tagged with: settext
answer count: 1
has title: jtextarea resize after setText()
tagged with: autoresize
has comment: http://stackoverflow.com/comment/36905843

http://stackoverflow.com/comment/37085613
type: Comment
comment on: http://stackoverflow.com/a/24052960
score: 0
type: AnswerComment
has text: Aha, so the one queue for one instance of the class (access to the methods is mutually exclusive). That's the answer I've needed, thank you!

http://stackoverflow.com/a/24032845
has body: Use CellStyle.BORDER_HAIR for 0.05 pt borders: cellStyle.setBorderBottom(CellStyle.BORDER_HAIR);
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24031881
accepted answer of: http://stackoverflow.com/q/24031881

http://stackoverflow.com/a/24099025
has body: Often specification authors find it convenient to formulate rules of the spec in terms of non-terminals; sometimes, however, some of the useful non-terminals are not, for technical reasons, used in the main grammar. In such cases the spec sometimes defines the relevant non-terminals anyway, to ground some of the rules of the spec in the grammatical formalism. Here, for example, the rule for Type sends a pretty clear signal that all types are either primitive types or reference types. But the grammar has a number of places where only primitive types may be referenced, and others where reference types are required. If Type is not reachable, it need not mean that the syntactic grammar is incomplete; it may only mean that in fact there are no places in the syntactic grammar where the authors found it useful to refer to Type. The non-terminal Type may nonetheless be defined, if the spec authors find it a useful tool of exposition. In specs which appear in multiple versions, another reason sometimes arises: a non-terminal ceases to be used in the main grammar, but an appropriate definition for it is given to avoid breaking any other specs which refer to that non-terminal, and to allow those other specs to upgrade gracefully to the new version of the spec containing the grammar. I do not know which of these reasons applies in the case of these non-terminals in Java 8, or whether there is perhaps some other reason.
score: 6
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24098873
upvote count: 6

http://stackoverflow.com/comment/36992639
score: 0
type: AnswerComment
type: Comment
has text: you mean the convers, b) is the height and a) is the number of trial, or did I get it wrong?
comment on: http://stackoverflow.com/a/24002805

http://stackoverflow.com/comment/37024529
type: QuestionComment
has text: If I have mon tue wed thu work then fri sat off then sun mon tue wed work then thu fri off
score: 0
comment on: http://stackoverflow.com/q/24020079
type: Comment

http://stackoverflow.com/comment/37175714
type: QuestionComment
has text: The `data.length` is really `w * h * 4`, so you can convert the data as in my first example below to have `byte[] argb` samples.
score: 0
comment on: http://stackoverflow.com/q/24095924
type: Comment

http://stackoverflow.com/q/24012781
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/37011478
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24012975
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37010696
has body: In a simple Java program, I have two Threads running, addSome and subtractSome. These two Threads are both working on the same box object. So essentially, they are both adding and subtracting items from this box, concurrently. For the purpose of understanding threads and such, I am trying to output the content of the boxes and the Thread that is currently working. System.out.println(Thread.currentThread().getName()); System.out.println("Items: " + contents); The problem is, I realized, because of the structure of the if statements in the Box class (you can only take items when there are items in the box etc) that the first output statement is printing and then switching to the other Thread where new contents are being added and then coming back to the first Thread where the old contents are being printed out. Basically, I want to make sure that both those statements are executed at the same time by the same thread and nothing should happen in between.
has answer: http://stackoverflow.com/a/24013271
has comment: http://stackoverflow.com/comment/37010605
tagged with: java
has title: How to guarantee two statements will execute sequentially without being interrupted by another thread

http://stackoverflow.com/a/24054122
has comment: http://stackoverflow.com/comment/37090240
has body: You can't share data across intents by simply using the same field unfortunately. One way of dealing with this situation is to use a global singleton class to hold your values. The other is to pass data around in bundles, as per below. In the activity of spinner A create an intent: /* Instead of FromActivity.this you can also use getApplicationContext() */ Intent intent = new Intent(FromActivity.this, ToActivity.class); intent.putExtra("label", label); startActivity(intent); Then in the other spinner's activity you can retrieve them: Bundle extras = getIntent().getExtras(); if (extras !=null) { String value = extras.getString("label"); } System.out.println("NewTask label = " + label); Note that passing values via this method has some data size limitations, but in your particular case should work. I don't claim that the exact same code would work in your application, but the concept itself should. Further reading Hope it helps.
has comment: http://stackoverflow.com/comment/37087753
score: 0
has comment: http://stackoverflow.com/comment/37087881
answers question: http://stackoverflow.com/q/24053957
type: Answer

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/24017498

http://stackoverflow.com/comment/36977684
score: 0
has text: Not error. It won't let me enter input.
comment on: http://stackoverflow.com/q/23995087
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36894012
comment on: http://stackoverflow.com/q/23950034
type: QuestionComment
has text: @npinti Its working now without any change. Not sure why it was throwing null pointer.
score: 0
type: Comment

http://stackoverflow.com/comment/37233953
type: AnswerComment
comment on: http://stackoverflow.com/a/24129552
score: 0
type: Comment
has text: ra, thanks for all of the information and points about scalability. I have two follow up questions: `Jobs are not submitted if there are not enough threads available`, by "are not submitted" you mean that `jobOperator.start` fails with an exception or that it gets queued somehow until there is a thread available? And the second question is about Application Client (and by that I don't mean Applet, I mean just a application client with a main method to listen for file events and fire the batch process somehow - either directly or with a JMS queue as suggested by Will).

http://stackoverflow.com/comment/37148189
comment on: http://stackoverflow.com/a/24086465
type: Comment
has text: Oh, somehow I missed the fact that there is the `methods` attribute and spent ages trying to get the methods to run using custom Filters and Runners. Everything works like a charm now, thanks.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23958079
score: 2
accepted answer of: http://stackoverflow.com/q/23956876
upvote count: 2
answers question: http://stackoverflow.com/q/23956876
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can create a custom View that draws the color in the padding area. Here I am extending View, but you can extend something else if you desire. package sample.package.name; public class ColoredPaddingView extends View { Rect rect = new Rect(); // Constructors omitted. Override them all and call the super constructor @Override public void onDraw(Canvas canvas) { int l = getPaddingLeft(); int t = getPaddingTop(); int r = getWidth() - getPaddingRight(); int b = getHeight() - getPaddingBottom(); rect.set(l, t, r, b); canvas.save(); canvas.clipRect(rect, Region.Op.DIFFERENCE); canvas.drawColor(Color.RED); // or some other color canvas.restore; super.onDraw(canvas); } } In your layout XML, you would use the fully qualified class name of the view (including the package) like so: &lt;sample.package.name.ColoredPaddingView android:layout_width="..." android:layout_height="..." ... /&gt;
has comment: http://stackoverflow.com/comment/36909590
has comment: http://stackoverflow.com/comment/36914664

http://stackoverflow.com/comment/37108002
has text: <zipfileset should be used as explained [here](http://stackoverflow.com/questions/518207/how-do-i-copy-files-into-an-existing-jar-with-ant)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24064694
type: Comment

http://stackoverflow.com/comment/46706410
comment on: http://stackoverflow.com/q/23990008
type: Comment
type: QuestionComment
has text: You're just setting flags. deleted=1, deleted=0. It's not actually deleting. I don't understand what are you trying to accomplish by doing this.
score: 0

http://stackoverflow.com/a/24047253
accepted answer of: http://stackoverflow.com/q/24037822
type: Answer
answers question: http://stackoverflow.com/q/24037822
has comment: http://stackoverflow.com/comment/37075850
has comment: http://stackoverflow.com/comment/37085222
has comment: http://stackoverflow.com/comment/37081156
type: AcceptedAnswer
has body: Let the MuleClient create the endpoint for you and configure the connector on it, like: muleClient.send("as2://...?connector=TestAS2Connector", ...);
has comment: http://stackoverflow.com/comment/37077142
score: 0

http://stackoverflow.com/a/23949274
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23949132
downvote count: 0
has body: http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.2: In addition, if the expression is a constant expression (§15.28) of type byte, short, char, or int: A narrowing primitive conversion may be used if the type of the variable is byte, short, or char, and the value of the constant expression is representable in the type of the variable. You have a constant expression of type long and the narrowing primitive conversion can't be applied in that case. So you can do: byte b = 10 byte b = (int) 10 char b = (short) 10 byte b = (char) 10L short b = (int) 10L But you can't do: byte b = 10L byte b = (long) 10
type: Answer

http://stackoverflow.com/comment/119155773
type: AnswerComment
comment on: http://stackoverflow.com/a/23959045
type: Comment
has text: Passing a file is much more complicated, if not impossible in certain cases, when dealing with an automation of java application execution.
score: 1

http://stackoverflow.com/comment/37045502
has text: `Frame frame = (Frame) this.getParent().getParent();` That is very fragile. There are a number of more robust ways to get access to the root frame. Why does this applet *need* access to the root frame?
type: Comment
comment on: http://stackoverflow.com/q/24027411
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37100958
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24060970
type: Comment
has text: hi thanks someone told me to var url = Ti.Network.encodeURIComponent(context.userInfo.link); but now I'm getting the error [WARN] : Uri: Error parsing port string. [WARN] : Uri: java.lang.NumberFormatException: Invalid int: //xxxx.com but its not showing the http:

http://stackoverflow.com/a/24075422
score: 2
accepted answer of: http://stackoverflow.com/q/24075267
downvote count: 0
answers question: http://stackoverflow.com/q/24075267
has body: Just put setVisible(true) at the end of constructor. Completely agree with MadProgrammer that better to use specific layout rather than setting bounds for all the elements. Assuming You are getting proper data from Oracle Database.
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23979134
has answer: http://stackoverflow.com/a/23979198
has comment: http://stackoverflow.com/comment/36947412
has body: I am trying to call dialog from another class like this public void alertbox() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Blah").setCancelable(false); setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } I am calling this method from my class but my Application crashes, can someone tell me why?
type: Question
downvote count: 5
has title: Calling a Dialog From A Non Activity Class?
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23979165
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: -5
tagged with: java

http://stackoverflow.com/comment/37015256
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24015213
has text: Read the [doc](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(java.lang.CharSequence,%20java.lang.CharSequence)). `data.replace("'", "")` would return the new `String` (not change the current), which is stated in doc: "Returns: The resulting string"

jface
tags question: http://stackoverflow.com/q/24074365
tags question: http://stackoverflow.com/q/24067475
tag name: jface
tags question: http://stackoverflow.com/q/24015984
tags question: http://stackoverflow.com/q/23981460
type: Tag
tags question: http://stackoverflow.com/q/24041022
tags question: http://stackoverflow.com/q/24030498

http://stackoverflow.com/a/24088419
has body: A good question. I was actually surprised by the result myself. If an InterruptedException occurs the condition will stop awaiting and will then execute the finally. It will obvious not own the lock and propagate an IllegalMonitorStateException.
type: Answer
answers question: http://stackoverflow.com/q/24087573
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/24013318
favorite count: 0
has answer: http://stackoverflow.com/a/24013358
has answer: http://stackoverflow.com/a/24013351
answer count: 3
has comment: http://stackoverflow.com/comment/37012190
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/37011736
score: -4
has body: I made this code in eclipse= Strart CLASS(i made a mistace) import javax.swing.JFrame; public class strart { public static void main(String args[]) { Window object = new Window(); object.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); object.setSize(300,250); object.setVisible(true); } } Window CLASS import javax.swing.JFrame; import javax.swing.JButton; import java.awt.TextField; import java.awt.FlowLayout; import java.awt.TextField; import java.awt.Event.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Window extends JFrame { TextField kimeno = new TextField(25); TextField dkimeno = new TextField(25); TextField n1 = kimeno; TextField n2 = dkimeno; private JButton plus; public Window() { super("Math engine"); setLayout(new FlowLayout()); plus = new JButton("+"); plus.setFocusable(false); plus.addActionListener(new EnableButton()); add(plus); add(kimeno); add(dkimeno); } public class EnableButton implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println(n1+n2); } } } But i am still getting an error in line 32 of the Window class the error is "The operator + is undefined for the argument type(s) java.awt.TextField, java.awt.TextField"
type: Question
type: AnsweredQuestion
tagged with: java
has title: Why the "+" operator is undefined? JAVA
has comment: http://stackoverflow.com/comment/37011541
has comment: http://stackoverflow.com/comment/37011673
accepted answer: http://stackoverflow.com/a/24013358
has answer: http://stackoverflow.com/a/24013416
has comment: http://stackoverflow.com/comment/37011708
possible better answer: http://stackoverflow.com/a/24013351

http://stackoverflow.com/comment/37215292
has text: I have tried that, not working, but i got the workaround as @Ambrish posted
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24030550

http://stackoverflow.com/comment/36934539
comment on: http://stackoverflow.com/q/23971938
score: 0
has text: You seem to be creating 300k 64x64 int matrices. Is that right?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24028068
possible better answer: http://stackoverflow.com/a/24028134
has answer: http://stackoverflow.com/a/24028134
has comment: http://stackoverflow.com/comment/37039596
has comment: http://stackoverflow.com/comment/37039627
score: 0
has answer: http://stackoverflow.com/a/24028131
has comment: http://stackoverflow.com/comment/37039626
has title: Java is this Garbage Collected
tagged with: garbage-collection
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24028131
tagged with: java
has comment: http://stackoverflow.com/comment/37039602
has body: Lets says I have the code in the entity class: this.setCurrentState(new NormalState(this)); if in the normal state class I switch the state of the entity to: entity.setCurrentState(new HungryState(entity)); will the NormalState object be garbage collected event though it holds a reference to the entity that is still active or will it not cause memory leaks?
type: Question
answer count: 2

http://stackoverflow.com/q/23996454
upvote count: 40
has title: terminate or break java 8 stream loop
duplicate of: http://stackoverflow.com/q/20746429
linked to: http://stackoverflow.com/q/23308193
answer count: 2
has answer: http://stackoverflow.com/a/23997320
accepted answer: http://stackoverflow.com/a/23997320
downvote count: 0
has answer: http://stackoverflow.com/a/23997381
favorite count: 0
linked to: http://stackoverflow.com/q/20746429
has body: I have a java 8 stream loop with the following content: void matchSellOrder(Market market, Order sellOrder) { System.out.println("selling " + market.pair() + " : " + sellOrder); market.buyOrders() .stream() .filter(buyOrder -&gt; buyOrder.price &gt;= sellOrder.price) .sorted(BY_ASCENDING_PRICE) .forEach((buyOrder) -&gt; { double tradeVolume = Math.min(buyOrder.quantity, sellOrder.quantity); double price = buyOrder.price; buyOrder.quantity -= tradeVolume; sellOrder.quantity -= tradeVolume; Trade trade = new Trade.Builder(market, price, tradeVolume, Trade.Type.SELL).build(); CommonUtil.convertToJSON(trade); if (sellOrder.quantity == 0) { System.out.println("order fulfilled"); // break loop there } }); } How can I break out of loop when some condition is met? Whats the right way to close stream anyway? UPDATE I was misusing streams tecnique assuming that it is a loop, it is not designed for that. Here's the code I've ended up using answer provided below: List&lt;Order&gt; applicableSortedBuyOrders = market.buyOrders() .stream() .filter(buyOrder -&gt; buyOrder.price &gt;= sellOrder.price) .sorted(BY_ASCENDING_PRICE) .collect(toList()); for(Order buyOrder : applicableSortedBuyOrders){ double tradeVolume = Math.min(buyOrder.quantity, sellOrder.quantity); double price = buyOrder.price; buyOrder.quantity -= tradeVolume; sellOrder.quantity -= tradeVolume; Trade trade = new Trade.Builder(market, price, tradeVolume, Trade.Type.SELL).build(); CommonUtil.printAsJSON(trade); if (sellOrder.quantity == 0) { System.out.println("order fulfilled"); break; } }
has comment: http://stackoverflow.com/comment/50615069
has comment: http://stackoverflow.com/comment/78951540
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
has comment: http://stackoverflow.com/comment/79645393
tagged with: loops
score: 40
possible better answer: http://stackoverflow.com/a/23997381
type: Question

http://stackoverflow.com/a/24005500
has comment: http://stackoverflow.com/comment/36998344
has comment: http://stackoverflow.com/comment/36997852
has comment: http://stackoverflow.com/comment/36997971
has comment: http://stackoverflow.com/comment/36997692
has comment: http://stackoverflow.com/comment/36997358
has body: First of all, change directories to the location of your source file.. Use the Java Compiler to compile the source file to a .class file javac ReadFile.java Now use Java to run the resulting .class file... java ReadFile (Note, I didn't have a file to read, but that wasn't my goal) **** WARNING **** This will only work if the ReadFile.java file does not start with a package declaration. If it does, it will change the way that the class has to be run!!
accepted answer of: http://stackoverflow.com/q/24005405
has comment: http://stackoverflow.com/comment/36997873
has comment: http://stackoverflow.com/comment/36997529
has comment: http://stackoverflow.com/comment/36998293
has comment: http://stackoverflow.com/comment/36997591
score: 0
has comment: http://stackoverflow.com/comment/36998061
has comment: http://stackoverflow.com/comment/36997701
has comment: http://stackoverflow.com/comment/36997900
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24005405
has comment: http://stackoverflow.com/comment/36997670
has comment: http://stackoverflow.com/comment/36997736
has comment: http://stackoverflow.com/comment/36997987
type: Answer
has comment: http://stackoverflow.com/comment/36997511

http://stackoverflow.com/q/24047642
answer count: 1
has title: How can I create or assign a method to temp (WindowAdapter)?
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24047803
has body: I want to create an instance of the WindowAdapter and put my method for windowClosing in it and then sent the temp into the f.addWindowListener(temp) can this be done. Java will not let me create an instance of WindowAdapter like below. WindowAdapter temp = new WindowAdapter(); &lt;-- Does not compile How could this be done? Code: public static void main(String args[]) { setLookFeel(); JFrame f = new JFrame("Hello World Printer..."); WindowAdapter temp; f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); } This works but how could i use the Test() method. HelloWorldPrinter t = new HelloWorldPrinter() { public void test() { System.out.println("Test"); } }; t.test(); &lt;-- gives a compile error
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24047803

http://stackoverflow.com/comment/37125339
type: QuestionComment
comment on: http://stackoverflow.com/q/24074312
has text: Do `Arrays.toString(raw)` and show us that.
score: 0
type: Comment

http://stackoverflow.com/a/23959045
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/79778522
has body: Here is a better solution: Stop passing json as a command line argument. Put the json in a file. Pass the name of the json file as a command line argument. Read the json file in your application.
accepted answer of: http://stackoverflow.com/q/23958338
answers question: http://stackoverflow.com/q/23958338
score: 10
upvote count: 12
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/119155773

jtable
tags question: http://stackoverflow.com/q/24011698
tags question: http://stackoverflow.com/q/24083481
tags question: http://stackoverflow.com/q/24103513
tags question: http://stackoverflow.com/q/24006030
tags question: http://stackoverflow.com/q/24061770
tags question: http://stackoverflow.com/q/23953396
tags question: http://stackoverflow.com/q/24104880
tags question: http://stackoverflow.com/q/24037453
type: Tag
tags question: http://stackoverflow.com/q/23955589
tags question: http://stackoverflow.com/q/24009948
tags question: http://stackoverflow.com/q/24033695
tags question: http://stackoverflow.com/q/23952419
tags question: http://stackoverflow.com/q/23974250
tags question: http://stackoverflow.com/q/24066168
tags question: http://stackoverflow.com/q/24000615
tags question: http://stackoverflow.com/q/24081941
tag name: jtable
tags question: http://stackoverflow.com/q/24053252
tags question: http://stackoverflow.com/q/23992474
tags question: http://stackoverflow.com/q/23990131
tags question: http://stackoverflow.com/q/24084922
tags question: http://stackoverflow.com/q/24035898
tags question: http://stackoverflow.com/q/23964120
tags question: http://stackoverflow.com/q/23981472
tags question: http://stackoverflow.com/q/23948257
tags question: http://stackoverflow.com/q/23978767
tags question: http://stackoverflow.com/q/24102895
tags question: http://stackoverflow.com/q/23969578
tags question: http://stackoverflow.com/q/23945921
tags question: http://stackoverflow.com/q/24013404
tags question: http://stackoverflow.com/q/23958105
tags question: http://stackoverflow.com/q/24025560
tags question: http://stackoverflow.com/q/24088150
tags question: http://stackoverflow.com/q/24025207

http://stackoverflow.com/comment/36996327
comment on: http://stackoverflow.com/a/23991306
score: 0
type: Comment
has text: I am not creating any Widgetset. I am using this project. In netbeans I am only building my project and deploying in liferay jboss server. Please check the below link. [https://www.dropbox.com/s/4qqjp81vgrjlaoh/myproject.zip](https://www.dropbox.com/s/4qqjp81vgrjlaoh/myproject.zip) @jupenur
type: AnswerComment

http://stackoverflow.com/a/24026989
type: Answer
answers question: http://stackoverflow.com/q/24026633
has body: Check out the KeyBoardAnimation example from Motion Using the Keyboard. It keeps a Map of the keys that are currently pressed and then move the object based on all the keys in the Map. This approach uses Key Bindings, which is preferred over a KeyListener for the reasons given in the blog.
score: 0

http://stackoverflow.com/a/24029439
has comment: http://stackoverflow.com/comment/46222664
has body: Yes Tomcat 7.0 supports JSR 352. In fact any application server support JSR 352 and tomcat 7.0 is appliaction server so it can support JSR 352. for more details visit this link
has comment: http://stackoverflow.com/comment/37043682
accepted answer of: http://stackoverflow.com/q/24029199
type: Answer
answers question: http://stackoverflow.com/q/24029199
upvote count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/88589801
type: AcceptedAnswer
score: -1
has comment: http://stackoverflow.com/comment/37043041

http://stackoverflow.com/comment/37125815
has text: is this an answer or a comment?
comment on: http://stackoverflow.com/a/24074756
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37117901
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24069827
has text: I'll have to get back to you in a few hours.

http://stackoverflow.com/comment/36976175
score: 0
type: QuestionComment
has text: Try with `em.merge();` then `em.flush()`. One thing is you don't need `find()` operation inside transaction boundary, that means you can use find() before it begins.
type: Comment
comment on: http://stackoverflow.com/q/23994275

http://stackoverflow.com/comment/36938859
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23974636
has text: It is another approach.
type: AnswerComment

http://stackoverflow.com/q/24024574
accepted answer: http://stackoverflow.com/a/24025133
type: AnsweredQuestion
tagged with: listview
tagged with: gesturedetector
has title: How to use Gesture Detector over a ListView in Android App
type: Question
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24025133
score: 0
has body: I have a gesture detector used to scroll between "pages." Each page will consist of a listview. The problem I am having is that my swipes aren't being picked up over the ListView. They work above and below the ListView, just not over it, as displayed in the picture below. Does anyone have any idea how to make the swipe work OVER the ListView? Thanks! Here is my Activity: public class MainActivity extends ActionBarActivity { ListView listView; TextView test; ArrayList&lt;Location&gt; arrayOfLocations; LocationAdapter adapter; // public static Bitmap bitmap; Button refresh; // ProgressBar progress; ImageView view; private GestureDetector gestureDetector; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.listView1); // test = (TextView) findViewById(R.id.textView2); // Construct the data source arrayOfLocations = new ArrayList&lt;Location&gt;(); // Create the adapter to convert the array to views adapter = new LocationAdapter(this, arrayOfLocations); adapter.add(new Location(null, "Title", "Test", "Test2","Test3")); listView.setAdapter(adapter); gestureDetector = new GestureDetector(this, new SwipeGestureDetector()); } @Override public boolean onTouchEvent(MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { return true; } return super.onTouchEvent(event); } private void onLeftSwipe() { Toast.makeText(getApplicationContext(), "Swipe!", Toast.LENGTH_LONG).show(); } private void onRightSwipe() { Toast.makeText(getApplicationContext(), "Swipe!", Toast.LENGTH_LONG).show(); } // Private class for gestures private class SwipeGestureDetector extends SimpleOnGestureListener { // Swipe properties, you can change it to make the swipe // longer or shorter and speed private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 200; private static final int SWIPE_THRESHOLD_VELOCITY = 200; @Override public bool…
answer count: 1
tagged with: java

http://stackoverflow.com/q/24037506
has comment: http://stackoverflow.com/comment/37248503
has comment: http://stackoverflow.com/comment/37241172
tagged with: annotations
has comment: http://stackoverflow.com/comment/37230027
has answer: http://stackoverflow.com/a/24037660
has title: Jackson JSON mapping array to java class
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has comment: http://stackoverflow.com/comment/37247109
type: Question
has comment: http://stackoverflow.com/comment/37058148
downvote count: 0
tagged with: jackson
has comment: http://stackoverflow.com/comment/37228250
has body: I want to map the following JSON: [ { "rate": { "id": "1", "value": "1" } }, { "rate": { "id": "2", "value": "2" } } ] To List&lt;Rate&gt; using annotations. How can I map the "rate" property to the Rate object? Would it not be possible to annotate it like this? @JsonClassMapping("rate") // Fictitious annotation public class Rate { @JsonProperty("id") int id; @JsonProperty("value") int value; } Thse JSON is slightly different from the supposed duplicate in Jackson - How to process (deserialize) nested JSON?. I cannot get the suggested solutions to work in my case.
has comment: http://stackoverflow.com/comment/37246823
has comment: http://stackoverflow.com/comment/37240996
linked to: http://stackoverflow.com/q/11747370
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/11747370
has comment: http://stackoverflow.com/comment/37058059
type: UnansweredQuestion

http://stackoverflow.com/comment/44282951
score: 0
type: QuestionComment
type: Comment
has text: You may want to change `System.getProperties().put` by `System.setProperty`, it's what didn't work with me.
comment on: http://stackoverflow.com/q/23984480

http://stackoverflow.com/comment/36888648
score: 0
comment on: http://stackoverflow.com/q/23947358
type: Comment
type: QuestionComment
has text: @ wns349: yes, I am checking that too.

http://stackoverflow.com/q/24072914
tagged with: java
downvote count: 2
type: Question
score: -2
has body: Okay, so I get a text file, tokenize it, and then try to write it to another file. I have a class called course which has 4 parameters: name, level, code, year I have divided each line of the text file onto a different line @Edit: Should have mentioned this earlier, but I have 3000 courses stored in a text file public void readFromFile() throws IOException { int index = 0; int j = -1; int spaceCount = 0; courseNumber++; setCourseFields(); BufferedReader inputFile = new BufferedReader(new FileReader(INPUT_FILE)); PrintWriter outputFile = new PrintWriter(new FileWriter(OUTPUT_FILE)); String lineOfText = inputFile.readLine(); while (lineOfText != null) { outputFile.println(lineOfText); lineOfText = inputFile.readLine(); for (char c : lineOfText.toCharArray()) { if (c == ' ') { spaceCount++; } } if(spaceCount == 1) { delimiter = DELIMITER_SPACE; } else if(spaceCount == 2) { delimiter = DELIMITER_TAB; } System.out.println("Course" + courseNumber + "\n"); // for each token in the string while ((j = lineOfText.indexOf(delimiter, (index = ++j))) != -1) { System.out.println(courseField[k] + ": " + lineOfText.substring(index, j)); counter++; k++; } // extract the last token if (index &gt; 0) { System.out.println("Year: " + lineOfText.substring(index)); ++courseNumber; } if(k == 3) { k = k - k; index = 0; } delayDisplay(); } // while(lineOfText != null) inputFile.close(); outputFile.close(); } And then I'd get something like this Course1 Name: Computer Engineering Technology Level: IB Code: TEJ4M Year: 2017 Course2 Name: Communications Technology Level: Special Education Code: TGJ2O Year: 2002 Each course is unique, and I need help so that I can assign each of the above strings to a variable. Each course has 4 instance fields + a unique serial number(Course Number) The 4 fields are: String name; char level; String code; int academicYear; I want to make courses out of each of the 4 lines Here is my course class public class Course extends Object implements Serializable { // cla…
has title: How to make text from textfile into fields of an object
has comment: http://stackoverflow.com/comment/37123016
has comment: http://stackoverflow.com/comment/37122717
upvote count: 0
answer count: 1
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/37122805
tagged with: variables
has comment: http://stackoverflow.com/comment/37122627
has comment: http://stackoverflow.com/comment/37122706
favorite count: 0
type: UnansweredQuestion
tagged with: text-files
has answer: http://stackoverflow.com/a/24073079
tagged with: tokenize
has comment: http://stackoverflow.com/comment/37122956

http://stackoverflow.com/q/23958338
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: command-line-arguments
accepted answer: http://stackoverflow.com/a/23959045
linked to: http://stackoverflow.com/q/3020094
downvote count: 0
has comment: http://stackoverflow.com/comment/36909329
answer count: 6
has answer: http://stackoverflow.com/a/23958868
favorite count: 0
tagged with: args
possible better answer: http://stackoverflow.com/a/23958868
has answer: http://stackoverflow.com/a/23958855
has answer: http://stackoverflow.com/a/65674642
has answer: http://stackoverflow.com/a/23959045
has comment: http://stackoverflow.com/comment/36909225
has title: How to stop Java from separating JSON string passed as a command line argument into separate subunits of args[]
type: AnsweredQuestion
has body: I want to pass this JSON String to a Java class through command line arguments. {"body": "We should definitely meet up, man", "startDate": "2014-05-29 11:00:00", "endDate": "2014-05-29 12:00:00", "location": "Boca Raton", "subject": "This is the subject of our meeting."} However, at every space, the String gets split up. So args[0] is {"body": args[1] is "We etc. I want args[0] to just be {"body": "We should definitely meet up, man", "startDate": "2014-05-29 11:00:00", "endDate": "2014-05-29 12:00:00", "location": "Boca Raton", "subject": "This is the subject of our meeting."} I tried using double quotes, but since there are quotes in the JSON string it didn't work. How can I do this? Thanks so much!
tagged with: spaces
upvote count: 7
has answer: http://stackoverflow.com/a/67784397
type: Question
has answer: http://stackoverflow.com/a/39559869

http://stackoverflow.com/a/24069298
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24038356
answers question: http://stackoverflow.com/q/24038356
type: Answer
upvote count: 1
has body: keytool:generateKeyPair could be used to create a keystore that is valid for Tomcat to run an SSL connector.
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37274990
has text: Just to make sure I understand, if the MY_COLLECTION table has any number of entries other than 10920 everything works correctly?
type: QuestionComment
comment on: http://stackoverflow.com/q/24041904
score: 0
type: Comment

http://stackoverflow.com/a/23977278
answers question: http://stackoverflow.com/q/23977204
type: Answer
has comment: http://stackoverflow.com/comment/36944280
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36944074
upvote count: 2
has comment: http://stackoverflow.com/comment/36944057
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23977204
has body: You can use this logic: If the file already exists in the destination, you add "(1)" to the file name (before the extension). But then you ask me: what if there's already a file with "(1)"? Then you use (2). If there's already one with (2) too, you use (3), and so on. You can use a loop to acomplish this: /* * Method to move a specific file from directory to another */ public static void moveFile(String source, String destination) { File file = new File(source); String newFilePath = destination + "\\" + file.getName(); File newFile = new File(newFilePath); String fileName; String extention; int fileNum; int cont; if (!newFile.exists()) { file.renameTo(new File(newFilePath)); } else { cont = 1; while(newFile.exists()) { fileName = FilenameUtils.removeExtension(file.getName()); extention = FilenameUtils.getExtension(file.getPath()); System.out.println(fileName); newFile = new File(destination + "\\" + fileName + "(" + cont++ + ")" + extention); } newFile.createNewFile(); }//End else }

http://stackoverflow.com/q/24050980
tagged with: java
has answer: http://stackoverflow.com/a/24051609
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24051609
downvote count: 0
has title: how to translate a java object to a map in clojure？
has body: For example: class Person { String name; } I would like to get {:name "xxx} from an instance of Person. I know (from_json (.toJson person)) can do it. Is there any better way to achieve it?
tagged with: clojure
favorite count: 0
has answer: http://stackoverflow.com/a/24051193
accepted answer: http://stackoverflow.com/a/24051193
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/a/24034955
accepted answer of: http://stackoverflow.com/q/24033945
has body: Modify your query to include o.id in select select o.id, o.invtype, o.curr, o.crdate, o.trnvrdate, o.custname, o.custadr, o.custbin, o.sellname, o.selladr, o.sellbin, d.descr, d.ndsamount, d.prWTax, d.prWOTax, d.trnvrsize from inv o, inv_dtl d where o.dep_id = d.dep_id and o.id= d.id And then modify your loop to deduplicate invoice using o.id while keeping the products. long tempId = 0; while (rows.next()) { if (tempId == rows.getLong("id")) { // add productN } else { // add invoice + product1 tempId = rows.getLong("id"); } }
answers question: http://stackoverflow.com/q/24033945
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/37097329
has text: Well, the check should be that the string length is more than 1 because you are accessing its index 1.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24059202

http://stackoverflow.com/q/24100740
has body: Case 1 (Works fine) I am trying to implement a before AOP implementation for the below method: public void setNames(List names) { this.names = names; } I tried this: &lt;aop:pointcut id="empl" expression="execution(* com.model.Employee.set*(java.util.List)) and args(names)"/&gt; &lt;aop:aspect ref="aspect"&gt; &lt;aop:before pointcut-ref="empl" method="beforeExecutionEmpl" arg-names="names"/&gt; &lt;/aop:aspect&gt; And it worked. Case 2 (Does not works) But if I change the method to this (Added the Generics): public void setNames(List&lt;String&gt; names) { this.names = names; } and this: &lt;aop:pointcut id="empl" expression="execution(* com.model.Employee.set*(java.util.List&lt;java.lang.String&gt;)) and args(names)"/&gt; &lt;aop:aspect ref="aspect"&gt; &lt;aop:before pointcut-ref="empl" method="beforeExecutionEmpl" arg-names="names"/&gt; &lt;/aop:aspect&gt; Then I an getting the below exception: Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 44 in XML document from class path resource [spring-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The value of attribute "expression" associated with an element type "null" must not contain the '&lt;' character. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionRe…
has comment: http://stackoverflow.com/comment/37175435
linked to: http://stackoverflow.com/q/1131910
has comment: http://stackoverflow.com/comment/37174873
has comment: http://stackoverflow.com/comment/37174913
has comment: http://stackoverflow.com/comment/37178790
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24134428
has title: Spring AOP: Before method execution with Collection
accepted answer: http://stackoverflow.com/a/24134428
has comment: http://stackoverflow.com/comment/37175076
score: 0
tagged with: spring-aop
has comment: http://stackoverflow.com/comment/37175222
answer count: 1

http://stackoverflow.com/q/23996269
type: Question
has answer: http://stackoverflow.com/a/24012798
tagged with: java
has title: Parsing SOAP response message java
answer count: 2
tagged with: validation
has comment: http://stackoverflow.com/comment/36979779
has body: I have the following SOAP response message, where I need to validate that the response code is 1, if project import was successful. How can I do this using RestAssured and Java? &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;env:Header/&gt; &lt;env:Body&gt; &lt;n1:importProjectResponse xmlns:n1=" some text here......" xmlns:n2="..some text here...." xsi:type="n2:ArrayOfProjectImportResultCode"&gt; &lt;n2:ProjectImportResultCode&gt; &lt;n2:code&gt;1&lt;/n2:code&gt; &lt;n2:message&gt;Project 'test1' import was successful.&lt;/n2:message&gt; &lt;/n2:ProjectImportResultCode&gt; &lt;/n1:importProjectResponse&gt; &lt;/env:Body&gt;&lt;/env:Envelope&gt; I am using RestAssured for testing, and it would be great if I could avoid code bloat by taking advantage of RestAssured instead of writing more classes or methods to do a seemingly simple task. Any ideas? I tried so far, which of course does not work.. response = given(). auth().basic(USER, PASSWORD). body(request). headers("Content-type", "text/xml"). expect(). statusCode(200). body("//n2:code/text()", is("1")). // does not match .. hmmm :( when().post(URL);
tagged with: rest-assured
type: UnansweredQuestion
tagged with: soap
has comment: http://stackoverflow.com/comment/36979954
tagged with: xpath
has comment: http://stackoverflow.com/comment/36979868
score: 0
has answer: http://stackoverflow.com/a/24018895

http://stackoverflow.com/comment/37017800
comment on: http://stackoverflow.com/q/24016620
has text: Welcome to Stack Overflow! Unfortunately this is not a good question; to get a positive response here, please show us what you have tried to solve it yourself. Please read the [help section](http://stackoverflow.com/help/how-to-ask) or Jon Skeets famous article ["Writing the perfect question"](http://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx). These will help you create good questions that are received well. Good luck!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23974809
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36939176
downvote count: 2
upvote count: 1
has body: In java like, short range from -32768 to 32767, while For int, from -2147483648 to 2147483647. This simply looks like early designers created some different sized buckets to store this range values.Then they would have created a bunch of more data types of different ranges, but boiled down to only 8 types with these ranges. Any reasons? Instead of exposing a data structure (or say two one for number Other for chars) which can store some user defined dataset could also have worked.
has comment: http://stackoverflow.com/comment/36939167
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36939282
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/43054597
has answer: http://stackoverflow.com/a/23974843
favorite count: 0
tagged with: type-conversion
tagged with: primitive-types
has comment: http://stackoverflow.com/comment/36939210
has title: How Or why is there a limit on any primitive data types
has comment: http://stackoverflow.com/comment/36939166
has comment: http://stackoverflow.com/comment/36939393

http://stackoverflow.com/q/24036958
has answer: http://stackoverflow.com/a/24037513
type: Question
has title: Button takes to wrong location
has comment: http://stackoverflow.com/comment/37055572
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37055747
has comment: http://stackoverflow.com/comment/37057125
has comment: http://stackoverflow.com/comment/37055673
has comment: http://stackoverflow.com/comment/37059552
favorite count: 0
has comment: http://stackoverflow.com/comment/37055773
has comment: http://stackoverflow.com/comment/37089565
tagged with: android
has body: So i am having some trouble with my application, bt3 takes me to bt2 location when i dont want it to, Can someone please explain why? public class MainActivity extends Activity { Button bt, bt2, bt3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bt = (Button) findViewById(R.id.button1); bt2 = (Button) findViewById(R.id.button2); bt3 = (Button) findViewById(R.id.button3); bt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { IntentIntegrator integrator = new IntentIntegrator(MainActivity.this); integrator.initiateScan(); } }); bt2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this, location1.class); startActivity(intent); } }); bt3.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this, location2.class); startActivity(intent); } }); } public void onActivityResult(int requestCode, int resultCode, Intent intent) { //super.onActivityResult(requestCode, resultCode, intent); if (requestCode == 0) { if (resultCode == RESULT_OK) { } else if (resultCode == RESULT_CANCELED) { } } } @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; } } To clarify what each button is suppose to do: button1 is supose to start a scan, button2 is supose to take me to location1, button3 is supose to take me to location2.
has comment: http://stackoverflow.com/comment/37058178
has comment: http://stackoverflow.com/comment/37055603
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37059254
upvote count: 1
has comment: http://stackoverflow.com/comment/37056636
has comment: http://stackoverflow.com/comment/37056879
has comment: http://stackoverflow.com/comment/37056460
has comment: http://stackoverflow.com/comment/37056638
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37056584

http://stackoverflow.com/comment/36924554
type: Comment
type: QuestionComment
has text: I think you are wrong in your expectation. Between 01/01 and 01/02 there is one months difference, and zero days. Between 01/01 and 02/02 there is one months difference and (2 - 1 = 1) 1 day. So between 01/01 and 21/02 there is one months difference and (21 - 1 = 20) 20 days.
comment on: http://stackoverflow.com/q/23966406
score: 0

http://stackoverflow.com/q/24052793
tagged with: java
linked to: http://stackoverflow.com/q/17946855
has body: I have overriden toString() for my object: class GroovyTest { static class TestObject { int a = 3 } static main(def s) { TestObject.metaClass.toString = { -&gt; 'silly'} println new TestObject() } } Ignoring my custom toString() it uses the default toString() and prints: GroovyTest$TestObject@195ed659 However if I manually invoke it like println new TestObject().toString() it works: Silly Why is this?
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24052794
tagged with: groovy
type: AnsweredQuestion
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24052794
answer count: 1
has title: println does not use overriden toString method in Groovy

http://stackoverflow.com/comment/37168694
comment on: http://stackoverflow.com/q/24097356
score: 0
type: Comment
type: QuestionComment
has text: Note that in real-world code, you should nearly always use a `StringBuilder` instead; in fact, the modern implementation of `StringBuffer` is just a synchronized wrapper around one.

http://stackoverflow.com/comment/37041527
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24017995
has text: Hi ROROROOROROR resources is a list which contains id and urlname of Resources entity
type: AnswerComment

http://stackoverflow.com/a/24090053
has body: The problem is that the server is not waiting for the client to send all it's data. In client server programs, what you need to do is to establish a clear protocol between both so that they are in sync when data is transmitted/received. This is usually done by signaling an end of transmission by either side by sending a designated symbol or closing the connection when they are done
answers question: http://stackoverflow.com/q/24089812
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37155570
has comment: http://stackoverflow.com/comment/37154990
has comment: http://stackoverflow.com/comment/37155879
has comment: http://stackoverflow.com/comment/37154904

http://stackoverflow.com/q/23971268
has title: Order values by separate string
linked to: http://stackoverflow.com/q/109383
tagged with: java
has body: Sorry about the non-descriptive title, I couldn't think of a way to explain it better short of 100 words. What I would like to be able to do is sort a list of strings into "boxes" based on a string associated with the main string and an array of strings "order". For my current setup I am using a HashMap to store the string and it's associated "place-in-the-order" string. I am aware that my explanation is truly crap so I have made an image which I hope will explain it better: The variables are initialised as follows: private final String[] order = new String[] {"Severe", "Warning", "Info"}; private final Box[] boxes = new Box[] {new Box(1), new Box(2), new Box(3), new Box(4)}; private final Map&lt;String, String&gt; texts = new HashMap&lt;String, String&gt;(); texts.put("Server on fire!", "Severe"); texts.put("All is good!", "Info"); texts.put("Monkeys detected!", "Warning"); texts.put("Nuke activated!", "Severe"); This shouldn't be too hard to implement but the only way I can think of doing it is by using 3 loops which seems a bit wasteful and would be slow if there was large numbers of any of the inputs. Here is some example code which will hopefully show what I have come up with so far and perhaps explain the problem, I have not tested it and don't have an IDE handy so have probably overlooked something. Set&lt;Box&gt; usedBoxes = new HashSet&lt;Box&gt;(); for(String curOrder : order) { for (String text : texts) { if (texts.get(text).equals(order)) { for (Box box : boxes) { if (!usedBoxes.contains(box)) { box.setText(text); usedBoxes.add(box); break; } } } } }
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23971357
has answer: http://stackoverflow.com/a/23971363
score: 0
has comment: http://stackoverflow.com/comment/36933180
type: UnansweredQuestion

http://stackoverflow.com/comment/37108766
comment on: http://stackoverflow.com/a/24042103
score: 0
type: Comment
has text: Are you sure the procedure that you're calling, GET_DETAIL actually sets CHSI_ESTANCIA_MINIMA? Does calling the procedure in PL/SQL, without JDBC work properly?
type: AnswerComment

http://stackoverflow.com/a/23954289
has comment: http://stackoverflow.com/comment/36902261
type: AcceptedAnswer
downvote count: 0
has body: string.matches("[0-9]+[a-zA-Z]+[a-zA-Z0-9]*$"); // ensures you have atleast 1 number, 1 alphabet and starts with a number/digit
has comment: http://stackoverflow.com/comment/36902565
has comment: http://stackoverflow.com/comment/36901548
has comment: http://stackoverflow.com/comment/36902430
accepted answer of: http://stackoverflow.com/q/23954218
type: Answer
answers question: http://stackoverflow.com/q/23954218
has comment: http://stackoverflow.com/comment/36901440
has comment: http://stackoverflow.com/comment/36902336
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36901623

http://stackoverflow.com/q/23949139
has title: How to check if xml tag has attributes using SAX Parser in Java?
tagged with: http://stackoverflow.com/tag/xml
score: 2
tagged with: java
tagged with: sax
type: Question
has comment: http://stackoverflow.com/comment/36891833
has comment: http://stackoverflow.com/comment/36898877
tagged with: saxparser
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/23950745
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36892043
has comment: http://stackoverflow.com/comment/36892880
favorite count: 0
upvote count: 2
has body: I would like to ask you a problem regarding to xml file. I want to check if xml tag has attributes or not by using SAX Parser in Java. Any answers? Please help me...
type: UnansweredQuestion

http://stackoverflow.com/q/24042523
tagged with: collections
downvote count: 1
type: Question
has title: HashSet implementation
tagged with: hashset
score: -1
has answer: http://stackoverflow.com/a/24042580
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/3854748
has body: public class HashSet&lt;E&gt; extends AbstractSet&lt;E&gt; implements Set&lt;E&gt;, Cloneable, java.io.Serializable { .......... } public abstract class AbstractSet&lt;E&gt; extends AbstractCollection&lt;E&gt; implements Set&lt;E&gt; { ............... } As AbstractSet is already implementing Set interface then why HashSet implements Set interface.
favorite count: 0
linked to: http://stackoverflow.com/q/2165204
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/3854748
duplicate of: http://stackoverflow.com/q/2165204
tagged with: java

http://stackoverflow.com/comment/37101197
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24061355
type: AnswerComment
has text: No, complexity cannot be lower than O(N), because you need to read all the numbers of the array at least once, this is O(N). You can do an optimization and stop iterating over an array if `current` is already equals to `m` - in that case we can say that everyone is here already.

spring-security-oauth2
tags question: http://stackoverflow.com/q/23950068
tag name: spring-security-oauth2
type: Tag

http://stackoverflow.com/comment/37011293
score: 0
has text: @greg-449: Table.java (of SWT plugin) has a problem in computing the visible area of the editor. Method where the issue exists is getClientArea() of Table.java.
comment on: http://stackoverflow.com/q/24011016
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24040944
has body: I thnk u need to create your own Class, something like: Class Curr{ int amount; Curr(int x){ amount=x; } toString(){ if(amount/10000000&gt;1) System.out.println(amount:1000000000 + "B"); else if(amount/10000&gt;1) System.out.println(amount:1000000 + "M"); else if(amount/10) System.out.println(amount:1000 + "K"); else System.out.println(amount); } } Numbers in if are smaller so, if u have for example 100 it will be shown as 0,1K. You can edit so it suits your needs.
answers question: http://stackoverflow.com/q/24040542
score: 0
type: Answer

http://stackoverflow.com/q/24054274
favorite count: 0
has title: How exatly a multi core processor performs better than a single core processor?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24054687
has comment: http://stackoverflow.com/comment/37088178
tagged with: java
has comment: http://stackoverflow.com/comment/37089725
tagged with: multithreading
tagged with: process
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24054432
score: -1
answer count: 2
upvote count: 0
has body: I was reading about concurrency in java and I came across many interesting things. Please help me understand the working of multi core processors. from official docs A computer system normally has many active processes and threads. This is true even in systems that only have a single execution core, and thus only have one thread actually executing at any given moment. Processing time for a single core is shared among processes and threads through an OS feature called time slicing. It's becoming more and more common for computer systems to have multiple processors or processors with multiple execution cores. This greatly enhances a system's capacity for concurrent execution of processes and threads — but concurrency is possible even on simple systems, without multiple processors or execution cores. So first of all, as per my understanding, a process has its own memory space and in systems with single core the memory space is shared between processes using time slicing. So Is it that in multiple core processors time slicing is not needed ? Do different processes run on different cores in a multiple core system ? a little abstract : how exactly a multiple core system is faster ?

http://stackoverflow.com/a/24051282
answers question: http://stackoverflow.com/q/24000740
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37104555
type: Answer
has body: You can rewrite your JPQL as: SELECT NEW model.composite.arena.LeaderboardPlayerPojo(p.externalId, p.hiddenScore, h.score, p.score, (p.victories + p.defeats), p.victories / (p.victories + p.defeats)) FROM ArenaPlayerRegistry p, LeaderboardHighScoreWeekly h WHERE h.externalId = p.externalId AND h.dateAdded BETWEEN :startDate AND :endDate AND (p.victories + p.defeats) &gt; 35 AND h.score &gt; 0 ORDER BY h.score DESC
has comment: http://stackoverflow.com/comment/37110322
accepted answer of: http://stackoverflow.com/q/24000740
score: 1
upvote count: 1

http://stackoverflow.com/q/24023155
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: maven
type: AnsweredQuestion
score: 2
downvote count: 0
has title: Maven + Resteasy JAXB could not find writer for content-type application/xml
tagged with: java
has body: I want to create a .jar that will be used in other projects which amongst others, makes use of the ReastEasy libraries (jaxb, jaxrs, jaxrs-clients etc). Although I am including all libraries, and everything works well in maven based projects, apparently some libraries are not included in the .jar and I am getting the following exception in simple Java SE projects where the .jar is just included in the lib folder: RuntimeException: could not find writer for content-type application/xml type The .jar is build with Maven and the assembly plugin mvn clean compile assembly:single Following is the relevant part of my pom.xml org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final compile org.hibernate hibernate-entitymanager 4.2.0.Final compile org.hibernate hibernate-validator 5.0.3.Final compile org.jboss.resteasy resteasy-jaxrs 2.3.6.Final compile org.jboss.resteasy resteasy-jaxb-provider 2.3.6.Final compile org.jboss.resteasy resteasy-jackson-provider 2.3.6.Final compile org.jboss.resteasy jaxrs-api 2.3.6.Final compile org.slf4j slf4j-api 1.7.6 compile org.slf4j slf4j-simple 1.7.6 compile commons-logging commons-logging 1.1.2 compile ${project.artifactId} org.apache.maven.plugins maven-jar-plugin 2.2 maven-assembly-plugin jar-with-dependencies false
tagged with: jaxb
has answer: http://stackoverflow.com/a/27951680
accepted answer: http://stackoverflow.com/a/27951680
type: Question
upvote count: 2

http://stackoverflow.com/comment/37063184
type: Comment
comment on: http://stackoverflow.com/q/24040681
score: 0
type: QuestionComment
has text: You should read about inheritance and abstract classes.

http://stackoverflow.com/a/23970756
upvote count: 1
has comment: http://stackoverflow.com/comment/36932260
type: Answer
answers question: http://stackoverflow.com/q/23970663
downvote count: 0
score: 1
has body: You have defined select box but it does not have any options Moreover for debugging purpose, you should inspect the value in alert/firebug for firefox/some other debugger in javascript before sending it to server
has comment: http://stackoverflow.com/comment/36932189

http://stackoverflow.com/comment/36964135
type: Comment
has text: @SarahSzabo Yes it's part of the learning curve, but frankly the API smells a bit to me. From the pure collections point of view, `List.removeAll(list2)` expects that list2 doesn't change for the duration of the call. But the `ObservableList` returned from `MultipleSelectionModel.getSelectedItems` is always kept up-to-date with respect to the selection. So if you want to use the current selection as part of a computation that updates the selection -- which seems entirely reasonable -- you get into trouble.
comment on: http://stackoverflow.com/a/23986364
type: AnswerComment
score: 0

http://stackoverflow.com/q/23989924
tagged with: sorting
score: 0
has body: I have a JSONArray called events. I need these events to be sorted by a field called "EVENT_TIME" in descending order. I store the events into an ArrayList called all_events and use Collections.sort() on it with my own comparator. Out of 6 events , 5 get sorted and 1 is in the wrong place. I end up with: Acceptance 31-May-2014 10:31:00 Reopened 31-May-2014 10:30:55 Arrived at Pickup Location 31-May-2014 10:30:45 Unloaded from Vessel 31-May-2014 10:30:00 Shipment Create 29-May-2014 00:00:00 Arrive Load Port 30-May-2014 00:00:00 after sorting. Clearly the last one is in the wrong place. Storing into arraylist and calling the sort: ArrayList&lt;String&gt;all_events=new ArrayList&lt;String&gt;(); for(int i=0;i&lt;events.length();i++){ JSONObject event=events.getJSONObject(i); all_events.add(event.toString()); } Collections.sort(all_events, new JSONComparator());; The JSONComparator class: class JSONComparator implements Comparator&lt;String&gt;{ public int compare(String a, String b){ String a_time=null; String b_time=null; try{ JSONObject event1=new JSONObject(a); JSONObject event2=new JSONObject(b); a_time=event1.getString("EVENT_TIME"); b_time=event2.getString("EVENT_TIME"); } catch(JSONException e){ e.printStackTrace(); } SimpleDateFormat sdf=new SimpleDateFormat("ss-MMM-yyyy HH:mm:sss"); Date date1=null, date2=null; try{ date1=sdf.parse(a_time); date2=sdf.parse(b_time); } catch(ParseException pe){ pe.printStackTrace(); } return date1.compareTo(date2)*-1; } }; printing the output: for(int i=0;i&lt;all_events.size();i++){ JSONObject event=new JSONObject(all_events.get(i)); String s=event.getString("EVENT_CODE"); String eventname=codemap.getString(s); System.out.println(eventname+" "+event.getString("EVENT_TIME")); }
has title: Sorting ArrayList of JSONObjects not working properly
has comment: http://stackoverflow.com/comment/36967837
accepted answer: http://stackoverflow.com/a/23990072
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36968618
has comment: http://stackoverflow.com/comment/36967708
has comment: http://stackoverflow.com/comment/36967721
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36968777
has answer: http://stackoverflow.com/a/23990072
answer count: 1

http://stackoverflow.com/a/24070346
accepted answer of: http://stackoverflow.com/q/24057531
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24057531
type: Answer
has body: There are various ways this can be implemented but re-using Java's ability to read resources from a directory on the classpath looks the easiest to me. Deliver the application with a zip-file containing the updatable help-resources. At application start, extract this zip-file to apphome/help-resources but do not overwrite newer/modified files. Use the technique in this answer to add the apphome/help-resources directory to the class-path. From then on resources can be loaded as if they are in a jar-file on the classpath (no special code needed). The customer can update the files in apphome/help-resources and using a runtime-command the zip-file can be updated/recreated with the files in the apphome/help-resources directory. Or if the customer has 7-zip or something similar, just create the zip-file using the zip-tool.
score: 0

http://stackoverflow.com/comment/36879659
type: QuestionComment
comment on: http://stackoverflow.com/q/23942630
score: 1
has text: `file://` in a web-application.
type: Comment

http://stackoverflow.com/q/24033212
score: 0
has title: what the java command's -jar option really does
has answer: http://stackoverflow.com/a/24033246
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37048934
has answer: http://stackoverflow.com/a/24033425
tagged with: java
has body: Does the -jar option of the java command also compile the sources before running the main method? I believe so but i would like to have a better understanding of the internal process, from the man page you can clearly see a small workflow sequence: -jar Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial @ But it does not mention that it compiles the sources.
possible better answer: http://stackoverflow.com/a/24033425
type: Question
answer count: 2
tagged with: jar
accepted answer: http://stackoverflow.com/a/24033246

http://stackoverflow.com/a/24099324
has comment: http://stackoverflow.com/comment/37172258
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37172006
has comment: http://stackoverflow.com/comment/37172097
has comment: http://stackoverflow.com/comment/37172162
accepted answer of: http://stackoverflow.com/q/24098652
has comment: http://stackoverflow.com/comment/37172931
has comment: http://stackoverflow.com/comment/37172365
type: Answer
answers question: http://stackoverflow.com/q/24098652
has body: According to your question, if you are just solely trying to check whether 3 is surrounded by 1s, you can do this. This is according to your question of assuming that you will have no multiple 3s in your array. public static void main(String[] args) { int[] array = {3,1,2,4,3,1,3,1}; int posOfThree = 0; int posOfFirstThree = 0; boolean noLeft = true; boolean noRight = true; boolean firstThreeFound = false; //Get position of 3 for (int x=0; x&lt;array.length; x++) { if (array[x] == 3) { if (firstThreeFound == false) { posOfFirstThree = x; //Position of the first occurred 3 firstThreeFound = true; } posOfThree = x; //Position of the last occurred 3 } } //Check if there is 1 on left hand side of first 3 int left = 0; while (posOfFirstThree - left &gt; 0) { left ++; if (array[posOfFirstThree-left] == 1) noLeft = false; } //Check if there is 1 on right hand side of last 3 int right = 0; while (posOfThree + right &lt; array.length-1) { right ++; if (array[posOfThree + right] == 1) noRight = false; } System.out.println("Outcome: " + (noLeft || noRight)); } Program Output: Outcome: True Since you can only use normal loops and simple array to do this. This is simple enough to suit your requirements. Certainly, I believe this solution can be further improved, however, this code can get exactly what you need (even if you increase or decrease the array size). EDIT: The edited version can handle multiple 3s in the array and check whether all 3s are surrounded by 1s.
has comment: http://stackoverflow.com/comment/37172301
has comment: http://stackoverflow.com/comment/37172070
has comment: http://stackoverflow.com/comment/37171957
score: 0

http://stackoverflow.com/a/24098128
type: Answer
has body: Because the "Enter" key you pressed after input.nextDouble() in the first iteration is received as an input inside input.nextLine() on the second iteration. That's why you felt that the input is skipped. Example: int option = input.nextInt(); input.nextLine(); // Consume newline left-over String str1 = input.nextLine(); So enter a input.nextLine() at the end of your loop and it will all work fine
answers question: http://stackoverflow.com/q/24098102
score: 0

http://stackoverflow.com/comment/37051480
comment on: http://stackoverflow.com/a/24034745
score: 1
type: AnswerComment
type: Comment
has text: I prefer your solution than mine :).

http://stackoverflow.com/q/24052454
tagged with: webdriver
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37084822
has answer: http://stackoverflow.com/a/24055057
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37101580
has title: Read a XML file which is generated on a website and parse it with selenium
tagged with: java
tagged with: selenium
has body: I am testing a website which has a button and a text edit. On clicking the button a XML will generate on the same page inside the text editor component. I want to read this XML which is generated and the parse it using the java DOM concepts This is the html code for the text editor element. As we can see that the XML isn't specified here as any value. However the xml is specified as a DOM property under value property.
tagged with: dom

http://stackoverflow.com/comment/36938470
type: Comment
type: QuestionComment
has text: org.springframework-version = 3.2.2.RELEASE
comment on: http://stackoverflow.com/q/23974517
score: 0

http://stackoverflow.com/comment/123647857
has text: No report folder, and the report folder I could find with the files are empty.
type: AnswerComment
comment on: http://stackoverflow.com/a/50239165
score: 0
type: Comment

http://stackoverflow.com/a/26749800
downvote count: 0
has comment: http://stackoverflow.com/comment/58681551
has body: Wow, you guys like doing things the hard way. this is what filter() and collect() are for. List&lt;String&gt; toRemove = Arrays.asList("1", "2", "3"); String text = "Hello 1 2 3"; text = Pattern.compile("").splitAsStream(text) .filter(s -&gt; !toRemove.contains(s)) .collect(Collectors.joining()); System.out.println("\"" + text + "\""); outputs (as the original code did) "Hello " Of course, if your search strings are longer than one character, the previous method works better. If you have a tokenized string, though, split and join is easier. List&lt;String&gt; toRemove = Arrays.asList("12", "23", "34"); String text = "Hello 12 23 34 55"; String delimiter = " "; text = Pattern.compile(delimiter).splitAsStream(text) .filter(s -&gt; !toRemove.contains(s)) .collect(Collectors.joining(delimiter)); System.out.println("\"" + text + "\""); outputs "Hello 55"
has comment: http://stackoverflow.com/comment/136048382
answers question: http://stackoverflow.com/q/24011597
score: 17
accepted answer of: http://stackoverflow.com/q/24011597
type: AcceptedAnswer
upvote count: 17
has comment: http://stackoverflow.com/comment/43048301
has comment: http://stackoverflow.com/comment/43031323
type: Answer

http://stackoverflow.com/a/24011264
has comment: http://stackoverflow.com/comment/37013255
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 115
upvote count: 115
answers question: http://stackoverflow.com/q/24010109
has comment: http://stackoverflow.com/comment/57871761
has comment: http://stackoverflow.com/comment/57884827
has body: For the specific question of generating a reverse IntStream, try something like this: static IntStream revRange(int from, int to) { return IntStream.range(from, to) .map(i -&gt; to - i + from - 1); } This avoids boxing and sorting. For the general question of how to reverse a stream of any type, I don't know of there's a "proper" way. There are a couple ways I can think of. Both end up storing the stream elements. I don't know of a way to reverse a stream without storing the elements. This first way stores the elements into an array and reads them out to a stream in reverse order. Note that since we don't know the runtime type of the stream elements, we can't type the array properly, requiring an unchecked cast. @SuppressWarnings("unchecked") static &lt;T&gt; Stream&lt;T&gt; reverse(Stream&lt;T&gt; input) { Object[] temp = input.toArray(); return (Stream&lt;T&gt;) IntStream.range(0, temp.length) .mapToObj(i -&gt; temp[temp.length - i - 1]); } Another technique uses collectors to accumulate the items into a reversed list. This does lots of insertions at the front of ArrayList objects, so there's lots of copying going on. Stream&lt;T&gt; input = ... ; List&lt;T&gt; output = input.collect(ArrayList::new, (list, e) -&gt; list.add(0, e), (list1, list2) -&gt; list1.addAll(0, list2)); It's probably possible to write a much more efficient reversing collector using some kind of customized data structure. UPDATE 2016-01-29 Since this question has gotten a bit of attention recently, I figure I should update my answer to solve the problem with inserting at the front of ArrayList. This will be horribly inefficient with a large number of elements, requiring O(N^2) copying. It's preferable to use an ArrayDeque instead, which efficiently supports insertion at the front. A small wrinkle is that we can't use the three-arg form of Stream.collect(); it requires the contents of the second arg be merged into the first arg, and there's no "add-all-at-front" bulk operation on Deque. Instea…
accepted answer of: http://stackoverflow.com/q/24010109
has comment: http://stackoverflow.com/comment/124894454

http://stackoverflow.com/comment/37042887
type: QuestionComment
comment on: http://stackoverflow.com/q/24024408
has text: @rightfold Lisp macros are quite different from preprocessor macros.
score: 0
type: Comment

http://stackoverflow.com/q/24006414
has body: I have text that I want to fined some thing like this "Name DAVID" I want to match "DAVID" in this, larger, text. I tried use a regular expression like this: (Name(.*)) and also (?:Name(.*)) but this also matched "Name," and I only want to match "David".
score: -2
tagged with: java
type: Question
has title: Regular expression -- ignore part of a matched string
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24006518
downvote count: 3
has answer: http://stackoverflow.com/a/24006450
tagged with: regex
answer count: 4
has comment: http://stackoverflow.com/comment/36999364
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24007680
has answer: http://stackoverflow.com/a/24006427

http://stackoverflow.com/comment/37162462
type: QuestionComment
comment on: http://stackoverflow.com/q/24094101
type: Comment
has text: You say "when I opened the file it is not in UTF-8" and then you say it was "UTF-8 without BOM". You are contradicting yourself. In general you probably don't want to have a [BOM](http://en.wikipedia.org/wiki/Byte_order_mark) especially not in UTF-8 as Wikipedia explains, some XML parsers can't deal with it.
score: 1

http://stackoverflow.com/comment/37155541
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24090395
has text: What is at line `Plansza.java:92`?

http://stackoverflow.com/comment/37172733
type: Comment
comment on: http://stackoverflow.com/q/24099454
has text: no. nothing "new menu" and nothing background for the selected raw
score: 0
type: QuestionComment

http://stackoverflow.com/q/24038981
score: 1
tagged with: java
tagged with: apache-axis
type: Question
has comment: http://stackoverflow.com/comment/37068102
upvote count: 1
has comment: http://stackoverflow.com/comment/37069168
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/30539736
has comment: http://stackoverflow.com/comment/37122769
downvote count: 0
type: UnansweredQuestion
has body: Get webservice call which fetches a single incident from ServiceNow throws an exception that says, "org.apache.axis2.AxisFault: For input string: Normal", "java.lang.NumberFormatException: For input string: Normal". But the input that I'm giving is a sys_id which is a string and the object of Get webservice also expects a string . Get getInc = new Get(); GetResponse resp = new GetResponse(); getInc.setSys_id(sysid); //sysid is of type String resp = stub.get(getInc); I do not understand where does a NumberFormatException come from in this context . Could someone please help? Stack trace is given below. org.apache.axis2.AxisFault: For input string: "Normal" at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) Caused by: java.lang.NumberFormatException: For input string: "Normal" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.math.BigInteger.&lt;init&gt;(Unknown Source) at java.math.BigInteger.&lt;init&gt;(Unknown Source) at org.apache.axis2.databinding.utils.ConverterUtil.convertToInteger(ConverterUtil.java:839) at com.service_now.www.ServiceNow_incidentStub$GetResponse$Factory.parse(ServiceNow_incidentSt ub.java:10561) (http://www.ServiceNow_incidentStub$GetResponse$Factory.parse%28ServiceNow_incidentStub.jav a:10561%29) at com.service_now.www.ServiceNow_incidentStub.fromOM(ServiceNow_incidentStub.java:14029) (http://www.ServiceNow_incidentStub.fromOM%28ServiceNow_incidentStub.java:14029%29) Note: elementFormDefault value is set to False, i.e the option is not ticked. Thanks Deepak
has title: GET() webservice call in ServiceNow throws a Number Format Exception
tagged with: web-services
tagged with: servicenow

http://stackoverflow.com/a/24162926
answers question: http://stackoverflow.com/q/24029006
score: 0
has body: If we use LastResult for service response then I got this error, I used requestHandler for handling response and i got my response for first time itself. Service.addEventListener("result", resultHandler); private function resultHandler(evt:ResultEvent):void { var ac = evt.result; }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24029006

http://stackoverflow.com/a/23977709
accepted answer of: http://stackoverflow.com/q/23977654
type: Answer
upvote count: 3
has body: You should actually be setting the background color of the content pane via getContentPane().setBackground(Color.YELLOW): import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.JFrame; public class Frames extends JFrame { private static final long serialVersionUID = 1L; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { new Frames(); } catch (Exception e) { e.printStackTrace(); } } }); } public Frames() { setSize(new Dimension(100, 100)); setTitle("MAIN MENU"); getContentPane().setBackground(Color.YELLOW); setVisible(true); } } Also, consider using variable naming conventions; for instance, Main_Menu should be named as mainMenu.
score: 3
answers question: http://stackoverflow.com/q/23977654
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36997774
type: Comment
has text: @EJP I don't think that is true. There is no mention for it at the documentation and I don't see any IllegalStateException. http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#connect(java.net.SocketAddress,%20int)
comment on: http://stackoverflow.com/a/24005317
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36954244
comment on: http://stackoverflow.com/q/23982496
type: Comment
has text: setKey should have absolute path similar to the one you are trying localy. ie C:\some_address\some_image.jpg
score: 0
type: QuestionComment

http://stackoverflow.com/a/23980450
has comment: http://stackoverflow.com/comment/36949889
has comment: http://stackoverflow.com/comment/36951037
score: 4
upvote count: 4
has body: Use a JList, put it inside a JScrollPane, put that within a pane in the middle part of a BorderLayout; BorderLayout is the default for a JFrame, so you may not need to create one. Put the lower button on the bottom portion of the BorderLayout.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23980206
downvote count: 0
answers question: http://stackoverflow.com/q/23980206
type: Answer

http://stackoverflow.com/a/23979559
downvote count: 0
answers question: http://stackoverflow.com/q/23979541
type: Answer
upvote count: 1
has body: You should initilize the ArrayList courses ArrayList&lt;String[]&gt; courses = new ArrayList&lt;String[]&gt;()
score: 1

http://stackoverflow.com/a/24036370
answers question: http://stackoverflow.com/q/24036335
upvote count: 1
has comment: http://stackoverflow.com/comment/37054652
has comment: http://stackoverflow.com/comment/37054551
score: 1
has comment: http://stackoverflow.com/comment/37054600
downvote count: 0
has body: I see this line commented - //exporter.setParameter(JRExporterParameter.INPUT_FILE, new File("D:\\Project1\\EmailSendExample\\WebContent\\PDFiles\\AnnexI.pdf")); And exception talks about input - net.sf.jasperreports.engine.JRException: No input source supplied to the exporter.
type: Answer
has comment: http://stackoverflow.com/comment/37054704

http://stackoverflow.com/comment/36900802
comment on: http://stackoverflow.com/a/23945470
score: 0
type: Comment
type: AnswerComment
has text: Running some metrics on the functions, it doesn't matter if you compare the types to int.class or compare the type.getShortName() to "int". Those are equally fast. The real slow code is in the Annotation retrieval functions, isAnnotationPresent() and getAnnotation(). 75% of the function time is in those 2 lines of code.

http://stackoverflow.com/comment/36996480
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24000101
has text: It is extending `BaseAdapter`.
type: Comment

http://stackoverflow.com/comment/37166487
has text: +1 Thanks. Seemed to have overlooked this. Implemented it and working perfectly :)
comment on: http://stackoverflow.com/a/24092094
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23957646
type: UnansweredQuestion
has title: Handling Failed Network Requests with a ListView's Empty View
tagged with: android
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36909888
type: Question
tagged with: android-annotations
tagged with: listview
has body: I have a ListView that retrieves data from the net. I have an empty View, empty.xml (using ListView.setEmptyView()), for when the ListView contains no items. However, I want to set another empty view for when the network request fails (error.xml, lets call it the error View). If the network request fails and the error View is shown, I want the user to be able to click the retry button and have ProfileFragment.getProfile() be called again, as well as setting the ListViews empty View back to the default empty View (empty.xml) How can I achieve this? I've attempted using two ViewStubs (one for empty.xml and one for error.xml), but that did not work as expected, as the earlier ViewStub was above the other one, and I couldn't switch them back (maybe I'm using them wrong :/) Code: ProfileFragment.java Annotated with AndroidAnnotations. The showErrorView() is the functionality I am looking for, bearing in mind that if a user hits retry and the profile does load, this error view (error.xml) needs to be replaced with the standard empty view (empty.xml) @EFragment(R.layout.fragment_profile) public class ProfileFragment { private final String TAG = this.getClass().getSimpleName(); @RestService ProfileRest rest; @Bean ProfileAdapter adapter; /** * The object this fragment will display */ private Profile profile; @AfterInject void afterInject() { // Add the API key to each request using the APIKeyInterceptor rest.setRestTemplate(Util.addAPIKey(keyInterceptor, rest.getRestTemplate())); // Retrieve and display the user's profile getProfile(); } /** * - Bind an emptyView to this objects ListView * - Set the Adapter that handles the ListView * - Adds a click listener to handle clicks to each row in the list */ @AfterViews void bindListView() { // here emptyView corresponds to empty.xml listView.setEmptyView(emptyView); // Show the user the emptyView if the adapter is empty listView.setAdapter(adapter); // bind adapter to listView to handle list items listView.setOnItemClickListener(…
has comment: http://stackoverflow.com/comment/36907529

http://stackoverflow.com/a/23978150
answers question: http://stackoverflow.com/q/23977856
score: 10
downvote count: 0
has body: No, they are not unique, eg "FB" and "Ea" both have hashCode = 2236
upvote count: 10
has comment: http://stackoverflow.com/comment/36951738
type: Answer

http://stackoverflow.com/a/24033060
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24026830
has body: Remember that Selenium grid does not provide the parallel distribution of your tests, it is simply a way to allow multiple threads hit the same endpoint to support parallel testing. You still need a mechanism to support the parallel distribution of your tests. I know this can be achieved with JUnit, but in my experience it is easier with TestNG

http://stackoverflow.com/comment/36897565
comment on: http://stackoverflow.com/q/23952426
type: Comment
score: 1
type: QuestionComment
has text: I think you first need a beginner's tutorial on classes, packaging, inheritance, etc. in Java

http://stackoverflow.com/a/24110122
answers question: http://stackoverflow.com/q/23982531
score: 3
downvote count: 0
has body: Number of options (possible sequences of moves) after the first move is 24! and not 24^24. It is still a too much high of a number so it is correct to implement an heuristic. Note that answers about good heuristics are necessarily based on the opinion of the writer so I give my opinion but to find out what is "the best heuristic" you should make the various ideas playing one against the other in the following way: take the two heuristics A and B that you want to compare generate at random a starting configuration let A play with O and B play with X from the same starting configuration let A play with X and B play with O take stats of which one wins more Now my thoughts about good possible heuristics starting points for an nxn playfield with winning sequence length of n: since the winning condition for a player is to form a straight sequence of its marks my idea is to use as base values the number of possibilities that each player has still available to built such a straight sequence. in an empty field both O and X have ideally the possibility to realize the winning sequence in several ways: horizontal possibilities: n vertical possibilities: n diagonal possibilities: 2 total possibilities: 2n+2 in the middle of a round the number of remaining opportunities for a player are calculated as: <the number of rows without opponent's marks> + <the number of columns without opponent's marks> + <the number of diagonals without opponent's marks> instead than calculate all each time it can be considered that: after a move of one player the number of still available possibilities are: unchanged for him equal or lowered for the opponent (if the mark has been placed in a row/col/diagonal where no marks had already been placed by the considered player) as heuristic I can propose: <my possibilities> - <opponent possibilities> is possible that <my possibilities> - k * <opponent possibilities> with k > 1 give better results and in the end this can be related to how a draw is considere…
type: Answer
upvote count: 3

http://stackoverflow.com/a/41336100
score: 0
answers question: http://stackoverflow.com/q/23976804
has body: Here's my solution. Enjoy. public boolean twoTwo(int[] nums) { //If the length is 2 or more if (nums.length &gt;= 2) { //If the last char is a 2, but the one before it is not a char, we return false; if (nums[nums.length - 1] == 2 &amp;&amp; nums[nums.length - 2] != 2) { return false; } //If larger than three, we create a for loop to test if we have any 2s that are alone. if (nums.length &gt;= 3) { for (int i = 1; i &lt; nums.length-1; i++) { //If we find a two that is alone, we return false; if ((nums[i] == 2) &amp;&amp; (nums[i-1] != 2 &amp;&amp; nums[i+1] != 2)) { return false; } } } //If we don't return false, we return true; return true; } //If we have less than two characters, we return true if the length is 0, or \ //One the one number there is not a 2. else { return ((nums.length == 0) || !(nums[0] == 2)); } }
type: Answer

http://stackoverflow.com/a/24090361
type: Answer
has body: public static String replace(String needle, String hayStack, String replacement) { String origNeedle = needle; String origHayStack = hayStack; needle = origNeedle.toLowerCase(); hayStack = origHayStack.toLowerCase(); int hayStackLen = hayStack.length(); int needleLen = needle.length(); int from = 0; int to; String stuffBeforeNeedle; StringBuilder output = new StringBuilder(); do { to = hayStack.indexOf(needle, from); if (to == -1) to = hayStackLen; stuffBeforeNeedle = hayStack.substring(from, to); output.append(stuffBeforeNeedle); if (to &lt; hayStackLen) output.append( replacement ); from = hayStack.indexOf(needle, to) + needleLen; } while (to &lt; hayStackLen); return output.toString(); }
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24090357
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24090357

http://stackoverflow.com/a/60389787
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/114689919
has comment: http://stackoverflow.com/comment/133015515
type: Answer
score: 12
has comment: http://stackoverflow.com/comment/117768849
answers question: http://stackoverflow.com/q/23977629
has body: Annotate with: @RequestParam(defaultValue = "0").

http://stackoverflow.com/a/24026365
downvote count: 0
score: 3
upvote count: 3
has body: Implement a Comparable interface to your student object and specify how you want it to compare. Here is a good example: http://www.mkyong.com/java/java-object-sorting-example-comparable-and-comparator/
type: Answer
answers question: http://stackoverflow.com/q/24026343

http://stackoverflow.com/comment/37086771
comment on: http://stackoverflow.com/a/24039271
type: AnswerComment
score: 0
type: Comment
has text: If we can't specify it in superclass, then we need to duplicate the isActive field in all the entities, which is what I was trying to avoid.

http://stackoverflow.com/comment/50369831
score: 0
comment on: http://stackoverflow.com/a/24075360
type: Comment
has text: _The improvement is with the dynamic expansion of the metaspace which is something permgen wasn't able to do._ are you saying that permgen cant be expanded & metaspace can? both of them can be limited by supplying arguments. So why is metaspace expandable?
type: AnswerComment

http://stackoverflow.com/comment/37027112
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24019380
has text: @Will No, tried it too ABout Context - never heard about such config... Thanks - will try tommorow. Do you have any related links, pelase? Regarding config without Context element.
score: 0

http://stackoverflow.com/a/24012118
has comment: http://stackoverflow.com/comment/37010472
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24012068
upvote count: 3
has comment: http://stackoverflow.com/comment/37010610
has comment: http://stackoverflow.com/comment/37009982
has body: Replace Intent intent = new Intent("com.coded.sandeep.Another"); with Intent intent = new Intent(MainActivity.this, Another.class); Creating Intents using Intent("com.coded.sandeep.Another"); creates an intent of the type 'com.coded.sandeep.Another'. However, since this is a custom intent and android does not know how to handle it, an exception is generated. Edit 1 : Since inside the click listener, MainActivity.this instance is not available, try this : Activity activity; //Instance variable Inside OnCreate() : activity = this; Then use Intent intent = new Intent(activity, Another.class); Edit 2 : Since this is inside an adapter and your adapter does not have a context to start the activity, you can pass the context when initializing the adapter and then use that to start the activity. public class CustomAdapter extends BaseAdapter { Activity activity; public CustomAdapter(Activity) { this.activity = activity; } //Now use this activity to create a new intent and start new activity inside your button click listener. }
has comment: http://stackoverflow.com/comment/37010847

http://stackoverflow.com/a/24102169
has body: Just use get() and iterate over the list that it returns to get the values individually. List&lt;String&gt; values = myMutlimap.get("COM"); for (String s: values) { System.out.println(s); }
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24102143
downvote count: 0
type: Answer

http://stackoverflow.com/q/24042780
type: Question
has comment: http://stackoverflow.com/comment/37066791
has comment: http://stackoverflow.com/comment/37066686
has answer: http://stackoverflow.com/a/24042993
answer count: 1
has comment: http://stackoverflow.com/comment/37081081
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/37066681
tagged with: android
has title: Arraylist elements not received fully
type: UnansweredQuestion
has body: I am using this code to transfer data in the arraylist from one activity to another and I'm got only one item that is saved on the top of the list The code is given here: ArrayList&lt;String&gt; ap=new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; ad=new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; as=new ArrayList&lt;String&gt;(); @Override public void onClick(View v) { // TODO Auto-generated method stub String place=add.getText().toString(); String sta=states.getSelectedItem().toString(); String dis=districts.getSelectedItem().toString(); ap.add(place); as.add(sta); ad.add(dis); next=new Intent(AddPlace.this,MainActivity.class); next.putExtra("places", ap); next.putExtra("districts", ad); next.putExtra("states", as); startActivity(next); and MainACtivity code added here: ArrayList &lt;String&gt;vp= (ArrayList&lt;String&gt;) getIntent().getExtras().getStringArrayList("places"); Iterator i=vp.iterator(); while(i.hasNext()) { Toast.makeText(getBaseContext(), (CharSequence) i.next().toString(), Toast.LENGTH_LONG).show(); } please help me
has comment: http://stackoverflow.com/comment/37066710
tagged with: java

http://stackoverflow.com/a/24085890
score: 0
answers question: http://stackoverflow.com/q/24080165
type: Answer
has comment: http://stackoverflow.com/comment/37199910
has body: I frequently encounter browsing caching issues when I work with GWT. Whenever I make a change to my app, I reload the page using CTRL + F5. That forces a complete reload of the page regardless of what's cached in the browser. Have you tried that?

http://stackoverflow.com/comment/37012862
comment on: http://stackoverflow.com/q/24013905
score: 0
type: QuestionComment
has text: Ya i tried but same ** Null ** output.
type: Comment

http://stackoverflow.com/a/24051726
has body: here Manager is a Employee. but Employee is not Manager. Quote from Effective Java, Item 12: Let’s go over the provisions of the compareTo contract. The first provision says that if you reverse the direction of a comparison between two object refer- ences, the expected thing happens: if the first object is less than the second, then the second must be greater than the first; if the first object is equal to the second, then the second must be equal to the first; and if the first object is greater than the second, then the second must be less than the first. The second provision says that if one object is greater than a second, and the second is greater than a third, then the first must be greater than the third. The final provision says that all objects that compare as equal must yield the same results when compared to any other object. One consequence of these three provisions is that the equality test imposed by acompareTo method must obey the same restrictions imposed by the equals con- tract: reflexivity, symmetry, and transitivity. Therefore the same caveat applies: there is no way to extend an instantiable class with a new value component while preserving the compareTo contract, unless you are willing to forgo the benefits of object-oriented abstraction (Item 8). The same workaround applies, too. If you want to add a value component to a class that implements Comparable, don’t extend it; write an unrelated class containing an instance of the first class. Then provide a “view” method that returns this instance. This frees you to implement whatever compareTo method you like on the second class, while allowing its cli- ent to view an instance of the second class as an instance of the first class when needed.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37083936
upvote count: 2
has comment: http://stackoverflow.com/comment/37083661
answers question: http://stackoverflow.com/q/24051705
downvote count: 0

http://stackoverflow.com/q/24001207
type: UnansweredQuestion
has title: Setting input encoding for Windows PowerShell
tagged with: java
tagged with: character-encoding
has answer: http://stackoverflow.com/a/24007844
type: Question
linked to: http://stackoverflow.com/q/388490
has answer: http://stackoverflow.com/a/24147834
tagged with: powershell
has body: I'm working with a Java application's text interface on Windows using PowerShell. As parameters for text commands I need to input words containing non-standard latin characters (Central European). Those parameter words are than compared with words stored in the application's "dictionary". If a parameter matches with some word in dictionary I get expected results. The problem comes with input encoding. The application stores dicionary words using UTF-8. And I cannot make PowerShell to pass my parameters encoded in UTF-8. They don't match with words in the application because of encoding differences. I tried to control the input encoding in PowerShell setting $OutputEncoding and [Console]::InputEncoding variables to UTF-8. However, parameters are still wrongly encoded. How to make PowerShell encode keybord input, which is passed to application, using UTF-8? May the problem actually lay on the Java side?
score: 0
answer count: 2
tagged with: utf-8

http://stackoverflow.com/comment/37162463
score: 0
has text: Please post a solution instead of ranting about regex. It's nowhere mentioned in the question to involve regex. Thanks!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24093694

http://stackoverflow.com/comment/37035561
comment on: http://stackoverflow.com/q/24025938
type: Comment
type: QuestionComment
has text: because you aren't appending it between the ` ` tags?
score: 0

http://stackoverflow.com/comment/37169817
score: 0
type: Comment
type: QuestionComment
has text: Have you read the javadoc? What don't you understand?
comment on: http://stackoverflow.com/q/24098139

http://stackoverflow.com/comment/37253325
comment on: http://stackoverflow.com/a/24090162
type: AnswerComment
has text: There is a limit of http threads that's why creates more threads from inside the http thread. Do you know what is purpose of using multiple thread inside a thread?
score: 0
type: Comment

http://stackoverflow.com/q/23994654
tagged with: unix
tagged with: linux
has answer: http://stackoverflow.com/a/23995266
has title: How to execute shell script and save in text file command through java in linux
has body: I m using Linux. I want to call a small executable application from my java command line which is called "wmic". It needs an input query. Output are stored in text file in the specific directory. When I use the command in Linux Terminal echo "Hello World" &gt;&gt; /home/kannan/hello.txt the output is stored in hello.txt file. but when i call this command from java Process p = Runtime.getRuntime().exec("echo \"Hello World\" &gt;&gt; /home/kannan/hello1.txt"); the output is not created any hello1.txt file Please any one help me. Thanks in Advance.
tagged with: sh
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23995266
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23994952
type: Question
has answer: http://stackoverflow.com/a/23994952
answer count: 2
tagged with: shell

http://stackoverflow.com/q/24021916
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/24022405
has body: I'm trying to create an app that when pressing a button you get a different result each time. I'm using a global int named 'counter' that grows by +1 every time. My problem is that if I press the button several times quickly it "jumps" to the end. How can I create a space between each press? I thought using handler.postDelayed(Runnable, 500); but I'm not sure wether it's the best solution. And also - when and how to use it in the code? Thanks. public class MyMain extends Activity implements OnClickListener { int clickCounter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_my_main); findViewById(R.id.button1).setOnClickListener(this); findViewById(R.id.button2).setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.button2: clickCounter = 0; break; case R.id.button1: clickCounter++; ActionByClick(); break; } } private void ActionByClick() { // TODO Auto-generated method stub if (clickCounter == 1){ } else if (clickCounter == 2){ } else if (clickCounter == 3){ } else if (clickCounter == 4){ } } }
tagged with: onclicklistener
tagged with: onclick
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24022007
type: AnsweredQuestion
type: Question
has title: Android - timing when using onclick
possible better answer: http://stackoverflow.com/a/24022405
accepted answer: http://stackoverflow.com/a/24022007

http://stackoverflow.com/comment/37055790
score: 2
comment on: http://stackoverflow.com/a/24036503
type: AnswerComment
type: Comment
has text: @user3619962 It is a `ResultSet` object which just consists of 1 column with the generated keys. With `rs.getLong(1);` you get the value of the first column that contains the generated key.

http://stackoverflow.com/a/24095965
has body: I wrote email to the author of RoboGuice. He said that 3.0b-experimental should be replaced by 2.0 version. This is stable version valid for use. After I apply that solution everythink works fine. I hope that might help somebody.
type: Answer
answers question: http://stackoverflow.com/q/24069464
score: 0

http://stackoverflow.com/comment/37054235
type: QuestionComment
comment on: http://stackoverflow.com/q/24035743
has text: The setup was provided by the teachers. I think it was done cause of its simplicity, every team member runs one bat file to setup the database, the server and start the main class of the project
type: Comment
score: 0

http://stackoverflow.com/comment/36936448
type: AnswerComment
type: Comment
has text: @3751_Creator Make your own swing ;) or use extension (probably commercial), which provides such components
comment on: http://stackoverflow.com/a/23969796
score: 0

http://stackoverflow.com/comment/37059798
has text: Yes, you need to ask another question in SO, that's a different issue.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24038227

http://stackoverflow.com/comment/36962038
comment on: http://stackoverflow.com/q/23986789
has text: even the command line compiler will give a lot more information...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24001951
favorite count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24002643
tagged with: hql
type: Question
tagged with: jakarta-ee
has title: Writing Insert HQL Query with Many-to-One mapping
upvote count: 1
has body: I need to write the following SQL query as HQL insert into aab_appl_training tr (tr.training_id,tr.appl_id,tr.course_name,tr.completed_dt,tr.cert_by,tr.cert_num,tr.train_comp) select aab_appl_training_seq.nextval,'10071',tr.course_name,tr.completed_dt,tr.cert_by,tr.cert_num,tr.train_comp from aab_appl_training tr where tr.appl_id=10018 My Dilemma here is that in my Mapping files I have AABApplication mapped as a many to one to the aab_appl_training table <hibernate-mapping> <class name="org.sae.model.aab.AABTraining" table="AAB_APPL_TRAINING" schema="CMS"> <column name="TRAINING_ID" precision="10" scale="0" /> AAB_APPL_TRAINING_SEQ <column name="APPL_ID" precision="10" scale="0" not-null="true" /> The HQL I have written for the same is String hql="insert into AABTraining (tr.applId,tr.courseName,tr.completedDt,tr.certBy,tr.certNum,tr.trainComp)"+" "+"select :new_appl,tr.courseName,tr.completedDt,tr.certBy,tr.certNum,tr.trainComp"+" "+ "from AABTraining tr "+" "+"where tr.applId=:orig_appl" ; However for this I am getting an Exception of [ERROR][2014-06-02 15:28:03,082] [] [AAB] [PARSER] [] <AST>:1:28: unexpected AST node: .[ERROR][2014-06-02 15:28:03,083] [] [AAB] [AABRepositoryImpl] [] org.hibernate.QueryException: could not resolve property: of:org.sae.model.aab.AABTraining [insert into AABTraining (tr.applId,tr.courseName,tr.completedDt,tr.certBy,tr.certNum,tr.trainComp) select :new_appl,tr.courseName,tr.completedDt,tr.certBy,tr.certNum,tr.trainComp from org.sae.model.aab.AABTraining tr where tr.applId=:orig_appl] at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43) at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37) at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1282) Do help me in writing the correct query for the same. Thanks
tagged with: jpa
answer count: 1

http://stackoverflow.com/q/24067858
score: 0
answer count: 2
has body: I have installed java with the command sudo apt-get install openjdk-7-jdk and set the java home and path.But when I am trying to use ant I JAVA_HOME is not defined correctly. We cannot execute /usr/local/java/jre1.7.0_60/bin/java Please help me how to resolve this error. which java ----&gt; /usr/bin/java java -version ----&gt;java version "1.6.0_31" OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1ubuntu1~0.12.04.2) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode) echo $JAVA_HOME -----&gt; /usr/local/java/jre1.7.0_60
has answer: http://stackoverflow.com/a/24069053
has comment: http://stackoverflow.com/comment/37114058
has comment: http://stackoverflow.com/comment/37113413
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37113859
has answer: http://stackoverflow.com/a/60181872
has title: ant - JAVA_HOME is not defined correctly
tagged with: java
type: Question
tagged with: ant
has comment: http://stackoverflow.com/comment/37113709

http://stackoverflow.com/q/24055414
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24055481
tagged with: java
answer count: 6
has answer: http://stackoverflow.com/a/24055449
score: 0
accepted answer: http://stackoverflow.com/a/24055517
has answer: http://stackoverflow.com/a/24055514
possible better answer: http://stackoverflow.com/a/24055447
favorite count: 0
has answer: http://stackoverflow.com/a/24055447
has comment: http://stackoverflow.com/comment/37090706
has comment: http://stackoverflow.com/comment/37111089
has title: Java and the word "new"
has body: If I have two classes A and B as follows : class A: class A{ int i; A(int j){ i=j; } } class B: class B{ A a; B(A a){ this.a=a; } } Then if I have a program that has the following statement: A a = new A(5); B b = new B(a); my question is: Am I going to have two different objects a and b.a, which will have the same value of i, or is my b.a object just pointing to the object a and if I change the value of a.i, then the value of b.a.i will also change?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24066640
has answer: http://stackoverflow.com/a/24055517

http://stackoverflow.com/a/50081336
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24097007
downvote count: 0
has body: If reload didn't work. Replace line Transport.send(m); with: Transport transport = m.getTransport("smtp"); if (!transport.isConnected()) transport.connect(); transport.sendMessage(m, m.getAllRecipients()); transport.close(); Hope this helps you as it helped me.

http://stackoverflow.com/comment/106180053
type: Comment
comment on: http://stackoverflow.com/a/23960260
score: 0
has text: Is it possible to apply `mocking` in such example?
type: AnswerComment

http://stackoverflow.com/comment/37037184
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24025943
type: Comment
has text: Okay, I get it now. many of my beans are in application context and not in servlet context. Now, how can I expose httpservlet request in my whole application?

http://stackoverflow.com/q/23996932
linked to: http://stackoverflow.com/q/1751673
has comment: http://stackoverflow.com/comment/43016145
has answer: http://stackoverflow.com/a/24041534
has body: I have a main application on a JBoss server who has inside standalone modules who work with JasperReports. I need to use font extensions for my reports. After a lot of problems i did manage to make them work. ClassLoader cl = new URLClassLoader( new URL[] {new URL("file:///app/jasper-fonts.jar")} ); Thread.currentThread().setContextClassLoader(cl); JasperPrint print = JasperFillManager.fillReport(jasperReport, params); My reports use the font from the extension. Everything seems fine. But... I have 1.200.000 reports to do. And because of the font extension i get some tmp files (+~JF*****.tmp) on my server on /tmp. 1 file has 700Kb, 700Kb*1.2mil = crash, so i can't keep them all. It's there any solution to not save these? Or to delete them after generation?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: fonts
tagged with: tmp
tagged with: java
has title: JasperReports font extension +~JF*****.tmp files
type: Question
tagged with: jasper-reports
tagged with: jboss

http://stackoverflow.com/comment/36985686
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23999213
type: AnswerComment
has text: @user2091819, Your code has logical array. I will edit my answser with details

http://stackoverflow.com/comment/36936967
type: Comment
has text: That typically done by creating a separate class. For instance having a class `TypedGarbageItem` which will connect the item to it's garbage type.
type: QuestionComment
comment on: http://stackoverflow.com/q/23971980
score: 0

http://stackoverflow.com/comment/37007687
comment on: http://stackoverflow.com/q/24011169
score: 0
type: Comment
type: QuestionComment
has text: I use eclipse but I build in cmd

http://stackoverflow.com/comment/37245795
type: Comment
has text: @DThought I guess, residues won't work. The problem with them is that multiplication by `x` modulo `N` is an invertible operation for all `x` coprime to `N`.
comment on: http://stackoverflow.com/a/24059137
score: 0
type: AnswerComment

http://stackoverflow.com/a/24041283
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24041022
answers question: http://stackoverflow.com/q/24041022
downvote count: 0
score: 1
has body: When the help button is pressed TrayDialog looks for a control with a SWT.Help listener. It starts at the currently focused control and moves up through the control's parents until it finds a control with the listener (or runs out of controls). You can set up a help listener that is connected to a 'help context' in the Eclipse help system using PlatformUI.getWorkbench().getHelpSystem().setHelp(control, "context-id"); or you can write your own help listener.

http://stackoverflow.com/a/24069545
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37138320
answers question: http://stackoverflow.com/q/24069136
upvote count: 1
has body: Propagation.REQUIRED (which is default) means that no transaction opened in case of an open transaction exists. That means that the transaction actually being opened upon calling x.createX method and nothing is done (in terms of transaction treatment) upon calling y.callY and y.callYY methods. However you catch the exception and it doesn't reach the Spring transaction interceptor defined on x.createX method, which should translate it into the rollback. So if x.createX don't have to to be transactional, removing @Transactional from it will make the rollbacks to happen.

http://stackoverflow.com/a/23966684
has comment: http://stackoverflow.com/comment/36971229
upvote count: 1
has comment: http://stackoverflow.com/comment/36971810
score: 1
type: AcceptedAnswer
downvote count: 0
has body: If I understand what you're doing correctly, it sounds like the problem isn't really the texturing. It's the padding you add to round up to a power-of-two that is not transparent. I initially thought you weren't clearing the entire bitmap, but the c.DrawColor() call you have should take care of that. Just to be sure, you could try the following immediately after creating the bitmap instead, and see if it makes a difference: b.eraseColor(Color.TRANSPARENT); The other approach I can think of is cleaner and nicer: During rendering, don't use the part of the texture you added for padding the size. You can do that by adjusting the texture coordinates to only sample the part of the texture that contains your view. Using the sizes from your example (300x300 view drawn into 512x512 texture), the range of the texture coordinates you use for rendering should then be 0.0f to 300.0f / 512.0f in each direction, instead of the usual 0.0f to 1.0f. The blend function you use looks fine.
accepted answer of: http://stackoverflow.com/q/23955242
answers question: http://stackoverflow.com/q/23955242
type: Answer

http://stackoverflow.com/comment/37013623
has text: Which of eXist's Java APIs are you using? XML-RPC? XML:DB? REST? XQJ? internal?
comment on: http://stackoverflow.com/q/24009792
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23961194
has answer: http://stackoverflow.com/a/23961289
accepted answer: http://stackoverflow.com/a/23961289
favorite count: 0
has body: I want to get movie data from the OMDB API which is JSON text. I am using Java to decode this and the package JSON-simple. The URL I want to decode is this for example: http://www.omdbapi.com/?t=icarus Outcome (directly copy and paste, not structured): {"Title":"Icarus","Year":"2010","Rated":"TV-14","Released":"10 Dec 2010","Runtime":"42 min","Genre":"Adventure, Drama, Romance","Director":"Mairzee Almas","Writer":"Alfred Gough (creator), Jerry Siegel (character created by: Superman), Miles Millar (creator), Joe Shuster (character created by: Superman), Alfred Gough (developed for television by), Miles Millar (developed for television by), Genevieve Sparling","Actors":"Tom Welling, Erica Durance, Cassidy Freeman, Justin Hartley","Plot":"As the VRA threat intensifies, Clark takes initiative by closing down watchtower and declaring the League go officially underground, but will this be enough to stop trotter and Slade Wilson...","Language":"English","Country":"USA","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMjIwNDQ2MjM5OV5BMl5BanBnXkFtZTcwODU4NzU0NA@@._V1_SX300.jpg","Metascore":"N/A","imdbRating":"8.6","imdbVotes":"367","imdbID":"tt1628582","Type":"episode","Response":"True"} The code under my button: String url = "http://www.omdbapi.com/?t=" + jListFilms.getSelectedValue().toString(); try { JSONParser parser = new JSONParser(); Object obj = parser.parse(url); JSONObject jsonObj = (JSONObject) obj; String title = (String) jsonObj.get("Title") ; System.out.println(title); } catch (ParseException e){ System.out.println(e); } When I print out the variable title Unexpected character (h) at position 0. Does anyone know why I don't get the title of the movie?
possible better answer: http://stackoverflow.com/a/23963310
score: 2
tagged with: json-simple
tagged with: imdb
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2793150
tagged with: java
has title: Java JSON decode from OMDB (IMDB) API using Java
has answer: http://stackoverflow.com/a/23963310
type: Question
upvote count: 2
answer count: 2
tagged with: api
downvote count: 0

http://stackoverflow.com/a/24074586
answers question: http://stackoverflow.com/q/24054200
score: 0
type: Answer
has body: references used : server code &amp; client call server function name /*** SERVER SIDE CODE****/ @POST @Path("/upload/{attachmentName}") @Consumes(MediaType.APPLICATION_OCTET_STREAM) public void uploadAttachment( @PathParam("attachmentName") String attachmentName, @FormParam("input") InputStream attachmentInputStream) { InputStream content = request.getInputStream(); // do something better than this OutputStream out = new FileOutputStream("content.txt"); byte[] buffer = new byte[1024]; int len; while ((len = in.read(buffer)) != -1) { // whatever processing you want here out.write(buffer, 0, len); } out.close(); return Response.status(201).build(); } /**********************************************/ /** CLIENT SIDE CODE **/ // ..... client.setChunkedEncodingSize(1024); WebResource rootResource = client.resource("your-server-base-url"); File file = new File("your-file-path"); InputStream fileInStream = new FileInputStream(file); String contentDisposition = "attachment; filename=\"" + file.getName() + "\""; ClientResponse response = rootResource.path("attachment").path("upload").path("your-file-name") .type(MediaType.APPLICATION_OCTET_STREAM).header("Content-Disposition", contentDisposition) .post(ClientResponse.class, fileInStream); You should split the file in the client and restore part of the file in the server. and after that you should merge the files together. Take a look at split /merge file on coderanch Enjoy ! :)

http://stackoverflow.com/comment/36967477
score: 0
has text: The plugin is to use struts1 actions and forms as is used in struts1, but run in struts2.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23957800

http://stackoverflow.com/q/24091479
tagged with: java
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24091544
tagged with: converters
tagged with: android
has comment: http://stackoverflow.com/comment/37157615
type: AnsweredQuestion
has body: I know for a fact I'm missing something extremely small but i can not seem to get my code to compile without errors. I am attempting to get the text field to take in a decimal number and OnClick, it will spit out the numbers binary equivalent. It keeps telling me to initialize Binary but if i set it to 0, that makes Binary '0' instead of converting the decimal number. Any help will would great! This is is my MainActivity.java file: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } final EditText editDecimal = (EditText) findViewById(R.id.editDecimal); final EditText editBinary = (EditText) findViewById(R.id.editBinary); Button buttonConvert = (Button) findViewById(R.id.buttonConvert); buttonConvert.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { int decimal = Integer.valueOf(editDecimal.getText().toString()); int binary; editBinary.setText(Integer.toBinaryString(binary)); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup containe…
has title: Decimal to Binary is not working
downvote count: 1
accepted answer: http://stackoverflow.com/a/24091544
type: Question

http://stackoverflow.com/comment/37119715
comment on: http://stackoverflow.com/a/24071089
type: Comment
has text: Oh! ok I guess I didn't understand varargs clearly. So essentially it sees the arguments as an array?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36972932
comment on: http://stackoverflow.com/a/23991331
score: 0
type: AnswerComment
type: Comment
has text: Thank you. But I´m not sure if it is what I need. I´ll try to explain it more precisely.

http://stackoverflow.com/comment/37181359
comment on: http://stackoverflow.com/a/24103723
has text: I have added my class that contains the ArrayLists. What would be the best way to implement what you have suggested?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36888262
comment on: http://stackoverflow.com/q/23947044
score: 0
has text: ok, you don't understand me, lets try another way, what is the length between `1/2/2014 and 1/3/2014` and `1/3/2014 and 1/4/2014`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37111706
comment on: http://stackoverflow.com/a/24066373
score: 0
type: AnswerComment
type: Comment
has text: The block of code is the code needed to do what user3560068 desires to do. I would add that pb.directory is essentially the replacement for cd but that seems fairly obvious.

http://stackoverflow.com/comment/36903297
type: QuestionComment
comment on: http://stackoverflow.com/q/23955413
score: 3
has text: @user3645570 OK then. If you need to make it ignore whitespace, then you can do File_1[i].ID.trim().equals(File_2[j].ID.trim())
type: Comment

http://stackoverflow.com/q/24078865
has title: Streaming online radio, too much work on the main thread
has comment: http://stackoverflow.com/comment/37136318
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37136423
has comment: http://stackoverflow.com/comment/37143120
has comment: http://stackoverflow.com/comment/37151197
has answer: http://stackoverflow.com/a/24088504
type: Question
has comment: http://stackoverflow.com/comment/37134466
tagged with: android-mediaplayer
has body: I'm trying to implement an online radio streaming in a simple app with a play and pause button. The only thing I'm doing in the onCreate() method is starting and stopping the service when the buttons are clicked, and the app is throwing a message when I start the service and the radio starts buffering saying "The app isn't working", with the options "close app/wait", and in the logCat it says the app is doing too much work on it's main thread. I can't understand why because all the hard work is being done in the service, not in the onCreate() method. My MainActivity: public class MainActivity extends Activity { ImageButton startButton; static Context context; boolean isPlaying; boolean playPause = false; Intent streamService; SharedPreferences prefs; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); startButton = (ImageButton) findViewById(R.id.music_controls); prefs = PreferenceManager.getDefaultSharedPreferences(context); getPrefs(); streamService = new Intent(MainActivity.this, StreamService.class); startButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (playPause) { stopService(streamService); startButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_play)); playPause = false; Log.d("Radio: ", "Stoping......"); }else { // TODO Auto-generated method stub Log.d("Radio: ", "Starting......"); startService(streamService); startButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_pause)); playPause = true; } } }); } public void onPrepared (MediaPlayer mp){ } public void getPrefs() { isPlaying = prefs.getBoolean("isPlaying", false); if (isPlaying) playPause = false; } } My Service: public class StreamServ…
tagged with: audio-streaming
has comment: http://stackoverflow.com/comment/37142030
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37134538
has comment: http://stackoverflow.com/comment/37151696
has comment: http://stackoverflow.com/comment/37139640
tagged with: android

http://stackoverflow.com/a/23991500
answers question: http://stackoverflow.com/q/23989625
has comment: http://stackoverflow.com/comment/36972946
has body: Actually any closed connection emits TcpConnectionCloseEvent and you can get deal with it using: &lt;int-event:inbound-channel-adapter channel="connectionClosedChannel" event-types="org.springframework.integration.ip.tcp.connection.TcpConnectionCloseEvent"/&gt; Having that you not only close connection, but can do any desired logic with that event-flow. UPDATE To use it from JavaConfig: @Bean public SmartApplicationListener tcpErrorListener() { ApplicationEventListeningMessageProducer producer = new ApplicationEventListeningMessageProducer(); producer.setEventTypes(TcpConnectionCloseEvent.class); producer.setOutputChannel(tcpErrorChannel()); return producer; } @Bean public MessageChannel tcpErrorChannel() { return new DirectChannel(); }
has comment: http://stackoverflow.com/comment/36974013
accepted answer of: http://stackoverflow.com/q/23989625
type: Answer
has comment: http://stackoverflow.com/comment/36972061
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36973038
has comment: http://stackoverflow.com/comment/36973239
has comment: http://stackoverflow.com/comment/36973010
has comment: http://stackoverflow.com/comment/36973111
has comment: http://stackoverflow.com/comment/36970768
has comment: http://stackoverflow.com/comment/36973132
has comment: http://stackoverflow.com/comment/36971408
has comment: http://stackoverflow.com/comment/36974504
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36975172
has comment: http://stackoverflow.com/comment/36973856
upvote count: 1
has comment: http://stackoverflow.com/comment/36973292

http://stackoverflow.com/comment/37109992
type: QuestionComment
comment on: http://stackoverflow.com/q/24064647
type: Comment
has text: @ericjets just to specify: by *full* code I don't mean *ALL* your code, but a new file created by you, with the less code as possible you can have in it, and that we can copy-paste and it's still compilable.
score: 0

http://stackoverflow.com/q/24007839
has comment: http://stackoverflow.com/comment/37001762
has answer: http://stackoverflow.com/a/24008054
type: AnsweredQuestion
has title: how to convert object of one type(Interface) to another(Interface)?
has body: I have an an interface Interface1 which has been implemented by class A and has some private variables value set and m sending the object of class A to next class which accepts input as Interface2. so how can i covert this object refering to Interface1 to Interface2? interface Interface1{} interface Interface2{} class A implements Interface1 { private int id; public void setId(int id) { this.id = id; } } class B { Interface1 call(Interface1 i) { C c = new C(); c.call2(i); //this should be of type Interface2 so how to do this return i; } public static void main(String arg[]) { Interface1 i = new A(); i.setId(5); B b = new B(); b.call(i); } } class c { Interface2 call2(Interface2 i) { return i; } }
type: Question
has answer: http://stackoverflow.com/a/24008101
tagged with: java
has comment: http://stackoverflow.com/comment/37001606
possible better answer: http://stackoverflow.com/a/24007908
has answer: http://stackoverflow.com/a/24007908
has answer: http://stackoverflow.com/a/24008034
score: 0
accepted answer: http://stackoverflow.com/a/24008101
answer count: 5
tagged with: interface
has answer: http://stackoverflow.com/a/24007944

http://stackoverflow.com/a/23986113
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23986088
has body: If you take a look at the JavaDocs, you will note there are two substring methods substring(int beginIndex) substring(int beginIndex, int endIndex) For your case, you probably only need the first one, for example... s1.substring(s1.length() - 4); Will return the last four characters of the String. You would simply need to use the same technique on the second String and compare the results I'm also not sure what the for-loop is trying to achieve...

http://stackoverflow.com/a/24092044
type: Answer
has body: Try using Canvas.drawPaint() function.
score: 0
answers question: http://stackoverflow.com/q/24091982

http://stackoverflow.com/a/24064842
answers question: http://stackoverflow.com/q/24043279
type: AcceptedAnswer
downvote count: 0
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/88987940
accepted answer of: http://stackoverflow.com/q/24043279
upvote count: 6
has body: The problem is caused by the chunking mechanism which gets enabled by CXF when the request size is beyond a threshold and which is not supported on server side. This chunking can be disabled programmatically but there is a bug in CXF which makes that programmatic configuration is not taken into account in case of SSL connection. The solution is to disable chunking via a spring configuration file.

http://stackoverflow.com/q/24053636
tagged with: character-encoding
type: Question
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/24053834
has title: Experience upside down question mark when trying to insert hypen into the database
has body: when tried to insert - or ' into the oracle database through java programming, the display turned out to be upside question mark ¿ in the place of '-'. Example it look like I¿ve joined a club of sorts. instead of I've joined a club of sorts. Input is through the text area and jsp coded as &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; using oracle.jdbc.driver.OracleDriver
score: 0
has comment: http://stackoverflow.com/comment/37087015
accepted answer: http://stackoverflow.com/a/24053834
has answer: http://stackoverflow.com/a/36069874
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/36069874
tagged with: java
tagged with: database

http://stackoverflow.com/comment/37159555
type: Comment
type: QuestionComment
score: 1
has text: To add to it, if the problem is just transferring the data-string to PHP, you can use AJAX to post it to your PHP and wait for a JSON response back giving the URL or whatever you need to the now saved image without needing to reload anything.
comment on: http://stackoverflow.com/q/24092475

http://stackoverflow.com/a/24087026
has body: Loop through the ArrayList and check each HashMap: for (HashMap map : arraylist) { if ("car2".equals(map.get("model"))) { System.out.println("index: " + arraylist.indexOf(map)); System.out.println("name: " + map.get("name")); break; } } The break was included under the assumption that only one model will be car2.
answers question: http://stackoverflow.com/q/24086817
score: 0
type: Answer

http://stackoverflow.com/q/24048907
has comment: http://stackoverflow.com/comment/37078667
has answer: http://stackoverflow.com/a/24049025
has comment: http://stackoverflow.com/comment/37078764
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24049008
tagged with: java
has answer: http://stackoverflow.com/a/24049008
has comment: http://stackoverflow.com/comment/37078645
tagged with: loops
has answer: http://stackoverflow.com/a/24049532
has comment: http://stackoverflow.com/comment/37078626
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/37078857
has answer: http://stackoverflow.com/a/24049044
has comment: http://stackoverflow.com/comment/37078635
has title: How can I check how many consonants and vowels there are in a sentence in Java?
has comment: http://stackoverflow.com/comment/37078617
has comment: http://stackoverflow.com/comment/37078636
has answer: http://stackoverflow.com/a/24049192
score: 4
has body: At the end of my loop, I am planning on displaying the number of consonants and vowels in the sentence. I was wondering if there was a more efficient way to check how many consonants and vowels are in a given sentence, rather than using an if statement and manually inputting every letter. (key refers to my Scanner which has already been initialized) Edit: It needs to ignore digits and other special characters, so for example if I write Hello@ how 1are you?. There should be 8 vowels and 6 consonants. System.out.println("Please enter the sentence to analyze: "); String words = key.nextLine(); //the sentence the user inputs int c = 0; //# of consonants int v = 0; //# of vowels int length = words.length(); //length of sentence int check; //goes over each letter in our sentence for(check = 0; check &lt; length; check++){ char a = words.charAt(check); if(a == 'a' || a == 'A' || a == 'e' || a == 'E' || a == 'i' || a == 'I' || a == 'o' || a == 'O' || a == 'u' || a == 'U' || a == 'y' || a == 'Y') v = v + 1; else if(a == 'b' || a == 'B' || a == 'c' || a == 'C' || a == 'd' || a == 'D' || a == 'f' || a == 'F' || a == 'g' || a == 'G' || a == 'h' || a == 'H' || a == 'j' || a == 'J' || a == 'k' || a == 'K' || a == 'l' || a == 'L' || a == 'm' || a == 'M' || a == 'n' || a == 'N' || a == 'p' || a == 'P' || a == 'q' || a == 'Q' || a == 'r' || a == 'r' || a == 's' || a == 'S' || a == 't' || a == 'T' || a == 'v' || a == 'V' || a == 'w' || a == 'W' || a == 'x' || a == 'X' || a == 'z' || a == 'Z') c = c + 1; }
has comment: http://stackoverflow.com/comment/37078745
has comment: http://stackoverflow.com/comment/37078802
has answer: http://stackoverflow.com/a/24049113
tagged with: char
has answer: http://stackoverflow.com/a/24049123
linked to: http://stackoverflow.com/q/19661199
downvote count: 0
has comment: http://stackoverflow.com/comment/37078632
answer count: 10
has answer: http://stackoverflow.com/a/24049158
has comment: http://stackoverflow.com/comment/37078660
has answer: http://stackoverflow.com/a/24049036
favorite count: 0
has answer: http://stackoverflow.com/a/29129203
has comment: http://stackoverflow.com/comment/37078652
has comment: http://stackoverflow.com/comment/37078763
has comment: http://stackoverflow.com/comment/37078735
accepted answer: http://stackoverflow.com/a/24049192
has comment: http://stackoverflow.com/comment/37078724

http://stackoverflow.com/q/24099695
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24099773
has body: When I start my application it works fine but as soon as I hit the button to take me to MakeRap.activity it crashes. I checked the activity of MakeRap and there seems to be no errors. Here is what log cat says: 06-07 11:57:09.173: I/Adreno200-EGLSUB(14785): &lt;ConfigWindowMatch:2087&gt;: Format RGBA_8888. 06-07 11:57:09.203: D/memalloc(14785): ion: Mapped buffer base:0x52531000 size:2088960 offset:0 fd:60 06-07 11:57:09.203: D/OpenGLRenderer(14785): Enabling debug mode 0 06-07 11:57:09.503: D/memalloc(14785): ion: Mapped buffer base:0x52ea4000 size:2088960 offset:0 fd:64 06-07 11:57:10.955: D/AndroidRuntime(14785): Shutting down VM 06-07 11:57:10.955: W/dalvikvm(14785): threadid=1: thread exiting with uncaught exception (group=0x40aaea08) 06-07 11:57:10.975: E/AndroidRuntime(14785): FATAL EXCEPTION: main 06-07 11:57:10.975: E/AndroidRuntime(14785): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.soloinc.meip/com.soloinc.meip.MakeRapActivity}: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2225) 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2260) 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.app.ActivityThread.access$600(ActivityThread.java:139) 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1277) 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.os.Handler.dispatchMessage(Handler.java:99) 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.os.Looper.loop(Looper.java:156) 06-07 11:57:10.975: E/AndroidRuntime(14785): at android.app.ActivityThread.main(ActivityThread.java:5045) 06-07 11:57:10.975: E/AndroidRuntime(14785): at java.lang.reflect.Method.invokeNative(Native Method) 06-07 11:57:10.975: E/AndroidRuntime(14785): at java.lang.reflect.Method.invoke(Method.java…
accepted answer: http://stackoverflow.com/a/24099773
has comment: http://stackoverflow.com/comment/37172732
score: 0
has title: My app keeps crashing on me and cant seem to find any errors
answer count: 1
has comment: http://stackoverflow.com/comment/37172777
tagged with: android
has comment: http://stackoverflow.com/comment/37172717
has comment: http://stackoverflow.com/comment/37172757
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24029455
has comment: http://stackoverflow.com/comment/37043600
score: 0
has comment: http://stackoverflow.com/comment/37044099
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37044195
tagged with: java
has body: I have a powershell command in java as follows: private static final String GET_OBJECT = "powershell -Command \"&amp; {Get-WmiObject -Class %s -Computername %s -Namespace root\\%s} | Format-List -property [a-z]*\""; I want to use a separate variable as private static final String GET_CREDENTIAL = "powershell -Command \"&amp; {Get-Credential}\""; and substitute the GET_CREDENTIAL in GET_OBJECT How can i do this? I want something like this private static final String GET_OBJECT = "powershell -Command \"&amp; {Get-WmiObject -Class %s -Computername %s -credential GET_CREDENTIAL -Namespace root\\%s} | Format-List -property [a-z]*\"";
type: Question
tagged with: powershell
has title: Form powershell command in Java using java variable

http://stackoverflow.com/q/24019444
has comment: http://stackoverflow.com/comment/37022914
has title: I'm making a simple calculator and the GUI build keeps freezing
has answer: http://stackoverflow.com/a/24019615
upvote count: 2
answer count: 2
tagged with: user-interface
tagged with: calculator
favorite count: 0
has comment: http://stackoverflow.com/comment/37022969
has body: import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Color; import javax.swing.JLabel; public class Calculator extends JFrame implements ActionListener { private JPanel contentPane; JButton button, btnNewButton, button_1, button_2, button_3, button_4, button_5, button_6, button_7, button_8, btnClear, btnNewButton_1, button_9, btnX, button_11; JLabel lblNewLabel; int v1 = 0; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Calculator frame = new Calculator(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Calculator() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 250, 415); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); btnNewButton = new JButton("7"); btnNewButton.setBounds(10, 130, 52, 37); contentPane.add(btnNewButton); btnNewButton.setActionCommand("7"); btnNewButton.addActionListener(this); button = new JButton("8"); button.setBounds(72, 130, 52, 37); contentPane.add(button); button.setActionCommand("8"); button.addActionListener(this); button_1 = new JButton("9"); button_1.setBounds(134, 130, 52, 37); contentPane.add(button_1); button_1.setActionCommand("9"); button_1.addActionListener(this); button_2 = new JButton("6"); button_2.setBounds(134, 178, 52, 37); contentPane.add(button_2); button_2.setActionCommand("6"); button_2.addActionListener(this); button_3 = new JButton("5"); button_3.setBounds(72, 178, 52, 37); contentPane.add(button_3); button_3.setActionCommand("5"); button_3.addActionListener(this); button_4 = new JButton("4"); button_4.setBounds(10, 178, 52, 37); contentPane.add(button_4); button_4.setActi…
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37022974
tagged with: swing
possible better answer: http://stackoverflow.com/a/24019615
has answer: http://stackoverflow.com/a/24019476
accepted answer: http://stackoverflow.com/a/24019476
type: Question

http://stackoverflow.com/comment/37030736
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23983342
has text: @AlessandroSuglia If you've got `select distinct` there, you shouldn't be getting duplicate results. What duplicate results do you get?

http://stackoverflow.com/comment/36998717
comment on: http://stackoverflow.com/q/23987849
score: 0
has text: @Antrromet The error is occuring in a completely unedited new Android project, so the mistake cannot be in the code.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37007403
type: QuestionComment
has text: Have tried with true in following line ? profile.setAssumeUntrustedCertificateIssuer(true);
comment on: http://stackoverflow.com/q/23979787
score: 0
type: Comment

http://stackoverflow.com/q/24094045
favorite count: 0
upvote count: 2
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/24094074
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I currently have a JFrame created by NetBeans. Most of the time, when I run the program it works completely fine -- the GUI appears, the components are correct, the values I set are correct, etc. Every so often, however, the GUI will fail to appear. Just... Doesn't appear. There's just no frame that appears. What's worse is that Java still returns true for JFrameInstance.isVisible() and forces me to manually kill the program. In other words, the program doesn't stop. I have yet to find an answer for this. My code, sans the excess setup code: public class Setup extends javax.swing.JFrame { /** Creates new form Setup */ public Setup() { initComponents(); customComponents(); setVisible(true); } private void customComponents() { setTitle("Setup"); setPatchNotesText(Browser.getVersionNotes()); jSlider1.setValue(SettingsHandler.getDelayTime()); jCheckBox1.setSelected(SettingsHandler.getCheckPaxWebsite()); //More of the same type of code... } public void setPatchNotesText(final String text) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jTextArea4.setText(text); jTextArea4.setCaretPosition(0); } }); } private void initComponents() { jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); //Lots more component construction... jLabel5.setText("Setup Options"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() //....Begin the huge NetBeans GUI setup code. Removed for readability. } } And the code in the main() method... public static void main(String[] args) throws Exception { System.out.println("Initializing..."); Browser.init(); Email.init(); setup = new Setup(); while (setup.isVisible()) { // Returns true... Thread.sleep(100); } //More …
accepted answer: http://stackoverflow.com/a/24094074
answer count: 1
has title: JFrame sometimes not appearing at all?

http://stackoverflow.com/a/24104427
has comment: http://stackoverflow.com/comment/82288463
downvote count: 2
has comment: http://stackoverflow.com/comment/101458592
has comment: http://stackoverflow.com/comment/83216686
has comment: http://stackoverflow.com/comment/101579266
has comment: http://stackoverflow.com/comment/83217608
score: 1168
upvote count: 1170
has body: If you want to pause then use java.util.concurrent.TimeUnit: TimeUnit.SECONDS.sleep(1); To sleep for one second or TimeUnit.MINUTES.sleep(1); To sleep for a minute. As this is a loop, this presents an inherent problem - drift. Every time you run code and then sleep you will be drifting a little bit from running, say, every second. If this is an issue then don't use sleep. Further, sleep isn't very flexible when it comes to control. For running a task every second or at a one second delay I would strongly recommend a ScheduledExecutorService and either scheduleAtFixedRate or scheduleWithFixedDelay. For example, to run the method myTask every second (Java 8): public static void main(String[] args) { final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleAtFixedRate(App::myTask, 0, 1, TimeUnit.SECONDS); } private static void myTask() { System.out.println("Running"); } And in Java 7: public static void main(String[] args) { final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { myTask(); } }, 0, 1, TimeUnit.SECONDS); } private static void myTask() { System.out.println("Running"); }
accepted answer of: http://stackoverflow.com/q/24104313
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24104313
has comment: http://stackoverflow.com/comment/101458537
has comment: http://stackoverflow.com/comment/82296601
type: Answer
has comment: http://stackoverflow.com/comment/117213866

http://stackoverflow.com/comment/40817690
type: Comment
has text: The property definition and replaceStringWithRegexp are superfluous, use pathconvert instead : '<pathconvert property="result" refid="myFileSet"pathsep=" --nomunge --preserve-semi ">' or even with nested fileset '<pathconvert property="result" pathsep=" --nomunge --preserve-semi "><fileset ...></pathconververt>'
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26051049

debugging
tags question: http://stackoverflow.com/q/24066726
tags question: http://stackoverflow.com/q/24097136
tags question: http://stackoverflow.com/q/24008938
tag name: debugging
tags question: http://stackoverflow.com/q/24051369
type: Tag
tags question: http://stackoverflow.com/q/24058908
tags question: http://stackoverflow.com/q/24008912
tags question: http://stackoverflow.com/q/24083016
tags question: http://stackoverflow.com/q/24010810

http://stackoverflow.com/comment/37094801
score: 1
type: AnswerComment
has text: Lol never knew it would eventually be this simple.
type: Comment
comment on: http://stackoverflow.com/a/24057793

http://stackoverflow.com/comment/37144111
score: 1
has text: Take a look at the Java Reflection tutorial at Oracle: http://docs.oracle.com/javase/tutorial/reflect/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24084693

http://stackoverflow.com/a/24091186
has comment: http://stackoverflow.com/comment/37160808
type: Answer
answers question: http://stackoverflow.com/q/24090529
upvote count: 1
has comment: http://stackoverflow.com/comment/37164688
accepted answer of: http://stackoverflow.com/q/24090529
score: 1
has body: Maybe the problem is in the byte order. I have an application which send from a tablet (java) to a C# application (Windows Intel), I used similar to what you've done, except in the following ByteBuffer iLength = ByteBuffer.allocate(4); iLength.order(ByteOrder.LITTLE_ENDIAN); iLength.putInt(length); output.write(iLength.array(), 0, 4); output.write(buffer); output.flush(); Java uses BIG-ENDIAN and Intel uses LITTLE-ENDIAN bytes order.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36960688
comment on: http://stackoverflow.com/a/23986036
score: 0
type: AnswerComment
has text: does it includes ".jar" at the end?
type: Comment

http://stackoverflow.com/a/23960859
upvote count: 0
answers question: http://stackoverflow.com/q/23960451
type: Answer
downvote count: 1
has body: My thinking is that even though you have different users, the JVM still reads tomcat as one user since it's the same process. Perhaps what you need is a user management mechanism? Log in and log out
score: -1

http://stackoverflow.com/comment/37097224
comment on: http://stackoverflow.com/q/24058968
score: 0
type: Comment
type: QuestionComment
has text: To get the right hand side of the cursor and put it into another string.

http://stackoverflow.com/comment/36920433
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23964114
has text: It works. I needed to delete code generated by NetBeans

http://stackoverflow.com/comment/36935687
type: Comment
type: QuestionComment
has text: Have you considered [`onDestroy()`](http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle)?
comment on: http://stackoverflow.com/q/23973115
score: 0

http://stackoverflow.com/comment/36980794
score: 0
type: Comment
has text: oh so i should find free cloud hosting servers which supports tomcat
comment on: http://stackoverflow.com/a/23995644
type: AnswerComment

http://stackoverflow.com/comment/37084103
type: AnswerComment
comment on: http://stackoverflow.com/a/24051864
score: 0
type: Comment
has text: I had misunderstood the question. I did not take the overlapping scenario into account. My code only calculates the date difference.

http://stackoverflow.com/comment/36988987
has text: - If one of the answers below was particularly helpful, select the check symbol next to that answer, or click the up arrow, or both :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23976995
score: 0

http://stackoverflow.com/q/24103232
has title: Serializing a POJO with only fields that are modified?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24103388
tagged with: java
type: Question
tagged with: pojo
has body: I have a bunch of POJOs I want to serialize / deserialize to JSON. However, I'm selectively reading only some of the fields from cassandra. So when I serialize the object to JSON, I only want those objects that were read from the database. So all setters need to code to track that the member has been mutated/defined. That way when I go to serialize, only the modified fields are included. I have dozens of fields in this schema so I'd prefer to not have to write the setters directly. Are there any POJO frameworks that do this for me? there's no 'undefined' in Java so the default is 'null' unfortunately...
accepted answer: http://stackoverflow.com/a/24103388
score: 0
answer count: 1
tagged with: serialization

http://stackoverflow.com/q/23967770
tagged with: java
downvote count: 2
tagged with: prepared-statement
type: Question
has comment: http://stackoverflow.com/comment/36926917
score: -2
answer count: 2
upvote count: 0
favorite count: 0
tagged with: postgresql
has answer: http://stackoverflow.com/a/23979776
has title: ResultSet not positioned properly, perhaps you need to call next in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/134666800
has answer: http://stackoverflow.com/a/23967986
has body: I am getting ResultSet not positioned properly, perhaps you need to call next in java error when i try execute following code. Please anyone help me PreparedStatement m_inoutid = null; docno="[101,102,103,104]"; String minoutid[]=new String[1000]; String documentno = docno.substring(1, docno.length() - 1); List&lt;String&gt; docnumbers = new ArrayList&lt;String&gt;(); String[] split = documentno.split(","); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; split.length; i++) { String sql = "select id from mytable where fid=?"; outid = conn.prepareStatement(sql); String idfromquery=split[i]; outid.setString(1, idfromquery); ResultSet idResultSet = outid.executeQuery(); idResultSet.next(); id = idResultSet.getString("id"); final List&lt;Object&gt; parameters = new ArrayList&lt;Object&gt;(); parameters.add(null); parameters.add(id); myfunction(parameters); }

http://stackoverflow.com/q/23985661
has comment: http://stackoverflow.com/comment/36959990
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: multithreading
has title: Cancel an operation on Toast
downvote count: 1
has comment: http://stackoverflow.com/comment/36959984
has answer: http://stackoverflow.com/a/23985792
type: Question
has body: I wrote a JSoup HTML scraping class for my Android project. This custom class puts the user-inputted zip code into the constructor, and would parse that HTML. It works in an asynchronous thread from my main thread. Since there is no right way to deal with incorrect zip codes, I had check for null in a particular element, specifically: if(doc.select("div.columns").first().text() == null) { ((Activity) context).runOnUiThread(new Runnable() { public void run() { Toast toast = Toast.makeText(context, R.string.toast_parse_fail, Toast.LENGTH_LONG); toast.show(); return; } }); } If that particular element is null (meaning that no such data exists for this zip code), it would create a toast to the user. As to why try wouldn't work in this case, it is because JSoup and Java doesn't know whether the parse failed or not, since the web page still loads fine; only, there is no data, which would crash the app from a NullPointerException from the code following it. Despite my Toast exception handling using .runOnUiThread, my app would still crash. Is there any particular methods that would cancel the operations that follow my null-checking method? I know I am crashing because Toast is not cancelling my operations, and is preceding to execute the following code which causes my NullPointerExceptions. Posted is my full Pollen constructor. public Pollen(int zipcode, final Context context) { this.context = context; this.zipcode = zipcode; Document doc; try { // pass address to Wunderground's website using our inputted zipcode doc = Jsoup.connect("http://www.wunderground.com/DisplayPollen.asp?Zipcode=" + this.zipcode).get(); if(doc.select("div.columns").first().text() == null) { ((Activity) context).runOnUiThread(new Runnable() { public void run() { Toast toast = Toast.makeText(context, R.string.toast_parse_fail, Toast.LENGTH_LONG); toast.show(); return; } }); } // get "location" from XML Element location = doc.select("div.columns").first(); this.location = location.text(); // get "poll…
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/23985792
linked to: http://stackoverflow.com/q/4395062
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/37187488
type: AnswerComment
type: Comment
score: 1
has text: Then it depends on the app-server configuration, from where the user population is loaded and how role mapping is processed. The standard deployment descriptor `web.xml` usually covers most of the needs. But for advanced configuration may be necessary to add a vendor specific deployment descriptor (e.g. `jboss-web.xml`, weblogic.xml)
comment on: http://stackoverflow.com/a/24103550

http://stackoverflow.com/q/23975708
has body: I've an issue with my class ListFromFile&lt;T&gt; which extends ArrayList&lt;T&gt;. In that class, i would like to make a method that finds an element by its id attribute and returns it. The T could be an object from the classes Student, Teacher etc. All these classes have a equals method that tests the id. My problem is that i can't use the equals method which test the id in ListFromFile. Here is my code : public class ListFromFile&lt;T&gt; extends ArrayList&lt;T&gt; implements Serializable { public T getElement(int id) { for ( T o : this ) { if ( o.equals((int)id) ) { return o; } } return null; } } Even if i specify in the equals method i'm working with an id which is an int, getElement() doesn't find the element ... After some searches, it seems that i have to extend T by Student, Teacher etc., but how to extends multiples classes ? Thank you
score: 0
has answer: http://stackoverflow.com/a/23975750
has title: Java - How to call a method of my class T in a generic class
has answer: http://stackoverflow.com/a/23975752
tagged with: generics
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36940952
has comment: http://stackoverflow.com/comment/36940994
possible better answer: http://stackoverflow.com/a/23975750
tagged with: java
tagged with: methods
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36941011
has comment: http://stackoverflow.com/comment/36940957
accepted answer: http://stackoverflow.com/a/23975752

http://stackoverflow.com/q/24030747
has title: Loading same value in inner HashMap
tagged with: java
duplicate of: http://stackoverflow.com/q/602636
has comment: http://stackoverflow.com/comment/37044787
type: Question
score: 0
answer count: 1
has body: I am trying to enter the below statement into HashMap Input Line: Rainy#No:2 Sunny#No:3 Rainy#Yes:3 Sunny#Yes:2 Overcast#Yes:4 Expected Output:{Rainy={No=2,Yes=3},Rainy={No=3,Yes=2},Overcast={Yes=4}} What I did so far is import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; public class StackHash{ /** *@paramargs */ staticConcurrentMap&lt;String,HashMap&lt;String,Integer&gt;&gt;map=newConcurrentHashMap&lt;&gt;(); public static final String TAB="\t"; public static final String SPACE=" "; public static final String HASH="#"; public static final String COLON=":"; public static void main(String[]args){ //TODOAuto-generatedmethodstub Stringline="Rainy#No:2 Sunny#No:3 Rainy#Yes:3 Sunny#Yes:2 Overcast#Yes:4"; StringTokenizerst=newStringTokenizer(line,SPACE); HashMap&lt;String,Integer&gt;attibuteCollect=newHashMap&lt;String,Integer&gt;(); while(st.hasMoreTokens()){ Stringtoken1=st.nextToken(); String[]parts=token1.split(HASH); String[]parts1=parts[1].split(COLON); attibuteCollect.put(parts1[0],Integer.parseInt(parts1[1])); if(map.isEmpty()){ map.put(parts[0],attibuteCollect); } else{ for(Map.Entry&lt;String,HashMap&lt;String,Integer&gt;&gt;entry:map.entrySet()){ StringkeyMap=entry.getKey(); if(keyMap.equals(parts[0])){ map.put(keyMap,attibuteCollect); } else{ map.put(parts[0],attibuteCollect); } } } } System.out.println("finalmap"+map); } } Output map {Rainy={Yes=4, No=3}, Sunny={Yes=4, No=3}, Overcast={Yes=4, No=3}} Am I doing anything wrong. Please Suggest.
has comment: http://stackoverflow.com/comment/37044733
has answer: http://stackoverflow.com/a/24030843
tagged with: dictionary
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37044916
has comment: http://stackoverflow.com/comment/37044281
linked to: http://stackoverflow.com/q/602636
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37045035
has comment: http://stackoverflow.com/comment/37045555

http://stackoverflow.com/a/28120362
type: Answer
has body: If the first view remains under the new one, maybe the xml file associated with the new fragment doesn't have a background defined and it might be transparent. Try to define android:background in the root element of the new view. For the fragment id question, I think it's not possible to recover the id. You could store it in a global variable, or you can use string tags in order to identify the fragments, like it's done here: get the latest fragment in backstack
score: 0
answers question: http://stackoverflow.com/q/24044963

http://stackoverflow.com/comment/37181200
has text: I do not know the number of values that can be passed hence the need to create this method to do this auto conversion
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24103623

sockets
tags question: http://stackoverflow.com/q/23949812
tags question: http://stackoverflow.com/q/23981269
tags question: http://stackoverflow.com/q/23963122
tags question: http://stackoverflow.com/q/24090529
tags question: http://stackoverflow.com/q/24022612
tags question: http://stackoverflow.com/q/24048522
tags question: http://stackoverflow.com/q/24009149
tags question: http://stackoverflow.com/q/24082285
tags question: http://stackoverflow.com/q/23983847
tags question: http://stackoverflow.com/q/23959321
tags question: http://stackoverflow.com/q/23990924
tags question: http://stackoverflow.com/q/24079714
tags question: http://stackoverflow.com/q/24087196
tags question: http://stackoverflow.com/q/23983298
tags question: http://stackoverflow.com/q/24049748
tags question: http://stackoverflow.com/q/24055947
tags question: http://stackoverflow.com/q/23984901
tags question: http://stackoverflow.com/q/24018032
tags question: http://stackoverflow.com/q/23996083
tags question: http://stackoverflow.com/q/24057965
tags question: http://stackoverflow.com/q/24103419
tags question: http://stackoverflow.com/q/23965202
tags question: http://stackoverflow.com/q/24097007
tags question: http://stackoverflow.com/q/24097855
tags question: http://stackoverflow.com/q/23966640
tags question: http://stackoverflow.com/q/24088734
type: Tag
tags question: http://stackoverflow.com/q/24032779
tags question: http://stackoverflow.com/q/24028578
tags question: http://stackoverflow.com/q/24048668
tags question: http://stackoverflow.com/q/23942204
tags question: http://stackoverflow.com/q/24091521
tags question: http://stackoverflow.com/q/24022769
tags question: http://stackoverflow.com/q/23990299
tags question: http://stackoverflow.com/q/23955638
tags question: http://stackoverflow.com/q/24089812
tags question: http://stackoverflow.com/q/24034767
tags question: http://stackoverflow.com/q/24078587
tags question: http://stackoverflow.com/q/23954628
tags question: http://stackoverflow.com/q/24100469
tags question: http://stackoverflow.com/q/23959801
tags question: http://stackoverflow.com/q/23967323
tags question: http://stackoverflow.com/q/24076509
tags question: http://stackoverflow.com/q/24061041
tags question: http://stackoverflow.com/q/24005184
tags question: http://stackoverflow.com/q/23953904
tags question: http://stackoverflow.com/q/24027090
tags question: http://stackoverflow.com/q/23945316
tags question: http://stackoverflow.com/q/24025029
tags question: http://stackoverflow.com/q/23994344
tags question: http://stackoverflow.com/q/23953060
tags question: http://stackoverflow.com/q/24055975
tag name: sockets
tags question: http://stackoverflow.com/q/24047045
tags question: http://stackoverflow.com/q/23966365
tags question: http://stackoverflow.com/q/24087576
tags question: http://stackoverflow.com/q/24050948
tags question: http://stackoverflow.com/q/24041441
tags question: http://stackoverflow.com/q/23989625
tags question: http://stackoverflow.com/q/23995161
tags question: http://stackoverflow.com/q/23996419
tags question: http://stackoverflow.com/q/24082077
tags question: http://stackoverflow.com/q/24096710
tags question: http://stackoverflow.com/q/24041876
tags question: http://stackoverflow.com/q/24027542
tags question: http://stackoverflow.com/q/23976031
tags question: http://stackoverflow.com/q/23994234
tags question: http://stackoverflow.com/q/23956141
tags question: http://stackoverflow.com/q/24037463

http://stackoverflow.com/q/24040084
favorite count: 0
has title: "406 Not Acceptable" when trying to configure XML marshalling over HTTP for a Spring Web MVC service
has answer: http://stackoverflow.com/a/24355331
has comment: http://stackoverflow.com/comment/37081546
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-serialization
has body: A toy example that captures the issue I am having is on github. In a nutshell I have a service that needs to marshal XML back over HTTP. I am trying to set that up using Spring Web MVC. The response object that needs to get marshalled back is JAXB2-generated from a schema (thus is missing @XmlRootElement tag but the package where it is generated has an ObjectFactory which provides the means to generate JAXBElement-s, which make XML marshallers happy). I tried different spring context configurations based on Google searches, which mostly hit posts here on stack overflow, but could not get any of them to work for me. Environment: Spring 4.0.5. Tomcat 7.0.5X. Here's a request/response cycle example that shows the problem (some of the output has been omitted): $ curl -v -X GET -H "Accept: application/xml" http://localhost:8080/sotaro/say/boo * Connected to localhost (::1) port 8080 (#0) > GET /sotaro/say/boo HTTP/1.1 > User-Agent: curl/7.30.0 > Host: localhost:8080 > Accept: application/xml > < HTTP/1.1 406 Not Acceptable * Server Apache-Coyote/1.1 is not blacklisted < Server: Apache-Coyote/1.1 < Content-Type: text/html;charset=utf-8 < Content-Language: en < Content-Length: 1067 < Date: Wed, 04 Jun 2014 12:48:44 GMT < HTTP Status 406 - message description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers. Here are the toy example's modules. One of the context configs I tried: <?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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:oxm="http://www.springframework.org/schema/oxm" xsi:schemaLoc…
upvote count: 3
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37081419
type: Question
has comment: http://stackoverflow.com/comment/37069990
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37073633

http://stackoverflow.com/comment/37168256
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24087196
score: 0
has text: in `Activity#onStart()` callback, but I'm not narrowing it down specifically for Android, but I want to know about the java framework itself.

http://stackoverflow.com/comment/36878280
comment on: http://stackoverflow.com/q/23941947
type: Comment
type: QuestionComment
score: 0
has text: `"My code is convoluted, so I can post it, but if there's a simple fix then there isn't the need."` -- I doubt that anyone will be able to help you with this small bit of information. You've got a bug in your code, and so will need to show your code. The only exception is if you're not calling the super method in your paint (or better, paintComponent) method override. I think that you'll need to simplify your code and post the pertinent code, preferably a [minimal example program](http://stackoverflow.com/help/mcve).

http://stackoverflow.com/q/24009733
has comment: http://stackoverflow.com/comment/37019747
has comment: http://stackoverflow.com/comment/37017183
has comment: http://stackoverflow.com/comment/37055353
upvote count: 1
has comment: http://stackoverflow.com/comment/37045148
answer count: 1
has comment: http://stackoverflow.com/comment/37005903
has comment: http://stackoverflow.com/comment/37039520
has comment: http://stackoverflow.com/comment/37021986
favorite count: 0
has comment: http://stackoverflow.com/comment/37005228
has comment: http://stackoverflow.com/comment/37020572
has answer: http://stackoverflow.com/a/30196257
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/48455365
has comment: http://stackoverflow.com/comment/37005621
has comment: http://stackoverflow.com/comment/37017943
has body: I'm having problems handling http erros on &lt;int-ws:outbound-gateway&gt; I tried placing a error-channel on &lt;int:gateway&gt;, but it doesn't seem to work, because I get unmarshalling exceptions. Plus I feel it's not right, http errors should be caught somewhere after the message is received from &lt;int-ws:outboung-gateway&gt; My messaging system is set up like this: &lt;int:gateway&gt; -&gt; channel -&gt; transformer -&gt; channel -&gt; &lt;int-ws:outboung-gateway&gt; Question: what's the right way to catch http errors with spring integration? AFTER EDIT &lt;int:channel id="checkProcessRequestChannel"/&gt; &lt;int:channel id="checkProcessResponseChannel"/&gt; &lt;int:channel id="errorChannel"/&gt; &lt;!-- channels for connecting to the outbound gateway --&gt; &lt;int:channel id="checkProcessOutboundRequestChannel"/&gt; &lt;int:channel id="checkProcessOutboundResponseChannel"/&gt; &lt;int:gateway id="eInvoiceGateway" service-interface="com.iquest.play.integration.einvoice.EInvoiceGateway" error-channel="errorChannel"&gt; &lt;int:method name="checkProcessByCode" request-channel="checkProcessRequestChannel" reply-channel="checkProcessResponseChannel"/&gt; &lt;int:gateway&gt; &lt;int:transformer ref="eInvoiceTransformer" method="transformCheckProcessRequest" input-channel="checkProcessRequestChannel" output-channel="checkProcessOutboundRequestChannel"/&gt; &lt;int:transformer ref="eInvoiceTransformer" method="transformCheckProcessResponse" input-channel="checkProcessOutboundResponseChannel" output-channel="checkProcessResponseChannel"/&gt; &lt;int-ws:outbound-gateway id="checkClientByCodeOutboundGW" request-channel="checkProcessOutboundRequestChannel" reply-channel="checkProcessOutboundResponseChannel" marshaller="eInvoiceMarshaller" unmarshaller="eInvoiceMarshaller" destination-provider="eInvoiceUriProvider" message-factory="eInvoiceMessageFactory" /&gt; FIX: So, after placing a error-channel on the gateway, the thread was getting stuck somewhere. It was a pretty…
tagged with: web-services
tagged with: spring-integration
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37020930
has title: Handle Http errors with spring integration on int-ws:outbound-gateway
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/37005329

http://stackoverflow.com/a/23975490
score: 1
accepted answer of: http://stackoverflow.com/q/23975374
answers question: http://stackoverflow.com/q/23975374
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: Your code counts the number of spaces and uses that to infer the number of words. Unfortunately, this approach only works if there is exactly one space between each word, and no leading or trailing spaces. It also assumes that there is only one kind of space character, and that's not true either. (Aside: If you are reading text typed by a user, it is unrealistic to expect that they always put exactly one space between each word, and nowhere else. Even if the specification says that they will / should do that.) A simple but more robust alternative is to: trim the string to remove leading / trailing whitespace use String.split to split the string, supplying a simple regex for the "stuff between words"; e.g. "\\s+" says "one or more whitespace characters", return the length of the resulting array of words.

http://stackoverflow.com/q/24009159
upvote count: 2
possible better answer: http://stackoverflow.com/a/24009279
has answer: http://stackoverflow.com/a/24009279
tagged with: swing
has answer: http://stackoverflow.com/a/24009194
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has answer: http://stackoverflow.com/a/24009452
tagged with: java
has title: Java Swing. Opening a new JPanel from a JButton and making the buttons pretty
tagged with: jpanel
type: Question
has comment: http://stackoverflow.com/comment/37005656
linked to: http://stackoverflow.com/q/9554636
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/45356805
has body: I am trying to build a little program that has a main GUI with 2 buttons. One button closes the program, the other I want to open a new JPanel that will have text fields etc. I would like to be able to make the buttons so they look like normal application buttons I guess, nice and square, equal size etc. etc., I am not sure how to do this though. Also, I am unsure how to open a new JFrame from a button click. GUI Code: package practice; public class UserInterface extends JFrame { private JButton openReportSelection = new JButton("Open new Window"); private JButton closeButton = new JButton("Close Program"); private JButton getCloseButton() { return closeButton; } private JButton getOpenReportSelection() { return openReportSelection; } public UserInterface() { mainInterface(); } private void mainInterface() { setTitle("Program Information Application"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel centerPanel = new JPanel(new GridLayout(0, 3)); centerPanel.add(openReportSelection); centerPanel.add(closeButton); getCloseButton().addActionListener(new Listener()); add(centerPanel, BorderLayout.CENTER); setSize(1000, 200); setVisible(true); } private void addReportPanel() { JPanel reportPanel = createNewPanel(); getContentPane().add(reportPanel, BorderLayout.CENTER); } private JPanel createNewPanel() { JPanel localJPanel = new JPanel(); localJPanel.setLayout(new FlowLayout()); return localJPanel; } } ActionListener Class code: package practice; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Listener implements ActionListener { public void actionPerformed(ActionEvent ae) { System.exit(0); } } EDIT: I think opening a new JPanel would be the way to go rather than a JFrame. What would be the best way to do this from a Jbutton click?
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/24009194
downvote count: 0
has comment: http://stackoverflow.com/comment/37004207
favorite count: 0
answer count: 4
tagged with: netbeans

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/24053040
tags question: http://stackoverflow.com/q/24026909
tag name: bytecode-manipulation

http://stackoverflow.com/a/23954326
downvote count: 0
has comment: http://stackoverflow.com/comment/36928327
answers question: http://stackoverflow.com/q/23952445
has comment: http://stackoverflow.com/comment/36903142
has comment: http://stackoverflow.com/comment/36901569
score: 1
has comment: http://stackoverflow.com/comment/36933094
upvote count: 1
has comment: http://stackoverflow.com/comment/37125893
has comment: http://stackoverflow.com/comment/36902705
has comment: http://stackoverflow.com/comment/36901286
type: Answer
has body: How about writing it into a ZipOutputStream where you can receive the file on the other side as a single stream. Once you have the entire output, you can write the reverse code to deflate the zip file and get all the files. Providing a sample code for writing the Zip into your socket stream, you can build your code over this. Refer this length for a sample Server and Client implementation sending the file using a ZipOutputStream Stick2Code
has comment: http://stackoverflow.com/comment/36902759

http://stackoverflow.com/comment/37195451
has text: If you want to do something more clever around the Ref<?>, you could check the Ref.isLoaded() state before you return a value. But keep in mind this checks the state of the session, so if the value had been loaded earlier in the request it will return true.
comment on: http://stackoverflow.com/q/24102897
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24070395
favorite count: 0
has answer: http://stackoverflow.com/a/24070458
upvote count: 5
tagged with: cpu-usage
type: UnansweredQuestion
downvote count: 0
tagged with: java
has body: I have standard Eclipse Kepler with CDT installed. Sometimes when it stays idle for a while the javaw.exe starts eating the CPU up to 30%. Nothing is running in Eclipse, no indexing, no library update, no building or compiling. How can I debug Eclipse to see if something is running in background? Does Eclipse have any console or log so I can see what exactly is being done? Not to mention, I even restarted the Eclipse but it just works for a few moment and then again reaches high CPU usage. What could be the problem? Windows 7 64bit Eclipse Kepler standard (plugins ADT &amp; CDT) Java 7
tagged with: eclipse
tagged with: javaw
type: Question
score: 5
has comment: http://stackoverflow.com/comment/37118673
has comment: http://stackoverflow.com/comment/37118221
has comment: http://stackoverflow.com/comment/37118641
has comment: http://stackoverflow.com/comment/37118566
has comment: http://stackoverflow.com/comment/37118243
answer count: 1
has comment: http://stackoverflow.com/comment/37118288
has comment: http://stackoverflow.com/comment/37118362
has comment: http://stackoverflow.com/comment/37118309
has title: Eclipse "javaw.exe" High CPU usage

http://stackoverflow.com/comment/37021284
score: 0
type: Comment
type: QuestionComment
has text: Is it expected that your algorithm teleports the snake in case it goes out of bounds instead of doing the classical world-wrap? Because the latter can be done in a single line instead of the for loop you have...
comment on: http://stackoverflow.com/q/24018150

http://stackoverflow.com/comment/36984107
type: Comment
has text: How do I get the methods from the implemented interface? I can get the `TypeReference` of `element.implementedInterfaces`. But how do I get the methods declared by the referenced interface?
comment on: http://stackoverflow.com/a/23997937
type: AnswerComment
score: 0

http://stackoverflow.com/comment/45310741
score: 2
has text: The documentation of `Image.write` states : This method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream, if desired. Which suggests to me it is necessary to either close the ByteArrayOutputStream or use a try-with-ressource block.
type: AnswerComment
comment on: http://stackoverflow.com/a/24038735
type: Comment

http://stackoverflow.com/comment/36956880
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23983964
has text: @LuiggiMendoza: Well, then use the most common ones, let's say top ten TIOBE index. Of course, I don't care about esotheric stuff, I just want to be safe in all languages that are currently of major use.
score: 0

http://stackoverflow.com/q/24045840
answer count: 1
has comment: http://stackoverflow.com/comment/37072771
has answer: http://stackoverflow.com/a/24045978
tagged with: string
has comment: http://stackoverflow.com/comment/37072943
has body: So I did some changes (The generateCsvFile that is giving me the null's is the one at the bottom, I removed the one in my Test() method) but It still says null private class thehandler implements ActionListener { public void actionPerformed(ActionEvent e) { if (e.getSource().equals(Nummer)) { NummerS = String.format(e.getActionCommand()); } else if (e.getSource() == Locatie) { LocatiesS = String.format(e.getActionCommand()); } else if (e.getSource() == Login) { LoginS = String.format(e.getActionCommand()); } else if (e.getSource() == Datum) { DatumS = String.format(e.getActionCommand()); } else if (e.getSource() == Nummer1) { Nummer1S = String.format(e.getActionCommand()); } else if (e.getSource() == Nummer5) { Nummer5S = String.format(e.getActionCommand()); } else if (e.getSource().equals(save)) { generateCsvFile("c:\\testss.csv"); System.out.println(NummerS); System.out.println("Debug"); } } // JOptionPane.showMessageDialog(null, string); }
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24045978
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37073002
tagged with: null
has title: Set variables still return null

http://stackoverflow.com/a/24030971
accepted answer of: http://stackoverflow.com/q/24030774
has comment: http://stackoverflow.com/comment/37044665
answers question: http://stackoverflow.com/q/24030774
has comment: http://stackoverflow.com/comment/37045414
downvote count: 1
has comment: http://stackoverflow.com/comment/37044702
score: 1
has comment: http://stackoverflow.com/comment/37044782
upvote count: 2
has comment: http://stackoverflow.com/comment/37044872
type: AcceptedAnswer
has body: EDIT Just as a quick solution to the exact question you're asking: you need to change the last few lines to the following if (key &lt; (int) tab.get(tab.size() / 2)) { return bSearch(smallerThanKey, key); } else { return bSearch(largerThanKey, key); } } Having said that, let me point out a few more issues that I see here: (a) you can use generics. That is use ArrayList&lt;Integer&gt; rather than just ArrayList this will save you from all those casts. (b) Instead of returning the value that you found you'd be better off returning the index in the ArrayList where the value is located, or -1 if it was not found. Here's why: returning the key provides the caller with very little new information. I mean - the caller already known what key is. If you return the index to the key you let the caller know if the key was found or not, and if it was found where in the list it resides. (c) You essentially copying the entire list each time you go into bSearch(): you copy roughly half of the list into smallerThanKey and (roughly) half into greaterThanKey. This means that the complexity of this implementation is not O(log n) but instead O(n). (EDIT #2) Summarizing points (a), (b), (c) here's how one could write that method: public static int bSearch(ArrayList&lt;Integer&gt; tab, int key) { return bSearch(tab, 0, tab.size(), key); } public static int bSearch(ArrayList&lt;Integer&gt; tab, int begin, int end, int key) { int size = end - begin; if (size &lt;= 0) return -1; int midPoint = (begin + end) / 2; int midValue = tab.get(midPoint); if (midValue == key) return midPoint; if (key &lt; midValue) { return bSearch(tab, begin, midPoint, key); } else { return bSearch(tab, midPoint + 1, end, key); } } As you can see, I added a second method that takes a begin, end parameters. These parameters let the method which part of the list it should look at. This is much cheaper than creating a new list and copying elements to it. Instead, the recursive function just uses the list object and simp…
type: Answer

http://stackoverflow.com/comment/37203259
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24084210
has text: @Gimby, I focussed on other things in codes, that's why I missed it out. Thank u!
type: Comment

http://stackoverflow.com/comment/36898047
score: 0
type: Comment
type: QuestionComment
has text: Thanks, do you mean you produce both manually? Would ideally prefer to only have to maintain one diagram and use it as a single source for generating both classes and database schema (with a minimal amount of "wiring" outside the model).
comment on: http://stackoverflow.com/q/23952011

http://stackoverflow.com/q/23961197
has body: I have this simple program which retrieves an image from a URL ----- saves at bitmap --- displays as image view. However, it keeps on crashes when I try to run it. I have the downloadBitmap method to convert a url into a bitmap and then I want to set image to ImageBitmap? package com.example.bitmapdisplay; import java.io.IOException; import java.io.InputStream; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import com.fasterxml.jackson.core.JsonParseException; import android.app.Activity; import android.app.ProgressDialog; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; public class MainActivity extends Activity { Bitmap image; BitmapDrawable bd; ImageView temp; ProgressDialog pd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); temp = (ImageView) findViewById(R.id.ivImage); Thread retrieveImage = new Thread() { public void run(){ try { image = downloadBitmap("http://i1.cpcache.com/product_zoom/617914535/dickbutt_2_mug.jpg?side=Back&amp;height=250&amp;width=250&amp;padToSquare=true"); } catch (JsonParseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { temp.setImageBitmap(image); } } }; retrieveImage.run(); } private Bitmap downloadBitmap(String url) throws JsonParseException, IOException{ // initilize the default HTTP client object final DefaultHttpClient client = new DefaultHttpClient(); //forming a HttoGet request final HttpGet getRequest = new HttpGet(url); HttpResponse response = client.execute(getRequest); //check 200 OK for success final int statusCode = respons…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36914585
has answer: http://stackoverflow.com/a/23961396
type: Question
tagged with: crash
linked to: http://stackoverflow.com/q/18898039
has title: Application retrieving image from URL and displaying in Android application crashes
accepted answer: http://stackoverflow.com/a/23961396
has comment: http://stackoverflow.com/comment/36914616
score: 0
answer count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/36914513
tagged with: android
tagged with: bitmap

http://stackoverflow.com/q/24053082
type: AnsweredQuestion
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/24053116
upvote count: 2
score: 1
tagged with: java
has body: I'm creating a method to be able to "print a histogram," and I'm trying to get it to reference the histogramData.length, to be able to loop and build each row, but it's not recognizing histogramData.length in the method. I have the code in 2 separate files, one for main and one to build the methods. Main looks like: import becker.robots.*; public class DrawHistogram extends Object { public static void main(String[] args) { City Edmonds = new City(12, 12); HistogramRobot drawingBot = new HistogramRobot(Edmonds, 1, 1, Direction.EAST, 1000); HistogramPrinter histPrinter = new HistogramPrinter(); int [] histogramData = new int[7]; histogramData[0] = 3; // The first element holds 3 histogramData[1] = 5; // The second element holds 5 histogramData[2] = 1; // The third element holds 1 histogramData[3] = 0; // The fourth element holds 0 histogramData[4] = 4; // The fifth element holds 4 histogramData[5] = 2; // The sixth element holds 2 histogramData[6] = 1; // The seventh element holds 1 drawingBot.drawRow(); } } And my method file looks like import becker.robots.*; class HistogramRobot extends Robot { HistogramRobot(City c, int st, int ave, Direction dir, int num) { super(c, st, ave, dir, num); } public void drawRow() { for(int counter = 0; counter &lt; histogramData.length; counter++) { if( histogramData[counter] == 0) { this.turnRight(); this.move(); this.turnLeft(); } for( int histoDrop = 0; histoDrop &lt; histogramData[counter]; histoDrop++) { this.putThing(); this.move(); } this.turnAround(); for (int moves = 0; moves &lt; histogramData[counter]; moves++) { this.move(); } this.turnLeft(); this.move(); this.turnLeft(); } } public void turnRight() { this.turnLeft(); this.turnLeft(); this.turnLeft(); } public void turnAround() { this.turnLeft(); this.turnLeft(); } } And the error I'm getting for each mention of "histogramData" including "histogramData.length" HistogramRobot.java:24: error: cannot find symbol for( int histoDrop = 0; histoDrop &lt; histogramData[counter];…
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37086355
accepted answer: http://stackoverflow.com/a/24053116
has title: Compile Error: Cannot find symbol of array.length
answer count: 1
favorite count: 0

http://stackoverflow.com/a/24084990
has comment: http://stackoverflow.com/comment/37144934
has comment: http://stackoverflow.com/comment/37145025
has comment: http://stackoverflow.com/comment/37145188
score: 0
has comment: http://stackoverflow.com/comment/37145879
has comment: http://stackoverflow.com/comment/37145504
answers question: http://stackoverflow.com/q/24081869
has comment: http://stackoverflow.com/comment/37145246
type: Answer
has body: Hy, your error is: Caused by: java.lang.NullPointerException at com.gestion.projet.web.jsf.ProjetComponentImpl.onRowSelect(ProjetComponentImpl.java:92) is caused by ((Projet) event.getObject()).getIdprojet().toString() your object projet is not null. the null object is the idProject. go to your projet and verify if he has id valorized

http://stackoverflow.com/a/23955163
accepted answer of: http://stackoverflow.com/q/23942913
answers question: http://stackoverflow.com/q/23942913
upvote count: 1
has comment: http://stackoverflow.com/comment/36907750
type: AcceptedAnswer
type: Answer
has body: In Genson 0.99 there are missing Converters for float and short. They have been added for 1.0 release (but its still in devlopment). To solve the problem temporarily you can use double instead of float (the easy solution) or provide converters : @HandleClassMetadata @WithoutBeanView public final static class FloatConverter implements Converter&lt;Float&gt; { public Float deserialize(ObjectReader reader, Context ctx) { return reader.valueAsFloat(); } public void serialize(Float obj, ObjectWriter writer, Context ctx) { writer.writeValue(obj.floatValue()); } } Then you will need to register it and provide your custom Genson configuration to Jersey: @Provider public class GensonCustomResolver implements ContextResolver&lt;Genson&gt; { // configure the Genson instance private final Genson genson = new Genson.Builder().withConverter(new FloatConverter()).with(new JAXBBundle()).create(); @Override public Genson getContext(Class&lt;?&gt; type) { return genson; } }
has comment: http://stackoverflow.com/comment/36906205
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36906874

http://stackoverflow.com/q/23957422
tagged with: java
has comment: http://stackoverflow.com/comment/36907169
type: Question
has comment: http://stackoverflow.com/comment/36907080
has answer: http://stackoverflow.com/a/23958561
score: 0
tagged with: weka
has title: Why cannot use weka.classifiers.functions.PLSClassifier
has body: I am trying to use weka's PLSClassifier using java, but when I tried to import weka.classifiers.functions.PLSClassifier into eclipse, it gives me error(The error is import weka.classifiers.functions.PLSClassifier cannot be resolved). The weka I use is the latest version3.7, but I found no class PLSClass under weka.classifiers.functions. The documentation for this class is: http://weka.sourceforge.net/doc.stable/weka/classifiers/functions/PLSClassifier.html I would like to know do I need addition package to support this?
has comment: http://stackoverflow.com/comment/36907031
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36907134

http://stackoverflow.com/comment/37132731
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24073622
type: AnswerComment
has text: @Simon Kuang: the first solution *does* what you are asking for. `list.parallelStream().sorted()` applied to a linked list will internally copy items into an array and invoke `Arrays.parallelSort`. If you insist on modifying the original `List` you can use `Collections.copy(List,List)` afterwards.

http://stackoverflow.com/a/72232213
has body: As per @Totoro's answer, this is just a summary here. Annotate the object for the class you are testing with the @Spy annotation. So this: @Spy @InjectMocks MyClassUnderTest myClassUnderTest; instead of just @InjectMocks MyClassUnderTest myClassUnderTest; Use doReturn() instead of when.thenReturn() whenever asking for the mocked object from the class spyed on (class under test). doReturn(X).when(myClassUnderTest).method(any())
downvote count: 0
answers question: http://stackoverflow.com/q/23958611
score: 8
upvote count: 8
type: Answer

http://stackoverflow.com/comment/36923068
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/23965654
type: Comment
has text: Well, if you are getting an exception, please show it.

http://stackoverflow.com/comment/37013240
comment on: http://stackoverflow.com/q/24014234
has text: Look up "Word Boundry + regex" my friend.. Who knows, you might not even need " "
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/23942382
type: Question
tagged with: case
accepted answer: http://stackoverflow.com/a/23942424
score: 0
answer count: 1
has title: how to put "case" into loop
has answer: http://stackoverflow.com/a/23942424
tagged with: combobox
has body: Here is fragment code of my program that will simulate Solar System. Depending on what user will write in "amountField", "Number" of planets will change, and so will ComboBox "listOfPlanet". And here is my problem. I found out how to "resize" Combobox but i have no idea how to make case "X" depend on "Number". As u see i had to manually write 12 cases. amountField = new JTextField(6); ActionListener amountListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String amountData = amountField.getText(); Number = Integer.parseInt(amountData); listOfPlanet.removeAllItems(); for(int i = 0; i&lt;Number; i++) { listOfPlanet.addItem("Planeta" + i); } b = new Ball(leftMainPanel); } }; amountField.addActionListener(amountListener); rightUpPanel.add(amountField); listOfPlanet = new JComboBox(); for(int i = 0; i&lt;Number; i++) { listOfPlanet.addItem("Planeta" + i); } ActionListener ComboListener = new ActionListener() { public void actionPerformed(ActionEvent e) { int temp; temp = listOfPlanet.getSelectedIndex(); switch(temp){ case 0: iii=0; break; case 1: iii=1; break; case 2: iii=2; break; case 3: iii=3; break; case 4: iii=4; break; case 5: iii=5; break; case 6: iii=6; break; case 7: iii=7; break; case 8: iii=8; break; case 9: iii=9; break; case 10: iii=10; break; case 11: iii=11; break; case 12: iii=12; break; } } }; listOfPlanet.addActionListener(ComboListener); is there any way to make it work like this? : for(int i=0; i&lt;Number; i++) { case i: iii=i; break; }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36879511
tagged with: java
has comment: http://stackoverflow.com/comment/36879165
tagged with: loops

http://stackoverflow.com/comment/36946504
score: 0
type: AnswerComment
type: Comment
has text: For getting text from TextView you sholud use: ((TextView) context.findViewById(R.id.textview)).getText().toString() You can use: textView.setText(((TextView)mContext.findViewById(mThumbIds[position])).getText().toString);
comment on: http://stackoverflow.com/a/23962183

http://stackoverflow.com/comment/37050073
comment on: http://stackoverflow.com/q/24017038
has text: in that case if your regex solution works, i ll pick that
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37039050
type: AnswerComment
comment on: http://stackoverflow.com/a/24022741
score: 0
has text: @kriegaex Can you please help me with a sinple demo on how to use `target()` ? What I did was added a return type `String` while invoking the `jp.invoke()` and returned that `String` to resolve that `null` issue. But since I am new to AOP, I want to follow the best practise that you suggested. Please help.
type: Comment

http://stackoverflow.com/q/24040781
has title: Setting XML Headers in Jersey response
linked to: http://stackoverflow.com/q/7034673
has body: I have couple of web-services implemented via Jersey/Jaxb which are sending XML response as &lt;?xml version="1.0" encoding="UTF-8"?&gt; I want to edit this header and to include standalone="yes". I know i can use marshaller.setProperty(..) method to over come this but It will be a lot of work to change the response code for EVERY response being sent from the project. Is there a better way to achieve this in the project ? Setting some custom Jaxb property file or some configuration or something ? EDIT So I managed to achieve what i want to but i am not sure if this is the right way to do it. I wrote a custom marshaller resolver and override the xml header. @Provider public class JaxbMarshallerResolver implements ContextResolver&lt;Marshaller&gt; { @Override public Marshaller getContext(Class&lt;?&gt; type) { Marshaller marshaller; try { JAXBContext jc = JAXBContext.newInstance(type); marshaller = jc.createMarshaller(); marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", Boolean.FALSE); marshaller.setProperty("com.sun.xml.bind.xmlHeaders", "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?&gt;"); } catch (JAXBException je) { throw new RuntimeException(je); } return marshaller; } } Is there any better way to achieve it ?
answer count: 0
type: UnansweredQuestion
tagged with: jaxb
tagged with: web-services
has comment: http://stackoverflow.com/comment/37062980
tagged with: jersey
has comment: http://stackoverflow.com/comment/37065892
tagged with: java
type: Question
score: 0

http://stackoverflow.com/comment/36983233
type: Comment
has text: Either the expectation recording block or the expectation verification block should be removed here, since you only need one in this situation.
score: 1
comment on: http://stackoverflow.com/q/23993645
type: QuestionComment

http://stackoverflow.com/a/24086915
has body: Not exactly an efficient solution, as it can end up going through the entire ArrayList twice, but it'll get the job done. int index; for( HashMap m : mapList ) { if( m.get( "model" ).equals( "car2" ) ) { index = arrayList.indexOf( m ); break; } }
answers question: http://stackoverflow.com/q/24086817
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/23989490
downvote count: 3
upvote count: 1
type: Question
score: -2
has answer: http://stackoverflow.com/a/23989570
has comment: http://stackoverflow.com/comment/36967285
tagged with: concurrency
has answer: http://stackoverflow.com/a/23997289
answer count: 2
tagged with: thread-sleep
possible better answer: http://stackoverflow.com/a/23989570
has title: Similarity between sleep and join in java
accepted answer: http://stackoverflow.com/a/23997289
has comment: http://stackoverflow.com/comment/36966985
favorite count: 0
has comment: http://stackoverflow.com/comment/36966923
has body: As the question suggests , I want to know the similarity between the sleep and join methods on the thread. I have gone through many questions that describe the difference between the sleep and join method. But I would like to know different scenarios where the sleep and join methods could be used interchangeably . According to my thinking following code should work just in the same way. I have a main thread in which I start a new thread (just 1) and I want the main thread to wait for the new thread to complete for some amount of time. The code is as follows: newThread.join(10000) OR, Thread.sleep(10000) but , when I run this code I don't get expected results. why is this so? technically it should be the same right?
type: AnsweredQuestion
tagged with: java
tagged with: multithreading

http://stackoverflow.com/comment/36882034
has text: Rather use a GridBagLayout.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23943524
score: 0

http://stackoverflow.com/q/24012825
has comment: http://stackoverflow.com/comment/37010948
has comment: http://stackoverflow.com/comment/37010884
type: Question
has comment: http://stackoverflow.com/comment/37010943
has comment: http://stackoverflow.com/comment/37010599
has comment: http://stackoverflow.com/comment/37010901
score: 0
answer count: 3
has body: I have an HashMap&lt;String,AnObject&gt; and I'd like to give the string key a value from some infos the AnObject value contains. Suppose AnObject is made this way: public class AnObject(){ public String name; public String surname; } Is it correct to assign the key to: String.valueOf(o.name.hashcode()+o.surname.hashcode()); ? Or Is there a better way to compute a String hash code from a value list?
linked to: http://stackoverflow.com/q/2310498
has answer: http://stackoverflow.com/a/24012932
has comment: http://stackoverflow.com/comment/37010685
has comment: http://stackoverflow.com/comment/37010824
has answer: http://stackoverflow.com/a/24012948
has comment: http://stackoverflow.com/comment/37010749
type: UnansweredQuestion
has title: Is hashcode() a good way to compute an unique token from a list of informations?
has answer: http://stackoverflow.com/a/24012984
tagged with: java

http://stackoverflow.com/q/24011698
has comment: http://stackoverflow.com/comment/37009773
has comment: http://stackoverflow.com/comment/37008831
has comment: http://stackoverflow.com/comment/37008716
has comment: http://stackoverflow.com/comment/37008754
has comment: http://stackoverflow.com/comment/37008849
has comment: http://stackoverflow.com/comment/37008646
has body: I made a java application to manage tasks. My application is connected to a MySQL database. I need the table rows where the priority is equal to 1 change color automatically. I've been searching and found some examples, but I couldn't do to work with my table. My table was made using drag and drop, so it is the default type as you can see through the code. Does anyone could help me try to implement this functionality in my small application please? I'm really discouraged. Sorry everyone. Can anyone help me please? Code of my jtable DefaultTableModel tmTasks = new DefaultTableModel(null, new String[]{"Status", "Priority", "Task", "Desc", "Date"}); List&lt;Tasks&gt; tasks; ListSelectionModel lsmTasks; private void showTasks(List&lt;Tasks&gt; tasks) { while (tmTasks.getRowCount() &gt; 0) { tmTasks.removeRow(0); } if (tasks.size() == 0) { JOptionPane.showMessageDialog(null, "NO Tasks"); } else { String[] line = new String[]{null, null, null}; for (int i = 0; i &lt; tasks.size(); i++) { tmTasks.addRow(line); tmTasks.setValueAt(tasks.get(i).getStatus(), i, 0); tmTasks.setValueAt(tasks.get(i).getPriority(), i, 2); tmTasks.setValueAt(tasks.get(i).getTasks(), i, 1); tmTasks.setValueAt(tasks.get(i).getDesc(), i, 3); tmTasks.setValueAt(tasks.get(i).getDate(), i, 4); } } } My jtable to tasks!
tagged with: swing
linked to: http://stackoverflow.com/q/22606227
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37008570
has comment: http://stackoverflow.com/comment/37008574
has title: How jTable change cell color on a specific row. Java
has comment: http://stackoverflow.com/comment/37008678
duplicate of: http://stackoverflow.com/q/22606227
tagged with: java
has comment: http://stackoverflow.com/comment/37009560
has comment: http://stackoverflow.com/comment/37008479
has answer: http://stackoverflow.com/a/24012296
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37009649
tagged with: jtable
score: 0
accepted answer: http://stackoverflow.com/a/24012296

http://stackoverflow.com/comment/37020353
type: AnswerComment
comment on: http://stackoverflow.com/a/24017917
score: 0
type: Comment
has text: Dukeling is right, you can simply remove your `import ReadFile.*` instruction and it should work.

http://stackoverflow.com/a/55584760
has comment: http://stackoverflow.com/comment/97867179
downvote count: 1
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23983740
score: 1
has body: Code Coverage with JaCoCo explained the reason The simplest way to use JaCoCo it is — on-the-fly instrumentation with using JaCoCo Java Agent. In this case a class in modified when it is being loaded. You can just run you application with JaCoCo agent and a code coverage is calculated. This way is used by Eclemma and Intellij Idea. But there is a big issue. PowerMock instruments classes also. Javassist is used to modify classes. The main issue is that Javassist reads classes from disk and all JaCoCo changes are disappeared. As result zero code coverage for classes witch are loaded by PowerMock class loader. We are going to replace Javassist with ByteBuddy (#727) and it should help to resolve this old issue. But right now there is NO WAY TO USE PowerMock with JaCoCo On-the-fly instrumentation. And no workaround to get code coverage in IDE. JaCoCo Offline Instrumentation can solve this problem. The sample of Offline Instrumentation fixed my problem .

http://stackoverflow.com/comment/36892552
comment on: http://stackoverflow.com/q/23949237
has text: What if you first verify if this works between 2 browsers and 2 phones? And what if you add some logging to all the functions being executed (so you can exactly see what is going wrong, as I expect the code is not doing something but which part I have no idea).
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/23946216
has comment: http://stackoverflow.com/comment/36917526
accepted answer of: http://stackoverflow.com/q/23945973
answers question: http://stackoverflow.com/q/23945973
score: 0
type: AcceptedAnswer
type: Answer
has body: Once you have the Date object for the parsed time, use getTime() to get the time in milliseconds and save it into a long variables. Then parse the offset time format and use a NumberFormat to get the number of minutes to offset. Add or subtract as needed. Take the result and create a new Date(millis) then apply your format to it. Here is a working example: String sTime = "08:00"; String sOffset ="00:07"; SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm"); Date dtTime = null; try { dtTime = dateFormat.parse(sTime); } catch (ParseException e) { // handle exception return; } String[] offsetHrsMins = null; NumberFormat numberFormat = NumberFormat.getNumberInstance(); long offsetMillis = 0; try { offsetHrsMins = sOffset.split(":"); long offsetHrs = (Long) numberFormat.parse(offsetHrsMins[0]); long offsetMins = (Long) numberFormat.parse(offsetHrsMins[1]); offsetMillis = 1000 * 60 * ((offsetHrs * 60) + offsetMins); } catch (ParseException e) { // handle exception return; } long lTime = dtTime.getTime(); System.out.println("Adding minutes: " + dateFormat.format(new Date(lTime + offsetMillis))); System.out.println("Subtracting minutes: " + dateFormat.format(new Date(lTime - offsetMillis))); output: Adding minutes: 08:07 Subtracting minutes: 07:53

http://stackoverflow.com/a/28108902
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24004959
has body: Instead of returning an Account you return create an AccountWrapper or Collection. The Writer obviously must take this into account :)

http://stackoverflow.com/comment/37024463
type: QuestionComment
type: Comment
score: 1
has text: Yes. And integer has 4 bytes. Char in java has 2 bytes. So how can integer produce 4 chars?
comment on: http://stackoverflow.com/q/24020006

http://stackoverflow.com/a/24131295
has body: To answer my own question...this is how I fixed my issue. It took me a long time to figure this out but here it is. The parameters are a little messy when it comes to my own imagebutton so I will have to figure out what to use to keep my finger in the center of the button, but this moves the button like I was wanting: button.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (me.getAction() == MotionEvent.ACTION_MOVE ) { LayoutParams params = new LayoutParams(v.getWidth(), v.getHeight()); params.setMargins((int)event.getRawX() - v.getWidth()/2, (int)(event.getRawY() - v.getHeight()), (int)event.getRawX() - v.getWidth()/2, (int)(event.getRawY() - v.getHeight())); v.setLayoutParams(params); } return false; } });
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/24002663
type: Answer
answers question: http://stackoverflow.com/q/24002663

http://stackoverflow.com/q/23992110
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36972462
accepted answer: http://stackoverflow.com/a/23992147
favorite count: 0
type: Question
has body: I have a gridView which is populating image text etc now i just want to make all the gridview clickable so i tried making it gridView1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Log.i("The clicked item is:"+position, null); } }); But the grid view is not working when i click the gridview instead of showing me the position in logcat it will tell as fatal exception. 06-02 05:52:49.887: W/dalvikvm(3085): threadid=1: thread exiting with uncaught exception (group=0xb4a9aba8) 06-02 05:52:49.977: E/AndroidRuntime(3085): FATAL EXCEPTION: main 06-02 05:52:49.977: E/AndroidRuntime(3085): Process: com.coded.sandeep, PID: 3085 06-02 05:52:49.977: E/AndroidRuntime(3085): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.coded.sandeep; is package not installed? 06-02 05:52:49.977: E/AndroidRuntime(3085): at android.app.LoadedApk.makeApplication(LoadedApk.java:516) 06-02 05:52:49.977: E/AndroidRuntime(3085): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317) 06-02 05:52:49.977: E/AndroidRuntime(3085): at android.app.ActivityThread.access$1500(ActivityThread.java:135) 06-02 05:52:49.977: E/AndroidRuntime(3085): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 06-02 05:52:49.977: E/AndroidRuntime(3085): at android.os.Handler.dispatchMessage(Handler.java:102)
answer count: 2
tagged with: android
tagged with: gridview
has comment: http://stackoverflow.com/comment/36971504
has title: Android Gridview onclick Event is giving Fatal Exception
tagged with: java
has comment: http://stackoverflow.com/comment/36971430
has answer: http://stackoverflow.com/a/23992147
possible better answer: http://stackoverflow.com/a/23992765
score: -4
has answer: http://stackoverflow.com/a/23992765
has comment: http://stackoverflow.com/comment/36971523
downvote count: 4

http://stackoverflow.com/comment/36884708
has text: @user3587250 Glad I could help! Out of curiosity, did you use the top or bottom one? Array or collection?
comment on: http://stackoverflow.com/a/23945114
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23953207
has comment: http://stackoverflow.com/comment/36900208
has comment: http://stackoverflow.com/comment/36899861
has comment: http://stackoverflow.com/comment/36899620
has comment: http://stackoverflow.com/comment/36899708
downvote count: 0
has comment: http://stackoverflow.com/comment/36938499
upvote count: 2
has comment: http://stackoverflow.com/comment/36924112
type: Answer
has comment: http://stackoverflow.com/comment/36905647
has comment: http://stackoverflow.com/comment/36906828
score: 2
answers question: http://stackoverflow.com/q/23952603
has body: As in my last response, I used this long time ago. In my case instead of dealing always with urls I delegated into handlers. I mean, if you want to integrate GWT-RPC with Spring-Security, the first thing that I did, was from my GWT app try to login against Spring. So the first thing that you need to do is create a RPC-CALL (here official documentation) for login. I found useful the annotation @RemoteServiceRelativePath("examplelogin.rpc"), so if you use it you can take advantage about the path, and then, in the spring-security.xml you can filter the request by those path (see the updated example below). Not sure why you want to integrate GWT-RPC with Spring-Security and then you specify /login.html (should it be a rpc call, described befored instead of html? But maybe you are using your own MVP with GWT, so I am not saying that is wrong, only it surprises me :) ). Reading your code I do not see something wrong, but in my case I have some differences: .... &lt;http use-expressions="true" entry-point-ref="http401UnauthorizedEntryPoint"&gt; &lt;intercept-url pattern="/yourProject/public.rpc" access="permitAll" /&gt; &lt;intercept-url pattern="/yourProject/examplelogin.rpc" access="hasRole('ROLE_ADMIN')" /&gt; &lt;form-login authentication-success-handler-ref="authenticationSuccessHandler" authentication-failure-handler-ref="authenticationFailureHandler"/&gt; ..... //logout, session-management, custom-filters.... &lt;beans:bean id="http401UnauthorizedEntryPoint" class="your.project.Http401UnauthorizedEntryPoint" /&gt; &lt;beans:bean id="authenticationSuccessHandler" class="your.project.GWTAuthenticationSuccessHandler"/&gt; &lt;beans:bean id="authenticationFailureHandler" class="your.project.GWTAuthenticationFailureHandler"/&gt; &lt;/http&gt; .... You asked specifically about the possibility of using Spring-Security with GWT-RPC (that is the reason because in the &lt;intercept-url&gt; tags I place there the .rpc urls) Note that the The answer is yes, I have done it (thre…
has comment: http://stackoverflow.com/comment/36899197
has comment: http://stackoverflow.com/comment/36899281

http://stackoverflow.com/a/23963382
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23962993
has body: it will only add the spring-core jar file into my project, can anyone explain me why it is like it is? It not only adds the spring-core JAR file, but actually all of the dependencies defined here. (See the "This artifact depends on..." section. The Spring team devided their framework in consistent modules so it can be used properly by specific projects that do not need all the spring bundle. There are libraries that do not depend on all of the context JARs, only on the core. Right now the current stable version is 4.0.5. Because i'm learning from tutorial and in the tutorial, the guy added both of these dependencies -> spring-core and spring-context, why he did it? he should add just spring-context dependency and the result would be the same, can anyone explain? Yes, the result would be virtually the same. There is no need for declaring the spring-core dependency if there is already a spring-context declared, since the context already depends on the core. Unless the author of the tutorial was building a parent POM for depency management (maybe he would have a module that would only depend on the spring-core), he shouldnt add that dependency since it might conflict in future updates in the POM. The declaration to the core should be removed.

http://stackoverflow.com/q/23988266
tagged with: java
has comment: http://stackoverflow.com/comment/45518338
has comment: http://stackoverflow.com/comment/36968414
type: Question
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36965992
has title: Get calendar event ID after adding it by user
has comment: http://stackoverflow.com/comment/36968374
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36964689
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36967324
has body: I have a question: how to get properly calendar event ID? I have this code to add event: Intent addMeetingEvent = new Intent(Intent.ACTION_INSERT) .setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, appBeginTimeDate.getMillis()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, appEndTimeDate.getMillis()) .putExtra(CalendarContract.Events.TITLE, "title") .putExtra(CalendarContract.Events.DESCRIPTION, "desc") .putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY); startActivity(addMeetingEvent); //in here the eventID is null, cause it has not been confirmed and saved by the user //long eventID = Long.parseLong(CalendarContract.Events.CONTENT_URI.getLastPathSegment()); So first I create the intent and put extras than the Android callendar lauches and shows the event. Then user needs to cofirm it (or cancel). My question is - how and when do I get eventID? I need to store it, so it the event can be deleted (if user clicks so). EDIT: After Jon Skeet adviced me I used startActivityForResult. My callback is: protected void onActivityResult(int requestCode, int resultCode, Intent data) { if( requestCode == 0){//EXCEPTION LINE BELOW Uri dataUri = data.getData(); Log.d("TEST", dataUri.toString()); } } And I have an exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {xxx.BookAppointmentActivity}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3176) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3219) at android.app.ActivityThread.access$1200(ActivityThread.java:134) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4856) at java.lang.reflect.Method.invokeNative(Native Method) at j…
has comment: http://stackoverflow.com/comment/36966396
score: 2
has comment: http://stackoverflow.com/comment/36966031

http://stackoverflow.com/comment/36994937
type: Comment
has text: ok, I have implemented your suggestion and now the .destroy is working but when it is opening Excel it gives a warning that the file could not be found? I supplemented C:\\file.xls with my own. Any ideas why? Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24002483

http://stackoverflow.com/comment/37172441
type: Comment
has text: i've modified my method but doesn't work. ` Lista.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Lista.setChoiceMode(Lista.CHOICE_MODE_MULTIPLE_MODAL); Lista.setItemChecked(position, true); return false; } }); `
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24099511

database
tags question: http://stackoverflow.com/q/24058163
tags question: http://stackoverflow.com/q/24037705
tags question: http://stackoverflow.com/q/24016458
tags question: http://stackoverflow.com/q/23981036
tags question: http://stackoverflow.com/q/23978628
tags question: http://stackoverflow.com/q/24046862
type: Tag
tags question: http://stackoverflow.com/q/24053976
tags question: http://stackoverflow.com/q/24092079
tags question: http://stackoverflow.com/q/23982606
tags question: http://stackoverflow.com/q/24052273
tags question: http://stackoverflow.com/q/24073864
tags question: http://stackoverflow.com/q/23983455
tags question: http://stackoverflow.com/q/23990942
tags question: http://stackoverflow.com/q/24066305
tags question: http://stackoverflow.com/q/23948428
tag name: database
tags question: http://stackoverflow.com/q/23991878
tags question: http://stackoverflow.com/q/24011386
tags question: http://stackoverflow.com/q/23990131
tags question: http://stackoverflow.com/q/23994265
tags question: http://stackoverflow.com/q/24053786
tags question: http://stackoverflow.com/q/24022880
tags question: http://stackoverflow.com/q/24019854
tags question: http://stackoverflow.com/q/24039423
tags question: http://stackoverflow.com/q/24053636
tags question: http://stackoverflow.com/q/24075478
tags question: http://stackoverflow.com/q/24054517
tags question: http://stackoverflow.com/q/23948144
tags question: http://stackoverflow.com/q/24058909
tags question: http://stackoverflow.com/q/24072551
tags question: http://stackoverflow.com/q/24075267
tags question: http://stackoverflow.com/q/23954334
tags question: http://stackoverflow.com/q/23969635
tags question: http://stackoverflow.com/q/23960940
tags question: http://stackoverflow.com/q/23995206
tags question: http://stackoverflow.com/q/23985902
tags question: http://stackoverflow.com/q/23993845
tags question: http://stackoverflow.com/q/23990521
tags question: http://stackoverflow.com/q/24006273
tags question: http://stackoverflow.com/q/23981526
tags question: http://stackoverflow.com/q/23986348
tags question: http://stackoverflow.com/q/24088540

http://stackoverflow.com/q/23945100
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/36884339
favorite count: 0
accepted answer: http://stackoverflow.com/a/23945114
type: AnsweredQuestion
has title: Add array on subprogram in java
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23945114
score: -1
has body: I would like to make a subprogram to search, if there is a given string in an array. I want the subprogram to have as requirements the name and the array. How can I achieve that? My subprogram is: static int findElement(String a, String array){ for (int i = 0; i &lt; array.size(); i++){ if (array.get(i).getName().equalsIgnoreCase(a)) { System.out.println(i); return i; } else return 0; } } I have of course errors since it doesn't accept the array as I have inserted it.
upvote count: 0

http://stackoverflow.com/q/23967639
upvote count: 4
answer count: 0
type: UnansweredQuestion
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/72170058
has title: Android: Media Scanner won't scan m3u playlists?
score: 4
has comment: http://stackoverflow.com/comment/92200871
favorite count: 0
has comment: http://stackoverflow.com/comment/72225333
tagged with: android
has body: I've written an audio player app through which users can create and save playlists (.m3u files) to external storage. What I'm trying to do now is force update the mediastore content provider with new playlist files after they're created. This is so they'll show up in a "Load Playlist" dialog in the app which queries MediaStore for available playlists. I've tried a number of methods to get MediaScanner to scan the newly created playlist but with no success - it won't show up in MediaStore query results... File root = Environment.getExternalStorageDirectory(); final File file = new File(root, CUSTOM_PLAYLISTS_DIR + "/" + filename); OutputStream out = new FileOutputStream(file); out.write(songPaths.getBytes()); out.flush(); out.close(); // 1. using broadcast. Doesn't work c.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file))); // 2. using MediaScannerConnection. Doesn't work MediaScannerConnection.scanFile(c, new String[] { file.getAbsolutePath() }, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String s, Uri uri) { Utils.log(this, "onScanCompleted s = " + s + ", uri = " + uri); } }); // 3. Sledgehammer approach - rescan entire external storage // Doesn't work on KitKat! (permission denied) sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); However if I reboot the phone, the m3u file created by the app apparently is scanned because it will then show up in MediaStore results! (I take it this is equivalent to remounting external storage, as with method 3) Any ideas how to get to this work on KitKat? I don't want to have to resort to manually writing playlist metadata to the MediaStore and having a "ghost" entry that has no corresponding file...

http://stackoverflow.com/comment/37005392
type: Comment
score: 1
has text: I hope someone somewhere enjoys the humor in that.
comment on: http://stackoverflow.com/q/24009467
type: QuestionComment

http://stackoverflow.com/a/24006940
has body: Lines like these: subArr = new ArrayList&lt;Integer&gt; (subArr.subList(fromIndex, subArr.size())); That's your "copy". The new ArrayList is indeed, a copy of the data from the subList. If you were using the subList "raw", then it could be better argued that you are "in place", because then the subList is simply a set of offsets in to the original array. But with the create of new ArrayLists, you are definitely copying. Of course, the easiest way to check is that when you find your value, change the value in the list to some sentinel (9999 or whatever). Then dump your original list. If 9999 shows up, it's in place. If not, then, it's not.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24006647
has comment: http://stackoverflow.com/comment/37000982
has comment: http://stackoverflow.com/comment/37001851
score: 2
has comment: http://stackoverflow.com/comment/37000039
downvote count: 0
has comment: http://stackoverflow.com/comment/37000162

http://stackoverflow.com/a/23977101
has body: If you'd set minRadius and maxRadius paramaeters properly, it'd give you good results. For your image, I tried following parameters. method - CV_HOUGH_GRADIENT minDist - 100 dp - 1 param1 - 80 param2 - 10 minRadius - 250 maxRadius - 300 I got the following output Note: I tried this in C++.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23976766
has comment: http://stackoverflow.com/comment/36944770
answers question: http://stackoverflow.com/q/23976766
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36943936
type: Answer

http://stackoverflow.com/q/24054717
favorite count: 0
has comment: http://stackoverflow.com/comment/37089449
has comment: http://stackoverflow.com/comment/37089140
tagged with: nullpointerexception
type: Question
has comment: http://stackoverflow.com/comment/37089125
has comment: http://stackoverflow.com/comment/37089173
score: -1
has comment: http://stackoverflow.com/comment/37089014
has title: ActionListener doesn't work - it shows NullPointerException
answer count: 2
downvote count: 2
upvote count: 1
tagged with: swing
has body: I've a problem with my ActionListener. When I launch my application a NullPointerException appears. This is the code : public class SimulationPopUp extends javax.swing.JFrame { private String simulation; private Data d; /** * Creates new form SimulationPopUp */ public SimulationPopUp(String simulation, Data d) throws SQLException, IOException { this.simulation=simulation; this.d = d; this.setVisible(true); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); initComponents(); simulationChosen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { changeSimulation(e); } }); simulationChosen.removeAllItems(); try { Object[] o = d.ExtractAllSimulation(simulation); for (int i=0; i&lt;o.length-1; i++){ simulationChosen.addItem(o[i]); } Object[] param = d.ExtractAllParameters((int)o[o.length-1]); jLabel25.setText((String)param[0]); jLabel26.setText(""+(Double)param[1]); jLabel27.setText(""+(Integer)param[2]); jLabel28.setText(""+(Integer)param[3]); jLabel29.setText(""+(Double)param[4]); jLabel30.setText(""+(Integer)param[5]); jLabel31.setText(""+(Integer)param[6]); jLabel32.setText(""+(Integer)param[7]); jLabel33.setText(""+(Integer)param[8]); jLabel34.setText(""+(Integer)param[9]); jLabel35.setText(""+(Double)param[10]); jLabel36.setText(""+(Integer)param[11]); jLabel37.setText(""+(Double)param[12]); jLabel38.setText(""+(Integer)param[13]); jLabel39.setText(""+(Integer)param[14]); jLabel40.setText(""+(Integer)param[15]); jLabel41.setText(""+(Integer)param[16]); jLabel42.setText(""+(Double)param[17]); jLabel43.setText(""+(Integer)param[18]); jLabel44.setText(""+(Integer)param[19]); jLabel45.setText(""+(Integer)param[20]); jLabel46.setText(""+(Integer)param[21]); }catch(SQLException e) { Logger.getLogger(SimulatorGui.class.getName()).log(Level.SEVERE, null, e); } } private void changeSimulation(java.awt.event.ActionEvent e) { String run = simulationChosen.getSelectedItem().toString(); System.ou…
has answer: http://stackoverflow.com/a/24054935
tagged with: java
possible better answer: http://stackoverflow.com/a/24055191
has answer: http://stackoverflow.com/a/24055191
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24054935

http://stackoverflow.com/comment/37093673
score: 0
type: AnswerComment
has text: I wonder however if Spring would actually call `setApplicationContext` if the class is not a Spring bean. If have never tried that, but my guess would be that it won't since I doubt Spring scans the entire classpath for classes that implement the interface
type: Comment
comment on: http://stackoverflow.com/a/24057250

http://stackoverflow.com/q/24053976
accepted answer: http://stackoverflow.com/a/24054099
tagged with: java
has comment: http://stackoverflow.com/comment/37088122
downvote count: 1
type: Question
upvote count: 0
tagged with: database
has comment: http://stackoverflow.com/comment/37088373
has title: how to create two tables in one SQLite DB by two SqliteHelpers
has comment: http://stackoverflow.com/comment/37087952
tagged with: android
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/24054099
has comment: http://stackoverflow.com/comment/37088193
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/37087479
has body: I have two SQLiteOpenHelper classes: public class SQLiteHelper1 extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = PublicMacros.My_DB; private static final String TABLE_NAME = "table1"; public class SQLiteHelper2 extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = PublicMacros.My_DB; private static final String TABLE_NAME = "table2"; When I use SQLiteHelper1 followed by SQLiteHelper2 I get an error saying: no such table "table2" How can I create the two tables from two different SqliteHelpers?
type: AnsweredQuestion

http://stackoverflow.com/q/24015314
downvote count: 2
tagged with: string
has answer: http://stackoverflow.com/a/24015407
favorite count: 0
upvote count: 18
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/24015424
type: AnsweredQuestion
tagged with: java
has body: Given a string with a number of underscore characters, how can it be split into two substrings around the last underscore character? eg. "a_b_c" => ["a_b", "_c"]
score: 16
has title: How to split a string into 2 at the last occurrence of an underscore character
accepted answer: http://stackoverflow.com/a/24015353
type: Question
has answer: http://stackoverflow.com/a/24015390
possible better answer: http://stackoverflow.com/a/24015407
has answer: http://stackoverflow.com/a/24015353

http://stackoverflow.com/comment/37011478
score: 1
comment on: http://stackoverflow.com/q/24012781
has text: You can't guarantee that they will execute sequentially, with nothing from another task in-between. You *can*, however somehow lock access to the data so that only one thread accesses it at a time. But carefully note that any lock is ultimately *cooperative* -- the other thread must use the same locking protocol.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24044567
has title: NoClassDefFoundError Exception when running jar file
tagged with: jar
linked to: http://stackoverflow.com/q/502960
has body: I downloaded the following link: http://www.java2s.com/Code/JarDownload/java/java-json.jar.zip I then added the jar to the build path: Right click the Project > Build Path > Configure build path > Select Libraries tab > Click Add External Libraries > Select the Jar file Download. I was able to use the java-json library without eclipse giving any errors. However, when I went to export the project to a jar, there was no option to include the java-json Referenced Libraries as part of the jar. So I assumed that by adding the libraries to the Build Path, I did not have to export the external jars (there was no option to do that anyway): After I created the jar, I ran the program: java -jar gateway.jar -p 1732 And I got the following error: Exception in thread "Thread-0" java.lang.NoClassDefFoundError: org/json/JSONException at com.guarddoggps.main.UdpServer.run(UdpServer.java:28) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.json.JSONException at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more It seems that the runtime cannot find the class JSONException even though it is clearly in the java-json.jar file I included in the build path and is present in "Referenced Libraries" in Eclipse. What might I be missing here?
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24045252
type: Question
has answer: http://stackoverflow.com/a/32117730
answer count: 2

http://stackoverflow.com/comment/37124460
score: 0
type: QuestionComment
has text: Look into [this](http://stackoverflow.com/questions/17939431/how-to-perform-pagination-in-jsp)
type: Comment
comment on: http://stackoverflow.com/q/24073864

http://stackoverflow.com/comment/37079791
has text: This doesn't look like the strategy pattern, just polymorphism. The point of the Strategy is to let the context decide on the strategy. If you're choosing the strategy manually, you are just using an object.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24047871

http://stackoverflow.com/comment/37185347
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24104867
has text: hi, thank you ^^ for the jpg format, my problem is that when I use the ImageIO.write(imgStega, "jpeg", file) I have a compression of my image and some of the changes I made on my image are lost, because some R,G,B components of the pixels change. Do you know a way to force a "lossless" compression of jpg with this function (or another one) ? I tried some but it didn't work. For the png format, my modifications are not lost but the weight of my image goes from 708ko to 707ko, and I don't see why (you can't compress a png with png, right ?)
score: 0

http://stackoverflow.com/a/23981336
score: 1
has comment: http://stackoverflow.com/comment/36953922
has comment: http://stackoverflow.com/comment/36952810
has comment: http://stackoverflow.com/comment/36953201
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36953360
answers question: http://stackoverflow.com/q/23981281
type: Answer
has body: I am assuming that your project and applications are distinct entities.Also, by Project I assume that you are referring to an Eclipse/IntelliJ/Netbeans project You would need to set the correct classpaths for the Project and your application separately. If you are using the IDE to debug your project, your project would need to include the new JAR that you have downloaded. Each IDE has it's own mechanism for adding dependencies to the Project's classpath and hence you would want to refer to the documentation related to that IDE. For your application you can launch it as java MyApp -cp "path to the old JAR". If you are packaging your application as a JAR, make sure you are packaging the older version of Guava. Hope this helps. Edit based on the discussion with the owner of the question The query here is similar to this SO query. The right way to hence resolve this issue would be either install a Custom ClassLoader or use OSGi
accepted answer of: http://stackoverflow.com/q/23981281
has comment: http://stackoverflow.com/comment/36951783
upvote count: 1
has comment: http://stackoverflow.com/comment/36954041

http://stackoverflow.com/comment/36904923
type: AnswerComment
has text: You have to compare the logs yourself - SO is not a debugging service. Put a breakpoint on the line where the error occurs. Run the app in a debugger - stop at the breakpoint and check what is going on and which variable is `null` - then try to understand why it is `null` - do yourself a favour and learn to debug.
comment on: http://stackoverflow.com/a/23955806
type: Comment
score: 1

http://stackoverflow.com/a/26149564
downvote count: 0
has body: I was facing the same problem, but it seems that WildFly simply needs a reload after new Java Mail settings are applied. Try restarting WildFly, and it should use your new settings.
score: 1
answers question: http://stackoverflow.com/q/24097007
upvote count: 1
type: Answer

http://stackoverflow.com/q/24104100
answer count: 1
score: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24104316
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Having issues deserializing a JSON response. The response received from the server is as follows: { "type": "success", "message": { "SERVER_INFO": { "map": "MP_Prison", "gameId": "360287970194292378", "gameExpansions": [ 0 ], "mapMode": "64", "ip": "192.168.0.1", "matchId": "0", "protocolVersionString": "4202", "extendedInfo": { "message": "", "bannerUrl": "", "desc": "" }, "game": 2048, "ranked": 1, "online": 1, "platform": 1, "updatedAt": 1402212153, "slots": { "8": { "current": 0, "max": 2 }, "1": { "current": 0, "max": 20 }, "2": { "current": 38, "max": 64 } }, "guid": "", "port": 25200, "punkbuster": 1, "playlist": 0, "gameExpansion": 0, "name": "", "settings": { "vgmc": 125, "vfrm": 0, "v3ca": 1, "vtbr": 100, "vaba": 1, "vmst": 2, "vmsp": 1, "v3sp": 1, "osls": 0, "vprt": 100, "vbdm": 100, "vvsa": 1, "vkca": 1, "vvsd": 100, "vffi": 0, "vtkk": 3, "vhit": 1, "vnit": 86400, "vrtl": 300, "vtkc": 5, "vhud": 1, "vmin": 1, "vrhe": 1, "vcmd": 0, "vshe": 100, "vnta": 1, "vrsp": 4, "vmpl": 0 }, "fairfight": 1, "region": 1, "mapVariant": 0, "ping": 999, "serverType": 2, "experience": "0", "hasPassword": 0, "maps": { "maps": [ { "mapMode": "64", "map": "MP_Prison", "mapVariant": 0 } ], "currentMapRound": 1, "nextMapIndex": 0, "currentMapIndex": 0, "numberMapRounds": 2 }, "secret": "", "preset": 1, "pingSite": "iad", "country": "us" } } } I have constructed the following class tree so to speak to deserialize to: public class ServerInformation { private String jsonStr; public ServerInformation(String jsonStr) { this.jsonStr = jsonStr; } public Container deserialize(){ Gson gson = new Gson(); Container container = gson.fromJson(jsonStr, Container.class); return container; } class Container { private List&lt;Message&gt; message; private String type; private Data data; } class Message { @SerializedName("SERVER_INFO") private List&lt;ServerInfo&gt; serverInfo; } class ServerInfo { private String map; private int gameId; //private int[] gameExpansions; private int mapMode; privat…
tagged with: gson
has title: Nested JSON object to java with GSON

http://stackoverflow.com/comment/37003766
has text: @Pphoenix: No I am not interested in TAT, where every other letter is a T. Ideally I would like to replace A{3,} with A, TA{3,} with TAT{3,} and so on. Hence repeating patterns of one or more continuous characters.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24008657

http://stackoverflow.com/a/24035239
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24034165
has comment: http://stackoverflow.com/comment/37140937
has body: The method dosome in the abstract class, the caller has the option to invoke any type of class as long it a sometype of Number abstract public void dosome(Class&lt;? extends Number&gt; c); But you overridden the method like public void dosome(Class&lt;Number&gt; c) {} which will prevent the user from invoking any type of Number, meaning you cannot invoke with integer type. By the rules of overriding, you cannot change the method parameters. So, Class&lt;? extends Number&gt; and Class&lt;Number&gt; are not the same, its two different type of parameter and that's why its a compiler error.
has comment: http://stackoverflow.com/comment/37140330

http://stackoverflow.com/q/23975665
downvote count: 1
has answer: http://stackoverflow.com/a/23975710
has title: Double Values Increases Randomly
tagged with: java
has comment: http://stackoverflow.com/comment/36940886
has comment: http://stackoverflow.com/comment/36940902
has comment: http://stackoverflow.com/comment/36940896
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36940879
accepted answer: http://stackoverflow.com/a/23975710
has answer: http://stackoverflow.com/a/23975685
has answer: http://stackoverflow.com/a/23975699
type: Question
has comment: http://stackoverflow.com/comment/36941066
has answer: http://stackoverflow.com/a/23975691
score: 1
possible better answer: http://stackoverflow.com/a/23975685
favorite count: 0
upvote count: 2
has body: The double Value increases randomly. for(double i=-1;i&lt;=1;i+=0.1) { for(double j=-1;j&lt;=1;j+=0.1) { //logic system.out.print(i); system.out.print(j); } } Here, the value comes like: -1, -0.9, -0.8, -0.69, -0.51 ....-0.099 , 1.007 (WHY, U ARE GREATER THAN 1) The output is not same but kind of this. But, I want the exact values only. WHat should I do ??

http://stackoverflow.com/a/24092210
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37170062
accepted answer of: http://stackoverflow.com/q/24091393
type: Answer
answers question: http://stackoverflow.com/q/24091393
has body: You can't. Android doesn't come with a Java 7 VM. The Dalvik VM it uses is not compatible.

http://stackoverflow.com/a/23988880
score: 1
answers question: http://stackoverflow.com/q/23987988
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23987988
type: Answer
has body: Changed version of spring-data-mongodb from '1.5.0.RC' to '1.5.0.RELEASE' and version of spring-data-commons from '1.8.0.RC1' to '1.8.0.RELEASE' and it fixed the problem. Probably api was changed and 'NoSuchMethodError' no longer appears.
downvote count: 0

http://stackoverflow.com/comment/37106249
type: QuestionComment
comment on: http://stackoverflow.com/q/24063270
has text: I guess you need to add `<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>` to your `viewResolver` bean. Check here: http://docs.spring.io/spring/docs/3.0.0.M3/reference/html/ch16s05.html and search for `InternalResourceViewResolver` configuration.
score: 0
type: Comment

http://stackoverflow.com/q/24037409
favorite count: 0
has title: Set java.library.path for tomcat
score: 3
linked to: http://stackoverflow.com/q/15961483
has answer: http://stackoverflow.com/a/32607816
upvote count: 3
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/14018817
has body: I am currently trying to get a Tomcat-Application running with Maven with a native library, which needs a specified java.library.path. Normaly, for running Tomcat with the path, one has to do things like adding the path to Tomcat: How to add a native library in Tomcat? . But in this case, I want to run Tomcat with the Maven plugin, and unfortunately, I couldn't find any hint on how to set java.library.path for the Tomcat-Maven plugin. Just setting argLine with -Djava.library.path=XX does not work. Does anybody have an idea how to include native libraries with the Tomcat-Maven plugin? One way that should work according to https://groups.google.com/forum/#!msg/maven-nar/1mz9oWj-65U/dbQEK_6DLdYJ is setting the path with System.setProperty("java.library.path", javaLibPath); and afterwards let the classloader reload this with Field field = ClassLoader.class.getDeclaredField("sys_paths"); field.setAccessible(true); field.set(null, null); Unfortunately, for me this does not work, the error is thrown anyway. (This hint is also given by http://blog.cedarsoft.com/2010/11/setting-java-library-path-programmatically/). Another way (not to solve the real problem, but to workaround that I don't know a way to load set java.library.path in the Tomcat-Maven plugin) seems to be to add the library during the programs run, like described for example here: Directory separator should not appear in library name: Macintosh HD/Users/sakkisetty/Documents/dll/FasExtend.dll. Unfortunately, this does not work either. File f2 = new File("/home/my/absolute/path"); for (File f : f2.listFiles()){ System.out.println("Datei: " + f.getAbsolutePath()); if (f.isFile() &amp;&amp; f.getName().endsWith(".so")){ System.out.println("Loading: " + f.getAbsolutePath()); // System.loadLibrary(f.getName()); System.load(f.getAbsolutePath()); } } There are two possible results of this: If I try it like this, the same errors are thrown as if the libraries aren't loaded at all. If I use System.loadLibrary, it does not…
has answer: http://stackoverflow.com/a/25392459
tagged with: java
has answer: http://stackoverflow.com/a/24201045
linked to: http://stackoverflow.com/q/15758095
type: Question
answer count: 3
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/comment/37114855
type: Comment
comment on: http://stackoverflow.com/a/24068096
has text: Doh, the "w" in "TeamworkAPI" was capitalized. When I fixed the case, this error was raised: "ClassNotFoundException TeamworkAPI. java.net.URLClassLoader$1.run (URLClassLoader.java:366)"
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36924041
type: QuestionComment
has text: A stack and a for loop will be enough to build the tree. Could you give it a go now?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23966228

http://stackoverflow.com/a/24237225
type: Answer
answers question: http://stackoverflow.com/q/24099904
score: 0
has body: Your persistence.xml should point to which datasource to use: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence java:jboss/datasources/MySqlDS <properties/> (Putting driver jars in WEB-INF/lib is not needed because you've already created a module)

http://stackoverflow.com/comment/120994313
has text: This screams for https://openjdk.java.net/projects/code-tools/jmh/ ;-)
type: AnswerComment
comment on: http://stackoverflow.com/a/36522058
type: Comment
score: 1

http://stackoverflow.com/comment/36962355
type: Comment
comment on: http://stackoverflow.com/a/23965554
score: 0
has text: This sounds good. let me try this out and let you know. Thanks !
type: AnswerComment

http://stackoverflow.com/a/24064598
score: 10
upvote count: 10
answers question: http://stackoverflow.com/q/24049608
has comment: http://stackoverflow.com/comment/37148929
has comment: http://stackoverflow.com/comment/37123585
downvote count: 0
has comment: http://stackoverflow.com/comment/37147864
has body: The code snippet you found is a bad example, since it uses an AsyncFunction for something that is computed synchronously. It's needlessly verbose. The code would be cleaner using a standard Function: Futures.transform(someFuture, new Function&lt;A, B&gt;() { public B apply(A a) { if (a != null) { return a.getData(); } else { throw checkException(); } }); }); You should use an AsyncFunction when the code that transforms A to B is asynchronous. In your example, it's possible that the code was asynchronous at first, and was later changed to use Futures.immediateFuture() / Futures.immediateFailedFuture() by a programmer who didn't bother replacing the AsyncFunction with a Function. Or maybe he just missed the overloaded method.
has comment: http://stackoverflow.com/comment/37145789
has comment: http://stackoverflow.com/comment/37149219
type: Answer
has comment: http://stackoverflow.com/comment/37148042
has comment: http://stackoverflow.com/comment/37146465
has comment: http://stackoverflow.com/comment/37148511
has comment: http://stackoverflow.com/comment/37145631
has comment: http://stackoverflow.com/comment/37147700
has comment: http://stackoverflow.com/comment/37149860
has comment: http://stackoverflow.com/comment/37147402

http://stackoverflow.com/q/23970429
tagged with: eclipse
score: 0
has body: i am using checkStyle eclipse plugin ,but the labels of the plugin are not displayed correctly, i am using the current version 5.7.0.201402131929 So i wonder if there is any suggestions ? Thank you
answer count: 1
tagged with: eclipse-plugin
tagged with: checkstyle
type: UnansweredQuestion
has title: CheckStyle Eclipse Plugin don't display the labels correctly
has answer: http://stackoverflow.com/a/23970525
tagged with: java
type: Question

http://stackoverflow.com/comment/37138169
comment on: http://stackoverflow.com/q/24081448
type: QuestionComment
has text: There are only 22 'B' codes and it's unlikely they are going to be modified in any way, the 'T' code being preferred. That being the case, you could simply hardcode a 'T' to 'B' map for the 22 codes and replace the 'T' with the 'B' when such a substitution is available. While you can't extend Locale since it's final, it would be a pretty trivial method in a utility class.
type: Comment
score: 1

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/24057041

http://stackoverflow.com/comment/37131388
type: QuestionComment
has text: Don't downvote the question. ALthough it's JAVA 101 (or even OO 101), it helps other beginners. See this Q&A for clarification: http://meta.stackoverflow.com/questions/255723/i-asked-a-really-really-stupid-question
score: 1
comment on: http://stackoverflow.com/q/24077391
type: Comment

http://stackoverflow.com/comment/37173097
type: Comment
type: QuestionComment
has text: doesen't work yet. it never change raw selected background.
comment on: http://stackoverflow.com/q/24099454
score: 0

http://stackoverflow.com/comment/37024074
comment on: http://stackoverflow.com/a/24019224
type: AnswerComment
type: Comment
score: 0
has text: [`try(Statement s=connection.createStatement()) { return s.execute(sql); }`](http://docs.oracle.com/javase/7/docs/technotes/guides/language/try-with-resources.html)

http://stackoverflow.com/comment/37019508
has text: Could you use the userid to achieve the same?
score: 0
comment on: http://stackoverflow.com/q/24017653
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24042516
answer count: 2
has comment: http://stackoverflow.com/comment/37067009
has comment: http://stackoverflow.com/comment/37066833
has comment: http://stackoverflow.com/comment/37066462
tagged with: java
accepted answer: http://stackoverflow.com/a/24042711
possible better answer: http://stackoverflow.com/a/24042701
has answer: http://stackoverflow.com/a/24042701
score: 2
has comment: http://stackoverflow.com/comment/37066672
downvote count: 0
has comment: http://stackoverflow.com/comment/37066934
tagged with: string
has title: Multiple uses of replaceAll() String method
type: Question
type: AnsweredQuestion
tagged with: replaceall
tagged with: regex
has answer: http://stackoverflow.com/a/24042711
favorite count: 0
has body: I am doing some text preprocessing and I am using the replaceAll() method at least 10 times. This is starting to get inefficient I am afraid. My code is like: text = text.replaceAll(regex1, "rStr"); text = text.replaceAll(regex2, "rStr2"); . . . text = text.replaceAll(regexn, "rStrn"); I thought I'd use StringBuilder in order to avoid making new strings all the time, but I didn't notice much difference. StringBuilder sb = new StringBuilder(); sb.append(text.replaceAll(regex1, "rStr")); sb.replace(0, sb.length(), sb.toString().replaceAll(regex2, "rStr2")); . . . sb.replace(0, sb.length(), sb.toString().replaceAll(regexn, "rStrn")); Any ideas how to make this code more efficient?
has comment: http://stackoverflow.com/comment/37066240
upvote count: 2
has comment: http://stackoverflow.com/comment/37067541

http://stackoverflow.com/comment/36971483
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23992093
has text: `libstdc++` is this coming as a .jar? make sure it is in your build path
score: 0

http://stackoverflow.com/comment/36972954
comment on: http://stackoverflow.com/a/23991661
has text: @Shakti that changes the problem. Can we drop the `i != j` because then you have an O(N log N) problem?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37183467
score: 1
has text: what is `contentPane` here?
comment on: http://stackoverflow.com/q/24104820
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23956677
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36906048
type: Answer
has comment: http://stackoverflow.com/comment/36906209
has body: int filesize=65383; byte [] mybytearray2 = new byte [filesize]; You don't know the filesize at forehand. Moreover you send a file of 233kB and trying to read all in mybytearray2 will give you a bufferoverflow and your server will crash. By the way: from where did you get/copy this code? I saw it before. I'ts no good.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23955638
accepted answer of: http://stackoverflow.com/q/23955638

http://stackoverflow.com/comment/36974863
type: QuestionComment
type: Comment
score: 0
has text: A webservice is not where I can go... and the SQL database would be way too big and I imagine quite slow to make millions of queries. I might have to look at the c++ option... but it looks quite complicated to set up. I googled a couple of eclipse tutorials and they are a bit out of my league I'm afraid.
comment on: http://stackoverflow.com/q/23976985

http://stackoverflow.com/q/23965255
has title: Why doesn't any frame shown when run in linux?
favorite count: 0
tagged with: jframe
has body: I have the following code.When I run it on Windows the frame appears.But when I run on Linux nothing appears. I tried to place show() below the line contentPane.setLayout(null); inside the constructor.That showed the form.But no labels or buttons were inside.Please help: public class MainFrame extends JFrame { private JPanel contentPane; Process p; String s; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainFrame frame = new MainFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public MainFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 549, 426); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblRam = new JLabel("RAM"); lblRam.setFont(new Font("Tahoma", Font.PLAIN, 48)); lblRam.setBounds(212, 0, 140, 77); contentPane.add(lblRam); final JTextArea textArea = new JTextArea(); textArea.setBounds(10, 88, 384, 215); contentPane.add(textArea); JButton btnRamInfo = new JButton("System Memory"); btnRamInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { textArea.setText(""); repaint(); try{ p = Runtime.getRuntime().exec("cat /proc/meminfo"); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((s = br.readLine()) != null) textArea.setText(s); p.waitFor(); p.destroy(); } catch(Exception e) { } } }); btnRamInfo.setBounds(404, 139, 119, 34); contentPane.add(btnRamInfo); try{ p = Runtime.getRuntime().exec("free -ms 5"); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((s = br.readLine()) != null) textArea.setText(s); p.waitFor(); System.out.println ("exit: " + p.exitValue()); p.destroy(); } catch(Exception e) { } JButton btnNewButton = new JButton("Advanced"); btnNewButton.addAc…
tagged with: swing
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36922481
has comment: http://stackoverflow.com/comment/36922819
type: Question
accepted answer: http://stackoverflow.com/a/23965512
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/36922360
has answer: http://stackoverflow.com/a/23965512
upvote count: 1
tagged with: user-interface
answer count: 1

http://stackoverflow.com/a/23963981
has comment: http://stackoverflow.com/comment/36937169
answers question: http://stackoverflow.com/q/23944088
score: 0
type: AcceptedAnswer
type: Answer
has body: What about using Buttons to push? The example below shows a table with one button a row. Use a Button with the text you want to display and add a picture beside it. Table scrollableTable = new Table(skin); scrollableTable.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); for(WeaponElement weapon : GameScreen.dataLoader.getWeaponArray()){ final TextButton button = new TextButton(wapon.name, skin, "default"); button.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { // do stuff }); scrollableTable.add(button).center(); // add a picture Image img = new Image(new Texture(weapon.getIconPath())); scrollableTable.add(img).width(32); // finish a row scrollableTable.row(); }
accepted answer of: http://stackoverflow.com/q/23944088

http://stackoverflow.com/a/38279853
answers question: http://stackoverflow.com/q/24080541
downvote count: 0
type: Answer
upvote count: 6
score: 6
has body: I was running with Hadoop 2.7.2 using Spring-boot, the following Hadoop dependencies uses javax.servlet which prevented the embedded tomcat version to start. Below exclusions in my POM fixed the issue. org.apache.hadoop hadoop-hdfs 2.7.2 servlet-api javax.servlet org.springframework.data spring-data-hadoop-boot 2.3.0.RELEASE-hadoop26 servlet-api javax.servlet org.apache.hadoop hadoop-common 2.7.2 slf4j-log4j12 org.slf4j servlet-api javax.servlet

http://stackoverflow.com/comment/36890082
has text: Your claimed requirement does not appear in either the current [Java Language Specification](http://docs.oracle.com/javase/specs/jls/se8/jls8.pdf) or the current [Java Virtual Machine Specification](http://docs.oracle.com/javase/specs/jvms/se8/jvms8.pdf).
comment on: http://stackoverflow.com/q/23947217
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41887607
score: 0
type: Comment
has text: possible duplicate of [errors in transaction in jena tdb?](http://stackoverflow.com/questions/24349035/errors-in-transaction-in-jena-tdb)
type: QuestionComment
comment on: http://stackoverflow.com/q/23977417

http://stackoverflow.com/a/23947624
accepted answer of: http://stackoverflow.com/q/23947460
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23947460
has body: 12 x 8 x 6000 doubles are not going to take up a significant amount of memory If your program's speed is getting slower each time until it eventually crashes with an OutOfMemoryError, then it's possible that you have a coding error that is causing a memory leak. This question has some examples of memory leak causes in Java. Using VisualVM or some manual logging will help to identify the issue. Static code anaylsers like FindBugs or PMD may also help.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24046913
tagged with: transactions
tagged with: java
tagged with: hibernate
answer count: 2
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/27743754
has answer: http://stackoverflow.com/a/24047118
favorite count: 0
has answer: http://stackoverflow.com/a/27743754
has title: Not active transaciotn: javax.persistence.TransactionRequiredException: Executing an update/delete query
tagged with: spring
upvote count: 6
has body: why is my transaction not active? I have this message: "javax.persistence.TransactionRequiredException: Executing an update/delete query" I can't find why aplicationContext: <?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:c="http://www.springframework.org/schema/c" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd"> <context:annotation-config /> <context:component-scan base-package="com.model.dao" /> <entry key="hibernate.connection.useUnicode" value="true" /> <entry key="hibernate.connection.characterEncoding" value="UTF-8" /> <entry key="hibernate.jdbc.batch_size" value="30" /> DAO Impl @Component public class UserDaoImpl implements UserDao { @PersistenceContext(unitName="punit") private EntityManager em; protected UserDaoImpl() { } //other ovverrides like find, get @Override @Transactional public void deleteUser(String mail, String password) { Query q = em.createQuery("DELETE FROM User u WHERE u.mail='" + mail + "'AND u.password='" + password + "'"); try{ q.executeUpdate(); this.em.flush(); }catch (PersistenceException pe){ pe.printStackTrace(); } } } persistence.xml <?xml version="1.0"?> org.hibernate.ejb.HibernatePersistence RemoveUser public class RemoveUser extends BaseAction{ private static final long serialVersionUID = 1L; private String mail; private String password; User user; @Autowired UserD…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24047118
score: 6
type: Question

http://stackoverflow.com/comment/36898442
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23952906
type: AnswerComment
has text: Thanks again @gau123 (+1) - just curious as to how this works though...if I don't specify "http://", then what if I want to use SSL (https)?

http://stackoverflow.com/q/23974647
has comment: http://stackoverflow.com/comment/36939450
favorite count: 0
tagged with: double
tagged with: android
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23982791
tagged with: java
type: Question
has title: Update sqlite row with filter of double values (latitude/longitude) doesnt work
tagged with: google-maps
has answer: http://stackoverflow.com/a/23982791
upvote count: 2
has comment: http://stackoverflow.com/comment/36945436
tagged with: sqlite
answer count: 1
has body: I want to update my values in SQLite database by latitude/longitude(converted doubles to strings) criteria.This update works but not always.Sometimes it doesnt update row with existing latitude/longitude.I think its some problem with comparing SQLite REAL type numbers. public static final String ACCOUNT_FILTER = "account = ?"; public static final String LAT_LONG_FILTER = " AND latitude =? AND longitude =?"; getActivity().getContentResolver().update(FeedContract.Entry.CONTENT_URI, updateValues, ACCOUNT_FILTER+ LAT_LONG_FILTER, new String[] { accountName, Double.toString(marker.getPosition().latitude), Double.toString(marker.getPosition().longitude) }); and database structure: private static final String TYPE_TEXT = " TEXT"; private static final String TYPE_REAL = " REAL"; private static final String TYPE_INTEGER = " INTEGER"; private static final String COMMA_SEP = ","; private static final String SQL_CREATE_ENTRIES = "CREATE TABLE " + FeedContract.Entry.TABLE_NAME + " (" + FeedContract.Entry._ID + " INTEGER PRIMARY KEY," + FeedContract.Entry.COLUMN_NAME_POINT_ID + TYPE_INTEGER + COMMA_SEP + FeedContract.Entry.COLUMN_NAME_LATITUDE + TYPE_REAL + COMMA_SEP + FeedContract.Entry.COLUMN_NAME_LONGITUDE + TYPE_REAL + COMMA_SEP + FeedContract.Entry.COLUMN_NAME_DATE_OF_INSERT + TYPE_INTEGER + COMMA_SEP + FeedContract.Entry.COLUMN_NAME_TITLE + TYPE_TEXT + COMMA_SEP + FeedContract.Entry.COLUMN_NAME_INFO + TYPE_TEXT + COMMA_SEP + FeedContract.Entry.COLUMN_NAME_ACCOUNT + TYPE_TEXT + ")";
downvote count: 0

http://stackoverflow.com/a/23979636
type: Answer
score: 1
upvote count: 1
has body: You do not create instances by hand. The Factory uses guice to create all your Step-instances. Whenever you used "@Inject" in your Step-class, guice will take care of the injection automatically without you interfering with the injector. You can configure the injection by providing FQN of the modules you wont to load in a cucumber-guice.properties file. Useful links: Similar question on SO Sample on github
has comment: http://stackoverflow.com/comment/36969679
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23967393
has comment: http://stackoverflow.com/comment/36980019
accepted answer of: http://stackoverflow.com/q/23967393
has comment: http://stackoverflow.com/comment/36968619

gwt
tags question: http://stackoverflow.com/q/24007892
tags question: http://stackoverflow.com/q/24097297
tags question: http://stackoverflow.com/q/24054410
tags question: http://stackoverflow.com/q/24062077
tag name: gwt
tags question: http://stackoverflow.com/q/24029763
type: Tag
tags question: http://stackoverflow.com/q/23945498
tags question: http://stackoverflow.com/q/24075301
tags question: http://stackoverflow.com/q/24074894
tags question: http://stackoverflow.com/q/23957281
tags question: http://stackoverflow.com/q/24080165
tags question: http://stackoverflow.com/q/24036832
tags question: http://stackoverflow.com/q/24005486
tags question: http://stackoverflow.com/q/24030528
tags question: http://stackoverflow.com/q/23996217
tags question: http://stackoverflow.com/q/23958028
tags question: http://stackoverflow.com/q/23944873
tags question: http://stackoverflow.com/q/24078671
tags question: http://stackoverflow.com/q/23957705
tags question: http://stackoverflow.com/q/23954875
tags question: http://stackoverflow.com/q/23994323
tags question: http://stackoverflow.com/q/23952603
tags question: http://stackoverflow.com/q/24041553
tags question: http://stackoverflow.com/q/23962606
tags question: http://stackoverflow.com/q/23957409
tags question: http://stackoverflow.com/q/23951796
tags question: http://stackoverflow.com/q/24036146
tags question: http://stackoverflow.com/q/24074507

http://stackoverflow.com/q/24012503
tagged with: python
score: 2
tagged with: openxml
downvote count: 0
tagged with: java
tagged with: excel
type: Question
upvote count: 2
answer count: 1
has title: SpreadsheetML: How should consuming applications parse floating-point numbers?
has body: I'm having some difficulty understanding Excel's handling of cell values which are not exactly representable in IEEE 754 floating point. My motivating example can be achieved by saving a spreadsheet from Excel 2010 or 2013 in xlsx format with a single number in cell A1 of sheet 1. Then, edit the underlying XML and replace that cell's value to look like this: <v>62408.000000000007</v> That number has 17 significant digits, and cannot be represented exactly in IEEE 754 floating point. Parsing the string "62408.000000000007" as a double-precision floating point number in Java and Python gives 62408.00000000001, which has one fewer significant digit and can be represented exactly. Both of these programming languages claim to implement (a subset of) IEEE 754. However, Excel 2010 and 2013, presented with that file, display 62408 in the UI (and no matter how many decimal places you specify in the number format, only zeroes appear after the decimal point). So Excel seems to parse that cell value as 62408 exactly. Can anyone point me to a definitive reference for how applications should parse a floating point number from a SpreadsheetML (xlsx) file's v element inside a cell? What would also be useful is a definitive reference on how Excel does it. I have tried to examine the Office Open XML standard reference documents at http://www.ecma-international.org/publications/standards/Ecma-376.htm However, beyond finding that the v element has type ST_Xstring in this context, I can't find anything about how to parse cell values, especially as numbers.
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24036700

http://stackoverflow.com/comment/36992629
type: Comment
has text: So how can I solve this one ?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24002752

http://stackoverflow.com/comment/36897150
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23951882
has text: I don't really understand what is your objective. "Align to the top" does not really make sense. Are we talking vertical disposition? Horizontal?
type: QuestionComment

http://stackoverflow.com/q/23969219
has body: I'm currently working on a "Google app engine" app using the Eclipse plugin. I've written the first slice of the application but I'm having real trouble ensuring that everything is being included. My app compiles just fine but when it starts to run it throws: Could not instantiate listener com.mypackage.development.MyClass java.lang.ClassNotFoundException: com.mypackage.development.MyClass Where "MyClass" is a local class that I have written. It then procedes to throw: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer Then: javax.servlet.UnavailableException: com.sun.jersey.spi.container.servlet.ServletContainer And so on, presumably as it makes it's way through web.xml. I'm importing the 1.17.1 jersey-core, -servlet, -server, -json using Maven so I can't see why that should occur and, as I say, it all compiles correctly. It almost seems as if my classes and external libraries aren't being included in the build, is there perhaps something I'm missing here? I've been tearing my hair out over it all morning and i'm really at a loss, I feel like I've tried everything! I've included my web.xml and my gwt.xml (the latter of which is located inside src/com/mypackage/development) in the hope that it might help shed some light on this issue! http://www.sendspace.com/file/7peiyx http://www.sendspace.com/file/vw44yv
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23969263
tagged with: eclipse
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: maven
has title: Classes and libraries not being included in Google App Engine web application?

android-fragments
tags question: http://stackoverflow.com/q/23982368
tags question: http://stackoverflow.com/q/24046049
tags question: http://stackoverflow.com/q/24026072
tags question: http://stackoverflow.com/q/24083788
tags question: http://stackoverflow.com/q/23968898
tags question: http://stackoverflow.com/q/24092290
tags question: http://stackoverflow.com/q/24034817
tags question: http://stackoverflow.com/q/24054053
tags question: http://stackoverflow.com/q/23951815
tags question: http://stackoverflow.com/q/24004574
tags question: http://stackoverflow.com/q/24095623
tags question: http://stackoverflow.com/q/24066487
tags question: http://stackoverflow.com/q/24102057
tags question: http://stackoverflow.com/q/23984165
type: Tag
tags question: http://stackoverflow.com/q/23987743
tags question: http://stackoverflow.com/q/24009971
tags question: http://stackoverflow.com/q/24059852
tags question: http://stackoverflow.com/q/23974711
tags question: http://stackoverflow.com/q/24010912
tags question: http://stackoverflow.com/q/23960689
tags question: http://stackoverflow.com/q/24046836
tags question: http://stackoverflow.com/q/24061748
tags question: http://stackoverflow.com/q/24056424
tags question: http://stackoverflow.com/q/24044963
tags question: http://stackoverflow.com/q/24062883
tags question: http://stackoverflow.com/q/24076767
tags question: http://stackoverflow.com/q/23964064
tags question: http://stackoverflow.com/q/24088621
tags question: http://stackoverflow.com/q/24100168
tags question: http://stackoverflow.com/q/24046008
tags question: http://stackoverflow.com/q/24013375
tags question: http://stackoverflow.com/q/24041293
tags question: http://stackoverflow.com/q/23954936
tags question: http://stackoverflow.com/q/24082950
tags question: http://stackoverflow.com/q/24006181
tags question: http://stackoverflow.com/q/24094686
tags question: http://stackoverflow.com/q/24013152
tags question: http://stackoverflow.com/q/24078307
tags question: http://stackoverflow.com/q/24091654
tags question: http://stackoverflow.com/q/24082184
tag name: android-fragments
tags question: http://stackoverflow.com/q/23959760

http://stackoverflow.com/a/24072853
type: Answer
upvote count: 1
score: 1
has body: Philip, I just copied your code and pasted it in a java project. The source code is below along with a screen shot of the output. I didn't make any changes to the Patient class; just copied and pasted it into my project. Test.java: import java.util.ArrayList; import java.util.Collections; public class Test { static String[] newFName = { "Mark", "Andy", "Bryan" }; static String[] newLName = { "Uy", "Igy", "Nator" }; static String[] newMName = { "Wi", "Menos", "Pat" }; static String[] newID = { "3", "5", "1" }; static ArrayList&lt;Patient&gt; patientList; public static void main(String[] args) { createPatientList(); System.out.println("Before: "); for (Patient p : patientList) { System.out.println(p.lname); } sortPatient(1); System.out.println("\nAfter: "); for (Patient p : patientList) { System.out.println(p.lname); } } private static void createPatientList() { patientList = new ArrayList&lt;Patient&gt;(); for (int i = 0; i &lt; newFName.length; i++) { Patient patient = new Patient(); patient.lname = newLName[i]; patient.fname = newFName[i]; patient.mname = newMName[i]; patient.ID = newID[i]; patientList.add(patient); } } private static void sortPatient(int order) { switch (order) { case 1: Collections.sort(patientList, new Patient.OrderByLastName()); break; case 2: Collections.sort(patientList, new Patient.OrderByID()); break; default: break; } } } Screen shot:
has comment: http://stackoverflow.com/comment/37122511
downvote count: 0
answers question: http://stackoverflow.com/q/24055272

http://stackoverflow.com/comment/37126304
type: QuestionComment
has text: @ScaryWombat could you please tell more in case of example ? is this what you are saying ? HTTP://C:/Users/admin/Desktop/RetrievedFiles/FILE310@ST-testemp/abc.png"
comment on: http://stackoverflow.com/q/24074868
score: 0
type: Comment

http://stackoverflow.com/a/23946557
has body: it could be that the java string == operator checks for more than if the text is the same, as described here: String comparison with logical operator in Java what does it do if you use the string equals() method ? http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#equals(java.lang.Object)
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23946492
accepted answer of: http://stackoverflow.com/q/23946492
upvote count: 1
type: Answer
score: 1

http://stackoverflow.com/comment/36926238
score: 0
comment on: http://stackoverflow.com/q/23966937
has text: @etherous, yeah, that was one of my first thoughts when I've started thinking about this problem. But decided that maybe one of SO members knows the better way :-)
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23973362
score: 2
downvote count: 0
tagged with: mysql
has comment: http://stackoverflow.com/comment/36938385
has title: MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36936141
has comment: http://stackoverflow.com/comment/36936922
has answer: http://stackoverflow.com/a/26987581
upvote count: 2
has answer: http://stackoverflow.com/a/23974467
answer count: 2
favorite count: 0
type: UnansweredQuestion
has body: I have probed numerous questions and documentation on this error and cannot seem to find where I am going wrong. The error is on this line: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`flutweets`.`refs`, CONSTRAINT `refs_ibfk_1` FOREIGN KEY (`id`) REFERENCES `tweets` (`id`)) The database is MySQL, and I am using Workbench to inspect it; I also know that all the database engines are InnoDB and the Row Formats are Compact. I have three tables: tweets, hashtags, and references. Here is where I create the tables: tweets Table Statement stmt = null; try { stmt = connection.createStatement(); stmt.executeUpdate("CREATE TABLE " + TWEETS_TABLE + "(" + TWEETS_ID + " BIGINT NOT NULL AUTO_INCREMENT," + TWEETS_TIME + " VARCHAR(255)," + TWEETS_USER + " VARCHAR(255)," + TWEETS_TEXT + " VARCHAR(255) NOT NULL," + TWEETS_LOCATION + " VARCHAR(255)," + TWEETS_CITY + " VARCHAR(255)," + TWEETS_PROVINCE + " VARCHAR(255)," + TWEETS_COUNTRY + " VARCHAR(255)," + TWEETS_TIME_ZONE + " VARCHAR(255)," + TWEETS_LATITUDE + " DECIMAL(20,16)," + TWEETS_LONGITUDE + " DECIMAL(20,16)," + "PRIMARY KEY (" + TWEETS_ID + ")" + ")"); . . . hashtags Table Statement stmt = null; try { stmt = connection.createStatement(); stmt.executeUpdate("CREATE TABLE " + HASHTAG_TABLE + "(" + HASHTAG_ID + " BIGINT NOT NULL AUTO_INCREMENT," + HASHTAG_TEXT + " VARCHAR(255)," + TWEETS_ID + " BIGINT NOT NULL," + "PRIMARY KEY (" + HASHTAG_ID + ")," + "FOREIGN KEY (" + TWEETS_ID + ")" + "REFERENCES " + TWEETS_TABLE + "(" + TWEETS_ID + ")" + ")"); . . . references Table Statement stmt = null; try { stmt = connection.createStatement(); stmt.executeUpdate("CREATE TABLE " + REF_TABLE + "(" + REF_ID + " BIGINT NOT NULL AUTO_INCREMENT," + REF_TEXT + " VARCHAR(255)," + TWEETS_ID + " BIGINT NOT NULL," + "PRIMARY KEY (" + REF_ID + ")," + "FOREIGN KEY (" + TWEETS_ID + ")" + "REFERENCES " + TWEETS_TABLE + "(" + TWEETS_ID + ")" + ")"); Here ar…
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36936330

http://stackoverflow.com/a/23976634
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23955391
has body: Finally my problem got solved. Actually i couldnot get it previously. I found another version of oracle was installed on my system oracle 10.2.0. I think this was that which created problem.I removed both versions from my system and re-installed oracle 11g,and made some changes to my program and it worked. Here is my program with the changes: &lt;%@ page import="java.sql.*" %&gt; &lt;html&gt; &lt;body&gt; &lt;% Connection conn; Statement st; ResultSet rs; new oracle.jdbc.OracleDriver(); String dbURL="jdbc:oracle:thin:@localhost:1521:XE"; String userId="system"; String pwd="moon"; conn=DriverManager.getConnection(dbURL,userId,pwd); st=conn.createStatement(); rs= st.executeQuery("SELECT * FROM login"); while(rs.next()) {%&gt; &lt;%= rs.getString(1) %&gt; &lt;%= rs.getString(2) %&gt; &lt;% } %&gt; &lt;/body&gt; &lt;/html&gt;

http://stackoverflow.com/comment/37004799
type: QuestionComment
has text: Button's text can also be obtained from the string.xml configured for the locale.
comment on: http://stackoverflow.com/q/24009528
score: 0
type: Comment

http://stackoverflow.com/comment/37097743
has text: @sankrish have u registered on indyarocks.com because in the above code you have to enter your indyarocks id, password and email that you have registered over there
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24035165

http://stackoverflow.com/a/36366898
answers question: http://stackoverflow.com/q/23969953
score: 0
type: Answer
upvote count: 1
downvote count: 1
has body: Do not use ABSOLUTE PATH to refer to the name of the image for example: C:/xamp/www/Archivos/images/templatemo_image_02_opt_20160401-1244.jpg. You must use the reference to its location within webserver. For example using ../../Archivos/images/templatemo_image_02_opt_20160401-1244.jpg depending on where your process is running.

http://stackoverflow.com/comment/90390222
has text: For private fields/methods, see also: https://stackoverflow.com/questions/7852370/private-method-in-groovy-is-not-private It seems the linked jira ticket is now https://issues.apache.org/jira/browse/GROOVY-7246
comment on: http://stackoverflow.com/a/24044301
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37178501
has text: posting the essence of my answer here as a comment: In sum, deeming a language as "call by value" or "call by reference" is not very meaningful. The correct characterization is, whether a language allows automatic copying of data to prevent modification by callee, and whether a language allows creating pointers to allow a callee to modify primitives. Java doesn't allow either, and C++ allows both.
score: 1
comment on: http://stackoverflow.com/q/24101960
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24035326
has comment: http://stackoverflow.com/comment/37054323
tagged with: java
has answer: http://stackoverflow.com/a/24036728
has comment: http://stackoverflow.com/comment/37054743
type: Question
score: 8
has comment: http://stackoverflow.com/comment/37054483
has comment: http://stackoverflow.com/comment/37054264
downvote count: 0
tagged with: jackson
upvote count: 8
accepted answer: http://stackoverflow.com/a/24036728
answer count: 1
has body: OK I have a json say userjson = { fname : "ABC", lname : "DEF" } and a User Pojo Object User { String id, String email, String fname, String lname } now using the Jackson, I know how to create User instance from userjson, but how do i update existing User instance from userjson, because my user instance has some properties already set by some other Module. For now what i am doing is converting userjson to userHasMap and then set all the values manually userInstance.setFName(userHasMap.get('fname')) userInstance.setLName(userHasMap.get('lname')) which works fine, but I could have done some thing for converting userInstance to userjson when needed which would have made use of jackson-lib meaningless.
favorite count: 0
type: AnsweredQuestion
has title: Jackson : Updating (not creating new object) JavaObject from Json?
has comment: http://stackoverflow.com/comment/37055166

http://stackoverflow.com/comment/37026319
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24019504
type: Comment
has text: @dan why are you putting things in the host file? Your code should do reverse DNS without putting anything in host file.

http://stackoverflow.com/a/24036165
has body: First of all, if you want to display multiple rows of three values, you should display the total on its own row. Next, it's not really easy to deal with multiple submit buttons in a form, because you will have to test what is the label of the button that was clicked and it leads to complex operations as soon as you go into i18n. You should considere using a checkbox and a single submit button. Also, you have bean.setValues(values) in your loop when it should be after the loop. Anyway an &lt;input type="button" .../&gt; does not submit anything and can only trigger javascript. Now I suppose you found a way to determine in your servlet that you want to add a new row (checkbox or 2 submit buttons). You could change your bean.setValues(values) (gone out of loop ...) to something like : if (needAddRow) { String[] val2 = new String[values.length + 3]; val2[0] = 0; val2[1] = 0; val2[2] = 0; for (int i=0; i&lt; values.length; i++) { val[i+3] = values[i]; } bean.setValues(val2); } else { bean.setValues(values); } Beware : untested ...
answers question: http://stackoverflow.com/q/23952229
score: 0
type: Answer

http://stackoverflow.com/q/24036717
possible better answer: http://stackoverflow.com/a/24037031
has answer: http://stackoverflow.com/a/24076741
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24076741
tagged with: soap
favorite count: 0
has comment: http://stackoverflow.com/comment/37055156
has title: HTTP SOAP Post Request
downvote count: 1
type: AnsweredQuestion
has body: I need to send HTTP Request to publish some data in a WS E.g: http://localhost:8081/hello/publishAMANSequence/filter/sequenceGenerationTime=1696-09-01T00:00:00Z&amp;AMANId=B1&amp;landingSequenceEntry=11234567890EST I take this fault from server: Parameter should be ordered in the following sequence: [sequenceGenerationTime, AMANId, landingSequenceEntry] I'm doing something wrong in the order? mule flow: &lt;jms:activemq-connector name="Active_MQ1" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/&gt; &lt;flow name="jmsFlow1" doc:name="jmsFlow1"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" doc:name="HTTP"/&gt; &lt;cxf:jaxws-service doc:name="SOAP" serviceClass="aero.itec.amansequenceservice.AMANSequenceInfo"/&gt; &lt;component doc:name="Java" class="implementations.AMANSequenceImpl"/&gt; &lt;mulexml:object-to-xml-transformer doc:name="Object to XML"/&gt; &lt;jms:outbound-endpoint queue="StudioIN" connector-ref="Active_MQ1" doc:name="JMS"/&gt; &lt;logger message="#[message.payload]" level="INFO" doc:name="Logger"/&gt; &lt;/flow&gt;
tagged with: cxf
tagged with: java
has answer: http://stackoverflow.com/a/24037031
tagged with: mule
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24059391

http://stackoverflow.com/comment/37042988
type: Comment
type: QuestionComment
has text: Search using a different date and check what is the is returned, then u can try to find a logic comparing both
comment on: http://stackoverflow.com/q/24030010
score: 0

http://stackoverflow.com/comment/37026579
has text: Save the original reference of `System.out`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24021352

http://stackoverflow.com/q/23986771
has comment: http://stackoverflow.com/comment/36961982
downvote count: 3
has answer: http://stackoverflow.com/a/23986880
has title: java : When memory returns in method?
upvote count: 1
favorite count: 0
tagged with: return
type: UnansweredQuestion
tagged with: multithreading
has body: I know that the memory returns after the function ends. When does thread object is returned? - when does the variable A is returned? public AAA () { int a = 1; new thread() { public void run() { } }.start(); } sorry. When is A removed from the stack? after AAA() ends or thread ends? When is the thread object removed from the heap?
has answer: http://stackoverflow.com/a/23986972
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/36962205
tagged with: memory
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36961962
score: -2

http://stackoverflow.com/comment/36926660
score: 0
type: Comment
type: QuestionComment
has text: Additionally, *don't* build dynamic SQL like this. Use parameterized SQL, always. While there isn't a risk of SQL injection in this case, it's worth getting into good habits.
comment on: http://stackoverflow.com/q/23967672

http://stackoverflow.com/q/24014714
tagged with: java
has comment: http://stackoverflow.com/comment/37028519
type: Question
has comment: http://stackoverflow.com/comment/37036744
has title: Encryption and decryption video
has body: I found this code on the internet and works properly on java, but in android i get errors and i don't understand it. i have the error of "error opening trace file: No such file or directory (2)". it would be thankful if you help me! public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_aeshelper); Button btn = (Button) findViewById(R.id.button1); final String FileDir = "data/"; btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { try { FileInputStream fis = new FileInputStream(new File(FileDir+"aaa.mp4")); File outfile = new File(FileDir + "EncryptedVideo.mp4"); int read; if (!outfile.exists()) outfile.createNewFile(); File decfile = new File(FileDir + "DecryptedVideo.mp4"); if (!decfile.exists()) decfile.createNewFile(); FileOutputStream fos = new FileOutputStream(outfile); FileInputStream encfis = new FileInputStream(outfile); FileOutputStream decfos = new FileOutputStream(decfile); Cipher encipher = Cipher.getInstance("AES"); Cipher decipher = Cipher.getInstance("AES"); KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecretKey skey = kgen.generateKey(); encipher.init(Cipher.ENCRYPT_MODE, skey); CipherInputStream cis = new CipherInputStream(fis, encipher); decipher.init(Cipher.DECRYPT_MODE, skey); CipherOutputStream cos = new CipherOutputStream(decfos, decipher); while ((read = cis.read()) != -1) { fos.write((char) read); fos.flush(); } fos.close(); while ((read = encfis.read()) != -1) { cos.write(read); cos.flush(); } cos.close(); } catch (Exception e) { Toast.makeText(getApplicationContext(),"!!!", Toast.LENGTH_LONG).show(); } } }); } }
score: 0
tagged with: android
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/36970315
has text: Of course, the truly simplest solution is blocking screen orientation change, if you really don't need that. It causes a myriad of problems, and pretty much one of the hardest things to learn how to do in Android programming.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23990678
type: Comment

http://stackoverflow.com/q/23943100
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23951498
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36894936
tagged with: jaxb
has comment: http://stackoverflow.com/comment/36881185
score: 0
has answer: http://stackoverflow.com/a/23951498
answer count: 1
has body: I have a class with the following structure @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @XmlSeeAlso({ Child.class }) public abstract class Parent implements Serializable{} And public class Child extends Parent implements Serializable{ private String attribute; private List<String> values = new ArrayList<String>() ; } So while marshaling a child object it is saved successfully at the database as : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> age 1 2 The problem is while un-marshaling that object , The unmarshal function return null. JAXB.unmarshal(reader, Parent.class) Could you please advise what is the problem , and how to solve it ? Thanks in advance
has title: JAXB un-marshaling return null

http://stackoverflow.com/a/24057213
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24055182
has body: Yes you will need to include a third-party TransactionManager implementation that supports XA. Most application servers e.g. JBoss will bundle an XA TransactionManager of their choice. This is one of the reasons to choose an ApplicationServer over something like Tomcat or a standalone application; the configuration of things like XA transactions is basically done for you. Sometimes an ApplicationServer is too heavyweight (although I think this is becoming less of a problem) or you can't use one. In this scenario it is your responsibility to provide the TransactionManager implementation if you want to use XA. You can take your pick from implementations such as: JBossTS, Atomikos Transaction Essentials or Bitronix JTA. Spring does include a JTATransactionManager implementation. This will either use pre-configured locations to detect the selected XA implementation if you're running in an ApplicationServer, or alternatively you need to configure it yourself if you're in a standalone environment. There are some excellent resources on configuring an XA TransactionManager with Spring: http://spring.io/blog/2011/08/15/configuring-spring-and-jta-without-full-java-ee/ http://www.javaworld.com/article/2077714/java-web-development/xa-transactions-using-spring.html
answers question: http://stackoverflow.com/q/24055182
score: 1
upvote count: 1

http://stackoverflow.com/q/24067806
tagged with: android
score: 0
accepted answer: http://stackoverflow.com/a/24067912
upvote count: 1
tagged with: android-intent
answer count: 1
downvote count: 1
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/24067912
has title: Issue with Activities and ListView on Android
tagged with: listview
type: AnsweredQuestion
has body: I'm new in the world of Android and I have a problem with the use of activities, my problem that I want to make an app using ListView to show a list of categories of business and every business category will has another list with the names of the companies. My array.xml <?xml version="1.0" encoding="utf-8"?> Agencias de Autos y Motos Agroinsumos Audio Car Arquitectura y Construcción Autolavados Autopartes Balnearios This is my MainActivity and its layout: package com.genebi.rubik; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.app.ListActivity; import android.content.Intent; public class MainActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[] lista_categorias = getResources().getStringArray(R.array.categorias); this.setListAdapter(new ArrayAdapter<String>(this, R.layout.lista_categorias, R.id.nombreCategoria, lista_categorias)); ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { String categoria = ((TextView) v).getText().toString(); Intent i = new Intent(getApplicationContext(), ListaPorCategoria.class); i.putExtra("categoria", categoria); startActivity(i); } }); } } Layout <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/nombreCategoria" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="10dip" android:textSize="14sp" android:textStyle="normal" /> And my problem starts here with the second Activity when i give click on a item of the list showed in MainActivity.class package com.genebi.rubik; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.widget.T…
favorite count: 0
type: Question

http://stackoverflow.com/a/23992489
score: 7
has comment: http://stackoverflow.com/comment/37051636
has comment: http://stackoverflow.com/comment/36987054
has comment: http://stackoverflow.com/comment/37051059
has body: Your regex does not take into account that there might be dot separators in your time stamps; nor that there might be dots in the AM/PM stamp. To match all of the instances in your examples, try: \d{1,2}[.:]\d{2}\s?[AaPp]\.?[Mm] EDIT The OP has added some additional possible formats to his time stamps. To account for those, try: \d{1,2}(?:[:.]\d{2}){1,2}(?:\s?[AaPp]\.?[Mm])? This regex looks for a pattern that starts with one or two digits then a time separator of either a dot or a colon followed by two digits -- repeated once or twice (for just minutes, or minutes+seconds) Then an optional space followed by AM or PM (either case) with or without a dot after the A
has comment: http://stackoverflow.com/comment/37040754
has comment: http://stackoverflow.com/comment/37040826
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37013111
has comment: http://stackoverflow.com/comment/36999996
type: Answer
answers question: http://stackoverflow.com/q/23991984
has comment: http://stackoverflow.com/comment/36981407
has comment: http://stackoverflow.com/comment/37051877
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23991984
has comment: http://stackoverflow.com/comment/37050309

http://stackoverflow.com/comment/36910644
type: QuestionComment
has text: See the related discussion here https://gamedev.stackexchange.com/questions/58760/how-to-handle-a-tile-map-scrolling
comment on: http://stackoverflow.com/q/23959239
score: 2
type: Comment

http://stackoverflow.com/a/24045978
has body: It looks like you are calling the generateCsv() method before you are instantiating your handler. Yes, you are assigning the variables, but you are doing that after you have written the file. Change it to this. public Test() { super("Plankske 1"); setLayout(new FlowLayout()); Nummer = new JTextField(10); add(Nummer); Locatie = new JTextField("980000119818"); add(Locatie); Login = new JTextField(10); add(Login); Datum = new JTextField(10); add(Datum); Nummer1 = new JTextField(10); add(Nummer1); Nummer5 = new JTextField(10); add(Nummer5); save = new JButton("Save"); add(save); thehandler handler = new thehandler(); Nummer.addActionListener(handler); Locatie.addActionListener(handler); Login.addActionListener(handler); Datum.addActionListener(handler); Nummer1.addActionListener(handler); Nummer5.addActionListener(handler); save.addActionListener(handler); generateCsvFile("c:\\test.csv"); }
answers question: http://stackoverflow.com/q/24045840
has comment: http://stackoverflow.com/comment/37073287
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24045840
type: Answer

http://stackoverflow.com/comment/36907791
comment on: http://stackoverflow.com/q/23956618
type: Comment
has text: You will get better answers -- ones that answer your real question, rather than the answerer's interpretation of you question -- if you (1) give some examples and the way they should be ordered, and (2) show your current code and its output for those examples.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36997830
comment on: http://stackoverflow.com/q/24005740
type: Comment
type: QuestionComment
has text: what your definition of canales, it is a String list?
score: 0

http://stackoverflow.com/a/37716556
answers question: http://stackoverflow.com/q/24095407
has body: I dont know about Java, but you can avoid any screen capture programs by creating a Virtual Desktop and running your applications (suc as browser) under the newly created desktop. See MSDN resourse for createDesktop, SwitchDesktop etc APIs
score: 0
type: Answer

http://stackoverflow.com/q/24023148
tagged with: maven
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37031828
has title: Maven DependencyManagement not working
type: Question
upvote count: 2
has body: I'm trying to use Maven's DependencyManagement feature to management my project dependencies across my sub projects. My project structure is as follows: ProjectA - packaging (pom) - Sub Project A - packaging (war) Project A's pom file has the following org.liquibase liquibase-core ${liquibase.version} And my sub pom has the following: org.liquibase liquibase-core But the dependency isn't getting pulled in when I do this. If i change the parent pom and remove the dependency management tags, then the dependency gets pulled in fine. The sub project pom has the parent setup, so it can 'see' the parent pom file. Any ideas what's causing this? Thanks.
answer count: 1
has comment: http://stackoverflow.com/comment/37030155
tagged with: maven-3
favorite count: 0
has comment: http://stackoverflow.com/comment/37030435
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26464831

http://stackoverflow.com/a/24066222
accepted answer of: http://stackoverflow.com/q/24063299
type: Answer
answers question: http://stackoverflow.com/q/24063299
has body: This is not possible by standard JSoup classes and its not dependent on WhiteList. Its the org.jsoup.safety.Cleaner. The cleaner uses a Node traverser that allows only elements and text nodes. Also only the body is parsed. So the head and doctype are ignored completely. So to achieve this you'll have to create a custom cleaner. For example if you have an html like Test You will first create a custom cleaner copying the orginal one. However please note the package should org.jsoup.safety as the cleaner uses some of the protected method of Whitelist associated with. Also there is not point in extending the Cleaner as almost all methods are private and the inner node traverser is final. package org.jsoup.safety; import org.jsoup.helper.Validate; import org.jsoup.nodes.Attribute; import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Comment; import org.jsoup.nodes.DataNode; import org.jsoup.nodes.Document; import org.jsoup.nodes.DocumentType; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; import org.jsoup.parser.Tag; import org.jsoup.select.NodeTraversor; import org.jsoup.select.NodeVisitor; public class CustomCleaner { private Whitelist whitelist; public CustomCleaner(Whitelist whitelist) { Validate.notNull(whitelist); this.whitelist = whitelist; } public Document clean(Document dirtyDocument) { Validate.notNull(dirtyDocument); Document clean = Document.createShell(dirtyDocument.baseUri()); copyDocType(dirtyDocument, clean); if (dirtyDocument.head() != null) copySafeNodes(dirtyDocument.head(), clean.head()); if (dirtyDocument.body() != null) // frameset documents won't have a body. the clean doc will have empty body. copySafeNodes(dirtyDocument.body(), clean.body()); return clean; } private void copyDocType(Document dirtyDocument, Document clean) { dirtyDocument.traverse(new NodeVisitor() { public void head(Node node, int depth) { if (node instanceof DocumentType) { clean.prependChild(node); } } public void tail(Node n…
downvote count: 0
has comment: http://stackoverflow.com/comment/37118527
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/23975272
answer count: 2
has comment: http://stackoverflow.com/comment/36941063
score: 0
has answer: http://stackoverflow.com/a/23975900
tagged with: jenkins
type: UnansweredQuestion
has title: Maven project integration with Jenkins #selenium scripts
tagged with: selenium
tagged with: maven
has comment: http://stackoverflow.com/comment/36945138
type: Question
has answer: http://stackoverflow.com/a/23999687
tagged with: java
has body: I am trying to run selenium scripts on Jenkins locally on my computer. I was using eclipse project and then i converted it to Maven by configure>convert to maven project. My Jenkins configuration is Look at the configuration in the images. This is what I have done so far. I am a beginner to all this so don't know what I am missing. My console output on Jenkins is

http://stackoverflow.com/comment/36949977
comment on: http://stackoverflow.com/a/23980449
score: 0
type: Comment
has text: How creating two java processes impedes handling everything iside java? Why two java processes? Why this is a problem? Why should we do everyting inside one java process when the question is redirecting input of one process to the output of the other? Your response confused me completely.
type: AnswerComment

http://stackoverflow.com/comment/36926216
type: Comment
comment on: http://stackoverflow.com/a/23966579
has text: It would move down the line to the most recent h3, then h2, then h1 until it either finds one and uses that, or doesn't find one in which case it just add it to the mostRecent.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36940347
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23975398
has text: Actually you want to close the writer before exiting: `out.close();`
score: 0

http://stackoverflow.com/q/23993621
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23995954
score: 0
has title: Unresolved compilation but library already in classpath
has answer: http://stackoverflow.com/a/23994199
type: UnansweredQuestion
has body: I'm facing a very weird problem trying to build this component: https://github.com/theclue/talend-components-collection/tree/master/twitter/tTwitterStreamInput this is a custom component for Talend Open Studio, actually, but the problem seems more general and it's not related to Talend. the unresolved compilation problems are related to 2 classes located in twitter4j-stream-4.0.1.jar the library is correctly imported and linked, as you may see from the command I use to execute it: C:/Program Files (x86)/Java/jre7/bin/java.exe -Xms256M -Xmx1024M -verbose -Dfile.encoding=UTF-8 -cp E:/TalendWorkspaces/.Java/lib/dom4j-1.6.1.jar;E:/TalendWorkspaces/.Java/lib/guava-13.0.jar;E:/TalendWorkspaces/.Java/lib/talend-bridge-api-0.2.jar;E:/TalendWorkspaces/.Java/lib/tTwitterStreamInput-1.1.jar;E:/TalendWorkspaces/.Java/lib/twitter-commodities-0.2.jar;E:/TalendWorkspaces/.Java/lib/twitter4j-core-4.0.1.jar;E:/TalendWorkspaces/.Java/lib/twitter4j-stream-4.0.1.jar;.;E:/TalendWorkspaces/.Java/classes;E:/TalendWorkspaces/.Java/lib; test.twitterstream_0_1.twitterStream but the exeception leaves no doubt: Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method addListener(StatusListener) from the type TalendRowTweetBehaviour refers to the missing type StatusListener The method addFilter(FilterQuery) from the type TalendRowTweetBehaviour refers to the missing type FilterQuery at test.twitterstream_0_1.twitterStream.tTwitterStreamInput_1Process(twitterStream.java:737) at test.twitterstream_0_1.twitterStream.tTwitterOAuth_1Process(twitterStream.java:429) at test.twitterstream_0_1.twitterStream.runJobInTOS(twitterStream.java:1241) at test.twitterstream_0_1.twitterStream.main(twitterStream.java:1100) Using the -verbose command line parameter I can check the loaded classes. Effectively, StatusListener and FilterQuery are NOT loaded. But I've no clue on WHY thery are not, since the library is available and explicited in the classpath! EDIT: I added a screenshot f…

http://stackoverflow.com/q/23979676
has answer: http://stackoverflow.com/a/63895288
linked to: http://stackoverflow.com/q/196830
has title: Java - what are characters, code points and surrogates? What difference is there between them?
has answer: http://stackoverflow.com/a/23980051
has answer: http://stackoverflow.com/a/23980020
accepted answer: http://stackoverflow.com/a/23980020
favorite count: 0
tagged with: character
has comment: http://stackoverflow.com/comment/36971607
answer count: 5
has body: I'm trying to find an explanation of the terms "character", "code point" and "surrogate", and while these terms aren't limited to Java, if there are any language-specific differences I'd like the explanation as it relates to Java. I've found some information about the differences between characters and code points, characters being what is displayed for human users, and code points being a value encoding that specific character, but I have a no idea about surrogates. What are surrogates, and how are they different from characters and code points? Do I have the right definitions for characters and code points? In another thread about stepping through a string as an array of characters, the specific comment that prompted this question was "Note that this technique gives you characters, not code points, meaning you may get surrogates." I didn't really understand, and rather than create a long series of comments on a 5-year-old question I thought it would be best to ask for clarification in a new question.
has answer: http://stackoverflow.com/a/23980015
type: AnsweredQuestion
downvote count: 0
score: 56
tagged with: java
possible better answer: http://stackoverflow.com/a/23980211
type: Question
has answer: http://stackoverflow.com/a/23980211
upvote count: 56
tagged with: character-encoding

http://stackoverflow.com/q/24086968
possible better answer: http://stackoverflow.com/a/24087216
type: Question
has body: I very new to programming. I want to check if a string s contains a-z characters. I use: if(s.contains("a") || s.contains("b") || ... { } but is there any way for this to be done in shorter code? Thanks a lot
has comment: http://stackoverflow.com/comment/37148715
has title: Tell if string contains a-z chars
duplicate of: http://stackoverflow.com/q/14278170
tagged with: contains
linked to: http://stackoverflow.com/q/16127923
downvote count: 1
has comment: http://stackoverflow.com/comment/61758893
upvote count: 24
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37148890
linked to: http://stackoverflow.com/q/14278170
has answer: http://stackoverflow.com/a/24087043
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24087216
has answer: http://stackoverflow.com/a/24087063
accepted answer: http://stackoverflow.com/a/24087063
tagged with: java
score: 23
has answer: http://stackoverflow.com/a/24087060

http://stackoverflow.com/q/24098602
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37170642
has body: Title says all. I'm in search om a method like modelToView, but for Android.
answer count: 0
has comment: http://stackoverflow.com/comment/37170522
tagged with: swing
type: Question
tagged with: java
score: 0
has title: Is there JTextComponent's(swing) modelToView method equivalent for Android?
has comment: http://stackoverflow.com/comment/37170766

http://stackoverflow.com/comment/37240500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23985522
score: 0
has text: well, I tried it with 2.0.2 ...

http://stackoverflow.com/comment/36918985
has text: @maerics--I like what I see! I'll work on implementing something like that. THANKS! (I like it even better with the EDIT!) [Afterthought: I don't care which button gets pressed, just that it does what I want, so no array of buttons is necssary, unlike what I assumed.]
comment on: http://stackoverflow.com/a/23963538
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23995502
linked to: http://stackoverflow.com/q/20804043
accepted answer: http://stackoverflow.com/a/23995644
answer count: 1
has comment: http://stackoverflow.com/comment/36978357
has comment: http://stackoverflow.com/comment/36978152
has body: I am new to networking in java. I have a simple server.java and a client.java file. I complied both and server.class files responds to client.class file when I run it via command prompt. It works fine in local system i.e in my system when I run both the client as well as server. But I want to host the server.java on some free hosting cloud servers where my file i.e server.java would run continuously. Now by doing that I can create multiple clients to connect to that server.java file from anywhere via internet. It would be not local. I have seen other questions regarding this topic but it didn't help. I just want to know how should I get started to achieve the concept that I have stated above. Similiar problem: network in java
has answer: http://stackoverflow.com/a/23995644
has comment: http://stackoverflow.com/comment/36978276
type: AnsweredQuestion
has title: Continously running java file for ex Server.java
has comment: http://stackoverflow.com/comment/36978245
type: Question
has comment: http://stackoverflow.com/comment/36978477
has comment: http://stackoverflow.com/comment/36978450
tagged with: network-programming
has comment: http://stackoverflow.com/comment/36978319
tagged with: java
has comment: http://stackoverflow.com/comment/36978200
score: 0

http://stackoverflow.com/a/24026787
upvote count: 2
type: AcceptedAnswer
has body: Use a listener interface to pass back the result, implement your AsyncTask like this: public class ExampleTask extends AsyncTask&lt;Void, Void, Boolean&gt; { public interface TaskListener { public void onFinished(boolean success); } private final TaskListener listener; private ExampleTask(TaskListener listener) { this.listener = listener; } @Override protected Boolean doInBackground(Void... params) { boolean result = doWork(); return result; } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); if(this.listener != null) { this.listener.onFinished(result); } } } And you can use it like this: ExampleTask task = new ExampleTask(new ExampleTask.TaskListener() { @Override public void onFinished(boolean success) { // Do whatever you want with the result } }); task.execute();
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24026734
answers question: http://stackoverflow.com/q/24026734

http://stackoverflow.com/a/24061051
score: 10
upvote count: 10
accepted answer of: http://stackoverflow.com/q/24009149
answers question: http://stackoverflow.com/q/24009149
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Sooo...I just solved this only hours after I desperatly put bounty on it, but thats worth it. I decided to start over. For the design thing with threads etc. I took some help from this awesome project, it helped me a lot. Now I use only one thread. It seems like the main point was the casting stuff, but I am not too sure, it also may have been the multithreading. I don't know what kind of bytes the byte[] constructor of AudioTracker expects, but certainly no float bytes. So I knew I need to use the short[] constructor. What I did was -put the bytes in a byte[] -take 4 of them and cast them to a float in a loop -take each float and cast them to shorts Since I already did that before, I am not too sure what the problem was. But now it works. I hope this can help someone who wents trough the same pain as me. Big thanks to all of you who participated and commented. Edit: I just thought about the changes and figured that me using CHANNEL_CONFIGURATION_STEREO instead of MONO earlier has contributed a lot to the stuttering. So you might want to try that one first if you encounter this problem. Still for me it was only a part of the solution, changing just that didn't help. static final int frequency = 44100; static final int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO; static final int audioEncoding = AudioFormat.ENCODING_PCM_16BIT; boolean isPlaying; int playBufSize; Socket socket; AudioTrack audioTrack; playBufSize=AudioTrack.getMinBufferSize(frequency, channelConfiguration, audioEncoding); audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, frequency, channelConfiguration, audioEncoding, playBufSize, AudioTrack.MODE_STREAM); new Thread() { byte[] buffer = new byte[4096]; public void run() { try { socket = new Socket(ip, port); } catch (Exception e) { e.printStackTrace(); } audioTrack.play(); isPlaying = true; while (isPlaying) { int readSize = 0; try { readSize = socket.getInputStream().read(buffer); } catch (Exception e) { e.printStackTrace(); } sh…

facebook-rest-api
tags question: http://stackoverflow.com/q/24052333
tag name: facebook-rest-api
type: Tag

http://stackoverflow.com/comment/36959625
has text: @user3400060 If it worked for you, you can [accept it](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) if you want, although you might want to rephrase the question a bit, since this doesn't really address your original code.
comment on: http://stackoverflow.com/a/23985063
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/24007235
score: 1
answers question: http://stackoverflow.com/q/24006990
has body: Either Logout or Logout.getInstance is returning null. Make sure it is not null
upvote count: 2
type: Answer
downvote count: 1

http://stackoverflow.com/comment/36929841
type: Comment
comment on: http://stackoverflow.com/a/23969503
score: 1
has text: @MartijnCourteaux That's right, Java generics are very much a "hide that cast from me" game.
type: AnswerComment

http://stackoverflow.com/comment/36910903
type: Comment
has text: You're probably going to get a decent idea of what will be required on the C++ side [after reading this](http://stackoverflow.com/questions/7630242/why-does-dataoutputstream-writeutf-add-additional-2-bytes-at-the-beginning), a somewhat related question.
comment on: http://stackoverflow.com/q/23959321
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37175247
type: AnswerComment
comment on: http://stackoverflow.com/a/24100799
score: 0
has text: What does it mean here *takes a Component parameter, not an Object parameter.* As per OP code the object is `JFrame`. Why the last sample code in your post is unacceptable?
type: Comment

http://stackoverflow.com/comment/36886694
has text: hi MJ, I have done the loop (for(int i=0; i<c.getColumnCount();i++)), from this loop i could see there is no such column which is capturing the sender's mobile number. are you referring to these same columns to be looped, or something else. also, the telephonyManager issue is, that all providers don't store mobile numbers in the SIM card. less 10% SIM cards will have this data. i am using this as an alternative method.
type: AnswerComment
comment on: http://stackoverflow.com/a/23946184
type: Comment
score: 1

timer
tag name: timer
tags question: http://stackoverflow.com/q/24095294
tags question: http://stackoverflow.com/q/24003532
tags question: http://stackoverflow.com/q/24096061
tags question: http://stackoverflow.com/q/24078587
tags question: http://stackoverflow.com/q/23983137
tags question: http://stackoverflow.com/q/23956015
tags question: http://stackoverflow.com/q/24056149
tags question: http://stackoverflow.com/q/23964967
type: Tag
tags question: http://stackoverflow.com/q/23947096
tags question: http://stackoverflow.com/q/24025029
tags question: http://stackoverflow.com/q/23998925
tags question: http://stackoverflow.com/q/23965868
tags question: http://stackoverflow.com/q/24102757
tags question: http://stackoverflow.com/q/23950979
tags question: http://stackoverflow.com/q/23961951

http://stackoverflow.com/a/23984366
answers question: http://stackoverflow.com/q/23983895
score: 0
has body: For a very simple application it will certainly be overkill, but if allready using SpringFramework, you could have a look at Spring Security. It deals with authentication, with many possibilies, and can have very simple or very sophisticated authorization rules. Apache Shiro is also a simpler (but less powerful) alternative.
type: Answer

http://stackoverflow.com/q/23961030
has comment: http://stackoverflow.com/comment/36914114
has comment: http://stackoverflow.com/comment/36914375
favorite count: 0
has answer: http://stackoverflow.com/a/23969336
linked to: http://stackoverflow.com/q/14109868
downvote count: 1
type: AnsweredQuestion
score: 2
duplicate of: http://stackoverflow.com/q/14109868
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36914665
tagged with: servlets
has comment: http://stackoverflow.com/comment/36914528
type: Question
tagged with: jakarta-ee
has title: What causes "Java Runtime Environment (JRE) version 1.7 is not supported by this driver..." at runtime in my servlet?
accepted answer: http://stackoverflow.com/a/23969336
has body: I want to be able to click on an HTML button and have it call a method inside of Java. Is there more than one way to accomplish this task. I also would like to see where the errors are coming from on this example. It will not compile. Java Code: import java.io.IOException; @WebServlet("/myservlet") public class MyServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { MyClass myClass = new MyClass(); if (request.getParameter("button1") != null) { myClass.function1(); } else if (request.getParameter("button2") != null) { myClass.function2(); } else if (request.getParameter("button3") != null) { myClass.function3(); } request.getRequestDispatcher("/WEB-INF/some-result.jsp").forward(request, response); } } class MyClass { void function1() { System.out.println("Button 1"); } void function2() { System.out.println("Button 2"); } void function3() { System.out.println("Button 3"); } } html code: Test Button Error: May 30, 2014 1:16:54 PM com.microsoft.sqlserver.jdbc.SQLServerConnection <init> SEVERE: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0. Exception in thread "main" java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0. at com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:304) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:215) at testpak.DbTest.testQuery(DbTest.java:19) at testpak.DbTest.main(DbTest.java:30) That sqljdbc4jar. is in my Referenced Library. Is there another place that it needs to be?
tagged with: sql-server-2008
answer count: 1
tagged with: jdbc

http://stackoverflow.com/comment/37021335
score: 0
comment on: http://stackoverflow.com/q/24015079
has text: Can you debug and check what is the value of name here -->Query query = em.createNamedQuery("Entry.findAllForName").setParameter("name", name);
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/89218267
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/30219956
has text: Yes, it was me upvoting @AntonNovopashin’s comment. Since you needed UTC, you’re fine (you might want to mention that in the answer). BTW `ZoneOffset` is a subclass of `ZoneId`, so I wouldn’t exactly say you have avoided it, but as long as you’re happy…
score: 1

http://stackoverflow.com/a/24052980
upvote count: 1
type: Answer
has body: Dario, here's a really simple solution: split the string with this simple regex: ,(?=\d{2}:) Here's the code: String[] arrayOfPairs = subjectString.split(",(?=\\d{2}:)"); See the result at the bottom of the online demo. The reason I suggest this is that you seem happy to match a key-value pair as a whole, as opposed to separating them into two variables. How does this work? We split on a comma , that is followed by two digits and a colon, as asserted by the positive lookahead (?=\d{2}:)
answers question: http://stackoverflow.com/q/24033679
downvote count: 0
score: 1

http://stackoverflow.com/a/23957165
type: Answer
answers question: http://stackoverflow.com/q/23954334
score: 0
has body: One solution would be to use some sort of default value (1, in this case) for column roll_no, and change the table schema so that column roll_no does not use auto incrementing. Then, whenever you INSERT a new record, the roll_no field for that record will be the value 1. Column roll_no would hence become a calculated field when you UPDATE the class and section fields. From the MySQL 5.1 manual under CREATE MySQL 5.1 Manual: CREATE column_definition: data_type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY] [COMMENT 'string'] [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}] [STORAGE {DISK|MEMORY|DEFAULT}] [reference_definition] Notice that you can specify a DEFAULT value (see line 2 of code above) for a column. Here is a imperfect template to get you going. Again, use the documentation if you need to. CREATE TABLE foo( enroll_no int AUTO_INCREMENT PRIMARY KEY, name (blah), class (blah), section (blah), roll_no NOT NULL DEFAULT 1 COMMENT 'Must be calculated before UPDATEing class or section.') ENGIN=InnoDB DEFAULT CHARSET =utf8; Once this system is setup, you would use SELECT to query the present value of a record's roll_no field before using UPDATE to update the class or section fields. Once you get the present value of the roll_no field, try adding 1 to it and using that result as the UPDATE value. I'm a little rusty on my SQL and short on time, but I think it would work. Use a good reference on nested queries if you get stuck.

http://stackoverflow.com/a/24045012
answers question: http://stackoverflow.com/q/24037238
has body: It is not possible by default. If you need this you must Override the methode store0 of java.util.Properties Here the part of the original class. private void store0(BufferedWriter bw, String comments, boolean escUnicode) throws IOException { if (comments != null) { writeComments(bw, comments); } bw.write("#" + new Date().toString()); bw.newLine(); synchronized (this) { for (Enumeration e = keys(); e.hasMoreElements();) { String key = (String)e.nextElement(); String val = (String)get(key); key = saveConvert(key, true, escUnicode); /* No need to escape embedded and trailing spaces for value, hence * pass false to flag. */ val = saveConvert(val, false, escUnicode); bw.write(key + "=" + val); bw.newLine(); } } bw.flush(); }
score: 5
upvote count: 5
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/120101794

http://stackoverflow.com/q/24016707
has comment: http://stackoverflow.com/comment/37026051
has answer: http://stackoverflow.com/a/27403417
has comment: http://stackoverflow.com/comment/37029705
has comment: http://stackoverflow.com/comment/37031184
tagged with: java
type: Question
score: 8
has title: NoOptions cannot be resolved to a type
tagged with: libgdx
tagged with: eclipse
tagged with: google-play-services
has comment: http://stackoverflow.com/comment/40875492
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42093312
has comment: http://stackoverflow.com/comment/37027579
has comment: http://stackoverflow.com/comment/37043119
favorite count: 0
has body: I am trying to put google play services in my game. I have import BaseGameUtils project, when I add him to my workspace eclipse says: "NoOptions cannot be resolved to a type" And: "The import com.google.android.gms.common.api.Api.ApiOptions cannot be resolved" It happens in the GameHelper class. This is the only thing that it cannot resolve. Some one have a solution for this? I have tried all and I coudn't fins for some solutions. Sorry for my poor english.
upvote count: 8
has comment: http://stackoverflow.com/comment/37044250
type: UnansweredQuestion
tagged with: android

android-4.0-ice-cream-sandwich
type: Tag
tag name: android-4.0-ice-cream-sandwich
tags question: http://stackoverflow.com/q/23942373

http://stackoverflow.com/a/24076504
has body: Ugh, it's a regression in OkHttp 2.0.0-RC1. Fix is out for review.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24071774
has comment: http://stackoverflow.com/comment/37132356
answers question: http://stackoverflow.com/q/24071774
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24009377
downvote count: 0
tagged with: servlets
has answer: http://stackoverflow.com/a/24009487
favorite count: 0
has answer: http://stackoverflow.com/a/24011707
has body: I am looking for a simple example, UI is web based (accessed through browser over network) Business logic (APIs) is deployed on a server. It is a printer management application. Business logic will access external electronic printer &amp; can access its state. Multiple printers can be connected to same server. A real time graph of (or count) number of papers queued, printed etc needs to be displayed on UI. User should be able to continue their session specific for a printer. Only one user can access a printer at a time (blocked for an user). User can issue commands to printer over network (Tasks may take 10-15 mins to complete. Meanwhile, user will monitor progress). I have already written program which handles Computer-Printer interaction using COM port. Local UI working fine. Now I want to have UI on web. Please guide me which approach should I use to create such application. Although I have some experience with Java, I am new to Java EE or any network protocols.
upvote count: 1
tagged with: web-services
has title: Simple example for decoupling UI and Calculation over network
tagged with: soa
possible better answer: http://stackoverflow.com/a/24011707
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24009487
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
answer count: 2

http://stackoverflow.com/comment/37122844
score: 0
type: AnswerComment
type: Comment
has text: To use Marvin you need to copy the "marvin" folder into your project directory. Take a look at the tutorial "2. First Application" at the tutorial section of the project website. There is also a video called "Configuring the development environment". In the case of any problem, you can use the discussion group.
comment on: http://stackoverflow.com/a/24049672

http://stackoverflow.com/q/24077635
tagged with: performance
has answer: http://stackoverflow.com/a/35943040
tagged with: java
has title: How to hold 5GB constantly memory in application without suffering from poor performance due to GC?
has comment: http://stackoverflow.com/comment/37161942
accepted answer: http://stackoverflow.com/a/24256428
score: 9
type: Question
has comment: http://stackoverflow.com/comment/60115780
upvote count: 9
has comment: http://stackoverflow.com/comment/37131544
has comment: http://stackoverflow.com/comment/37161927
has comment: http://stackoverflow.com/comment/37131363
possible better answer: http://stackoverflow.com/a/24112195
answer count: 3
has answer: http://stackoverflow.com/a/24112195
downvote count: 0
has comment: http://stackoverflow.com/comment/37131444
has answer: http://stackoverflow.com/a/24256428
linked to: http://stackoverflow.com/q/15307998
favorite count: 0
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/37131566
has comment: http://stackoverflow.com/comment/37131667
type: AnsweredQuestion
has body: My app is geo application. Due to a requirement of short response time each of my instance load all points to memory and store them in a structure (quad tree). Every minute we load all points (to be sync with the db) and put them in few quad trees. We now have 0.5GB points. I am trying to prepare to the next level of 5GB points. JVM: -XX:NewSize=6g -Xms20g -Xmx20g -XX:+UseConcMarkSweepGC -verboseGC -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCDetails Startup of the instance took lots of times due to GC in additional the app suffer from GC all the time. I would like to have some reference to GC with large heap. I can think of few solutions for this: To refresh only the changes in the db and not load all db each time. Cons - still will suffer from GC during the early stage of the application, Long time GC. Off heap solution. Store in the quad tree the point ids and store the points out of heap. Cons - serialization time, the geo structure is a complex of few objects and not simple object. For each instance create additional instance with the structure and query against this instance . The geo instance will hold long lived object and can have GC adjustment for long lived object. Cons - complexity and response time. Any references to article on apps that hold few GIG of long lived objects will be more than welcome. Run on Ubuntu (Amazon). Java 7 . Dosnt have memory limitation. The problem is long pause time each time we refresh the data. Gc log for the refresh: 2014-06-15T16:32:58.551+0000: 1037.469: [GC2014-06-15T16:32:58.551+0000: 1037.469: [ParNew: 5325855K-&gt;259203K(5662336K), 0.0549830 secs] 16711893K-&gt;11645244K(20342400K), 0.0551490 secs] [Times: user=0.71 sys=0.00, real=0.05 secs] 2014-06-15T16:33:02.383+0000: 1041.302: [GC2014-06-15T16:33:02.383+0000: 1041.302: [ParNew: 5292419K-&gt;470768K(5662336K), 0.0851740 secs] 16678460K-&gt;11856811K(20342400K), 0.0853260 secs] [Times: user=1.09 sys=0.00, real=0.09 secs] 2014-06-15T16:33:06.114+0000: 104…

http://stackoverflow.com/q/24068183
has comment: http://stackoverflow.com/comment/37114476
has comment: http://stackoverflow.com/comment/37114252
has title: How do I read multiple JSON objects in Java?
has comment: http://stackoverflow.com/comment/37114137
score: -4
has comment: http://stackoverflow.com/comment/37114292
has comment: http://stackoverflow.com/comment/37114579
answer count: 2
downvote count: 4
possible better answer: http://stackoverflow.com/a/24068404
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/37114394
has answer: http://stackoverflow.com/a/24068404
has comment: http://stackoverflow.com/comment/37114663
has answer: http://stackoverflow.com/a/24068596
favorite count: 0
has comment: http://stackoverflow.com/comment/37114399
type: Question
accepted answer: http://stackoverflow.com/a/24068596
has comment: http://stackoverflow.com/comment/37114531
linked to: http://stackoverflow.com/q/7246157
has body: So this is my sample Json Text, { "Date": [ 1545, "20 January 2014" ], "docText": "ABCD", "docSource": "", "docID": 99, "docDate": "", "Date": [ 1930, "1995/11", "past decade", "today", "Today" ], "docText": "JJJJJJJ\"", "Organization": [ "x", "y", "z" ], "docSource": "", "docID": 98, "docDate": "", "Person": "xxxxxx" } Now I need a Java code to Read from this file and Display all the docText, docID Entities. I'm able to retrieve only one Entity. This is the part of the code im using. JSONParser jsonParser = new JSONParser(); try { FileReader fileReader = new FileReader(jsonFilePath); JSONObject jsonObject = (JSONObject) jsonParser.parse(fileReader); String docid = (String) jsonObject.get("docText"); System.out.println("DocText: " +docid); long members = (long) jsonObject.get("docID"); System.out.println("docID: " + members); JSONArray names = (JSONArray) jsonObject.get("Organization"); Iterator i = names.iterator(); while (i.hasNext()) { System.out.println("Organization: "+i.next()); I really need this working soon! Thank you
has comment: http://stackoverflow.com/comment/37114006
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37114248
has comment: http://stackoverflow.com/comment/37114747
has comment: http://stackoverflow.com/comment/37114339
has comment: http://stackoverflow.com/comment/37114952
has comment: http://stackoverflow.com/comment/37114199
has comment: http://stackoverflow.com/comment/37115124

http://stackoverflow.com/q/23971365
has comment: http://stackoverflow.com/comment/36933316
possible better answer: http://stackoverflow.com/a/23971598
has comment: http://stackoverflow.com/comment/36951068
has answer: http://stackoverflow.com/a/23971598
tagged with: random
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/36933414
type: Question
tagged with: priority-queue
tagged with: weighted
has answer: http://stackoverflow.com/a/74737547
score: 5
has answer: http://stackoverflow.com/a/23974333
has title: Weighted Randomized Ordering
downvote count: 1
upvote count: 6
has answer: http://stackoverflow.com/a/23973121
has body: The problem: I have items that have weights. The higher the weight, the greater chance they have the item will go first. I need to have a clean, simple way of doing this that is based on core Java (no third party libraries, jars, etc.). I've done this for 2 items, by summing the weights then randomly pick a number using Math.random() within that range. Very simple. But for items greater than 2, I can either do more samples in the same range chancing misses, or I can recompute the sum of the weights of the remaining items and select again (recursive approach). I think that there might be something out there can can do this faster/cleaner. This code will be used over and over, so I'm looking for an effective solution. In essence, its like randomized weight permutations. Some Examples: A has weight of 1, B has weight of 99. If I ran the simulation with this, I would expect to get BA 99% of the time and AB 1% of the time. A has the weight of 10, B has the weight of 10, and C has the weight of 80. If I ran simulations with this, I would expect C to be the first item in the ordering 80% of the time, in those cases, A and B would have an equal chance of being the next character. Extra Details: For my particular problem, there is a small number of items with potentially large weights. Say 20 to 50 items with weights that are stored in the form of a long, where the minimum weight is at least a 1000. The number of items may increase quite a bit too, so if we can find a solution that doesn't require the items to be small, that would be preferred.
accepted answer: http://stackoverflow.com/a/23974333
tagged with: java
has answer: http://stackoverflow.com/a/23971944
answer count: 5
has comment: http://stackoverflow.com/comment/36934264

http://stackoverflow.com/q/24032136
tagged with: java
has body: Im trying to convert a properties file into an excel but i dont know how. It's look like this in netBeans but i can copy an entire column or all, only let me one for one (And there is a lot of data..) Anyone knows how to convert this to a excel or at least copy an entire column? EDIT1: I'm asking this question looking for a non-programming answer because i think netbeans can do anythink like converting this into an excel. (My english is not the best, i hope you can understand what i'm trying to say.)
has answer: http://stackoverflow.com/a/42002860
favorite count: 0
has title: Convert properties file into excel
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24032342
score: 2
tagged with: netbeans
has answer: http://stackoverflow.com/a/24032374
upvote count: 3
downvote count: 1
tagged with: excel
type: Question

http://stackoverflow.com/q/23993706
has comment: http://stackoverflow.com/comment/37705410
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25985941
tagged with: jndi
tagged with: active-directory
tagged with: ldap
answer count: 2
has answer: http://stackoverflow.com/a/56034735
downvote count: 0
has title: Java JNDI - limitation when changing user's password in Microsoft LDAP - authentication exception
favorite count: 0
upvote count: 2
has body: This is my first post here. I have tried to search in internet for my question but found no answers. I hope your expertise will help me. I noticed something annoying when working with Microsoft LDAP in particular. In LDAP when the user must reset their password at next logon there is a flag "User must reset password at next logon", lets call it flag X. When X is set for a user and if we try to change this user's pass we cannot. I want to do this from the name of the user not as another administrative user - so it becomes that user must change pass but if you try to change it you cannot.. Here is what I am doing: Hashtable env = new Hashtable(); env.put(Context.SECURITY_AUTHENTICATION, &lt;auth_mech&gt;); env.put(Context.SECURITY_PRINCIPAL, &lt;principal&gt;); env.put(Context.SECURITY_CREDENTIALS, &lt;pass&gt;); DirContext ctx = new InitialDirContext(env); When trying to create the new Initial Context: Authentication exception [LDAP: error code 49 - 80090308: LdapErr: DSID-0Cxxxxxx, comment: AcceptSecurityContext error, data 773, vece] data 773 means - user must change their pass at next logon. So when: - user must change their pass at next logon - user pass is expired - user account is disabled - user account is expired and so on we cannot change the user' password... This seems to me as a big limitation. Also I want to ask if someone knows a specification that Micrisoft are following regarding this error codes. I know that error code 49 is general error code and is according to specification, but this data 773, data 532 are they general for all LDAP as I think they are specific to the vendor which is again very annoying. P.S. I found similar issue here: Change AD user expired password in Java but it was resolved when using AD Super user that can change everyone's password, but I don't want that, I need the user to be able to change their own passwords as this is reflects in the LDAP Password History. Thanks
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13342808
score: 2

http://stackoverflow.com/comment/37163500
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24026948
type: Comment
has text: Why do you think you need a buffer that big?

http://stackoverflow.com/q/24033672
has comment: http://stackoverflow.com/comment/37126001
has comment: http://stackoverflow.com/comment/37080354
favorite count: 0
linked to: http://stackoverflow.com/q/11699205
has comment: http://stackoverflow.com/comment/37127971
has comment: http://stackoverflow.com/comment/37049668
has comment: http://stackoverflow.com/comment/37050156
has title: executeQuery Fails when table does not exist
has answer: http://stackoverflow.com/a/24033795
has comment: http://stackoverflow.com/comment/37049875
has comment: http://stackoverflow.com/comment/37132601
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24033823
tagged with: mysql
has body: I have a system in which there are hundreds of table. So i am getting values from them by making sql query in a loop. But if any table does not exists it quits further execution. Can i place a condition if any table does not exists then it search for next table....
type: Question
answer count: 2
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/24058176
answer count: 1
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37095941
has comment: http://stackoverflow.com/comment/37095668
tagged with: eclipse
has answer: http://stackoverflow.com/a/24059549
accepted answer: http://stackoverflow.com/a/24059549
score: 0
has body: I am working on an Android application in ADT(Eclipse IDE with Android Developer Tool plugin). I was not able to build it because one of my Java files was giving me errors. I excluded the file from the build path since it was not being used, and I needed it only as a backup. But Eclipse still showed me the build error. For ignoring this error, I use one of Eclipse's suggested solution - "Disable check in this file only", which worked. So my question is, How do I reverse this option? Can I re-enable the checking so that it shows the error? [EDIT] : If i rename the file, the error does show up. If i copy the java file into another package also, the error does show up in it's new location. But the existing file just does not show the error. There has to be something like an ANT exclusion list somewhere, where i can remove this filename.
has title: How to reverse "disable check in this file only" in eclipse?

http://stackoverflow.com/q/24093644
has comment: http://stackoverflow.com/comment/37161593
has comment: http://stackoverflow.com/comment/37161870
has answer: http://stackoverflow.com/a/24131297
score: -2
has comment: http://stackoverflow.com/comment/37161607
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37161563
has comment: http://stackoverflow.com/comment/37161577
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37161622
tagged with: java
has title: Calling a method and all the associated variables from another class - Java Swing
downvote count: 2
has body: I am trying to organise my code into classes that make sense, so I created a FileIOManagement class that I want to handle all the reading from text files etc. Currently, the methods I use to read files live in the GUI class that displays the data, but I want to be able to separate GUI and other logic. This is the code for my current FileIOManagement class: package playingwithswing; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Scanner; public class FileIOManagement { private ArrayList&lt;String&gt; nameList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; courseList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; semesterList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; moderatorList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; programList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; majorList = new ArrayList&lt;String&gt;(); public FileIOManagement(){ readTextFile(); } private void readTextFile(){ try{ Scanner scan = new Scanner(new File("Course.txt")); while(scan.hasNextLine()){ String line = scan.nextLine(); String[] tokens = line.split("~"); String course = tokens[0].trim(); String examiner = tokens[1].trim(); String moderator = tokens[2].trim(); String semester = tokens[3].trim(); String program = tokens[4].trim(); String major = tokens[5].trim(); courseList.add(course); semesterList.add(semester); nameList.add(examiner); moderatorList.add(moderator); programList.add(program); majorList.add(major); HashSet hs = new HashSet(); hs.addAll(nameList); nameList.clear(); nameList.addAll(hs); Collections.sort(nameList); } scan.close(); } catch (FileNotFoundException e){ e.printStackTrace(); } } } This is the class that I want to be able to show the data from the file reading that is done by the FileIOManagement class. I have commented out the lines of code, I have m…
tagged with: swing
type: Question
tagged with: oop

http://stackoverflow.com/q/23956015
tagged with: adk
downvote count: 0
answer count: 3
tagged with: android
has title: Android: keep timer running between activities
tagged with: android-activity
favorite count: 0
tagged with: timer
has answer: http://stackoverflow.com/a/23956651
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36905369
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23956777
type: Question
has body: I have a timer class that is called when a button is pressed and it begins to countdown and display the remaining time as the button text, but when i leave the activity and return they have stopped and disappear. I know why they stop as part of the android life cycle,and i don't simply want to save the times of them and restart them the when i enter the activity again (like most of the solutions on the internet have). i need to timers to keep running when the activity is not the current one as to be accurate to the length of real time the timer represents. is this possible? any help is appreciated. timer class that works and need to keep running public class CustTimer { int length; Button button; public CustTimer() { } public CustTimer(int length, Button button) { this.length = length; this.button = button; } public void Count() { new CountDownTimer(length, 1000) { public void onTick(long millisUntilFinished) { String min = String.valueOf(millisUntilFinished/60000 ); long re = millisUntilFinished%60000; String secs = String.valueOf(re/1000); button.setText(min + ":" + secs); } public void onFinish() { button.setText("done"); } }.start(); } } code that calls the timer class, in the onCreate() function in the activity. for (int i = 0; i &lt; 16; i++) { final int j = i; buts[i].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { CustTimer t1 = new CustTimer(times[j], buts[j]); timers[j] = t1; t1.Count(); } }); } times is the array of timer lengths in millis. buts is any array containing the buttons on the screen for easy access. timers is an array of the timer objects created for each button.
has answer: http://stackoverflow.com/a/23956543

http://stackoverflow.com/a/24098449
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37187114
has comment: http://stackoverflow.com/comment/37186156
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24059636
score: 3
answers question: http://stackoverflow.com/q/24059636
has body: Your factory isn't annotated. In order for it to be resolved, the class needs to be annotated, e.g. @Dependent or @ApplicationScoped

http://stackoverflow.com/comment/36923977
type: AnswerComment
has text: This is a working implementation, I was just making sure you know that this is not good design... (+1).
type: Comment
comment on: http://stackoverflow.com/a/23966007
score: 0

http://stackoverflow.com/comment/37162260
has text: i am not using Eclipse... please tell me if u know why it is not finding the package p1 at run time even though path is set.
comment on: http://stackoverflow.com/a/24088529
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24012332
has comment: http://stackoverflow.com/comment/37010151
accepted answer of: http://stackoverflow.com/q/24011735
has comment: http://stackoverflow.com/comment/37009919
answers question: http://stackoverflow.com/q/24011735
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37010271
upvote count: 5
has comment: http://stackoverflow.com/comment/37009959
type: Answer
has comment: http://stackoverflow.com/comment/37009760
downvote count: 0
has comment: http://stackoverflow.com/comment/37010076
has body: You need to close ZipOutputStream in writeZipFile() method; for (File file : fileList) { if (!file.isDirectory()) { // we only zip files, not directories addToZip(directoryToZip, file,zos); } } //here close zos zos.close();
has comment: http://stackoverflow.com/comment/37010205
score: 5
has comment: http://stackoverflow.com/comment/37010034

http://stackoverflow.com/q/24089980
favorite count: 0
tagged with: linux
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Tomcat Login form not showing in Server
has comment: http://stackoverflow.com/comment/37209659
tagged with: amazon-ec2
tagged with: jdbcrealm
tagged with: tomcat
has body: The problem is: when I click in a button, it is supposed that a "Tomcat Realm Security" Login form must appear because a protected resource is referenced, but not, is not happening. The "xxx" content of test.html page is shown. Any help will be appreciated. Probably is not important but: test machine is Windows with bitnami Tomcat LAMP, everything is working as expected. Target box is AWS Linux EC2 with Bitnami Tomcat LAMP preinstalled (the problem is here). Directory where the web application is installed: ROOT (both machines) index.html file contains the refrecence to the protected resource: Login The conf/server.xml is configured with the realm: In the table "users_roles" there is a user "test1" with assigned role "user" The WEB-INF/web.xml file contains: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"xmlns="http://java.sun.com/xml/ns/javaee"> index.html user <web-resource-collection> Wildcard means whole app requires authentication /test.html GET POST </web-resource-collection> user NONE FORM /accounts/login.html /accounts/loginError.html Is there something missing here? Could it be because the Linux box have something else configured that is not there in Windows? (or is transparent for a user, as usual). Thanks in advance Omar
downvote count: 0

http://stackoverflow.com/comment/37087216
has text: Take a look at [DecimalFormat]8http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html) there is an example for parsing decimal values like yours (#.###E-4)
score: 0
comment on: http://stackoverflow.com/q/24053686
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36900543
type: AnswerComment
has text: Yes i changed and I added new hibernate3.jar it works. THANK YOU
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23953595

http://stackoverflow.com/a/24064293
has comment: http://stackoverflow.com/comment/37106677
upvote count: 6
has comment: http://stackoverflow.com/comment/37107067
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24064061
has comment: http://stackoverflow.com/comment/37106757
answers question: http://stackoverflow.com/q/24064061
has comment: http://stackoverflow.com/comment/37106793
type: Answer
score: 6
has body: I receive the error: The type Iterator is not generic; it cannot be parameterized with arguments Eclipse tells me that the import java.util.Iterator conflicts with a type defined in the same file. The only way I can get those two exact errors is to call my class Iterator. I suppose this would be an easy mistake to make if you were writing a little test class about iteration: import java.util.Iterator; import java.util.ArrayList; import java.util.List; public class Iterator { private static List<String> someList = new ArrayList<String>(); public static void main(String[] args) { someList.add("monkey"); someList.add("donkey"); for (Iterator<String> i = someList.iterator(); i.hasNext();) { String item = i.next(); System.out.println(item); } } } Solution: don't do that. Call it something else. As fun as it is to try and guess what your code looked like, had you posted an entire example in your question this would have been a shorted process. I'm not ruling out that there's another code sample that produces those errors, although I failed to find one with a bit of experimentation.
has comment: http://stackoverflow.com/comment/37106870
downvote count: 0

http://stackoverflow.com/q/24014883
has comment: http://stackoverflow.com/comment/37014780
score: 0
tagged with: groovy
has body: I am trying to create a jar with all of the dependencies in it that will host a small Groovy program that uses the Java compiler API to generate a class at runtime. I'm using Gradle One Jar to produce this, however I've also tried the Maven assembly plugin and achieved the same result. Here's the code that's failing: def compiler = ToolProvider.getSystemJavaCompiler() assert compiler != null Result when running java -jar on my jar file: Exception in thread "main" Assertion failed: assert compiler != null | | null false I'm guessing that this might be a manifest issue with it excluding the appropriate JDK jars that contain the compiler. Any suggestions on how to fix that? I don't need a Gradle or Maven-specific suggestion, thought that would help.
answer count: 1
type: UnansweredQuestion
has title: Java compiler null when creating jar with all dependencies
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/24018102
tagged with: gradle
type: Question

http://stackoverflow.com/comment/37082604
type: AnswerComment
has text: or there will be errors like:can't serialize class xxx.classname.If I use dissoc ,I must try to remove the ":class" recursively.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24051193

http://stackoverflow.com/a/24064992
answers question: http://stackoverflow.com/q/24063790
has body: Well I managed to work out where the gradle zip was being put (C:\Users\me\.gradle\wrapper\dists\gradle-1.8-bin\vruqmccc8532n7gr46qavsii8 so I dropped my separately downloaded zip in there and it got me past the issue. However since then I've also realized I was specifying the -Dhttp properties after the command and not before it so I suspect had I done that it would have worked. (Haven't retried it with a cleaned install area though) i.e I should have had gradlew -Dhttp.proxyHost=proxy.blah.com -Dhttp.proxyPort=8000 removeSolutions instead of: gradlew removeSolutions -Dhttp.proxyHost=proxy.blah.com -Dhttp.proxyPort=8000 duh!
upvote count: 5
type: AcceptedAnswer
downvote count: 0
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/24063790
has comment: http://stackoverflow.com/comment/45388745

http://stackoverflow.com/a/24010772
has body: Change the your ArrayAdapter to hold string instance. You do not need an ArrayList of HashMap, if the purpose it's just printing the key and the value of the HashMap final ArrayList&lt;String&gt; valuesList = new ArrayList&lt;String&gt;(); for(int i = 0;i&lt;response.getPropertyCount();i++){ SoapObject dersListesi = (SoapObject)response.getProperty(i); for (int j = 0; j &lt; dersListesi.getPropertyCount(); j++) { Object objectNames = dersListesi.getProperty(j); SoapObject ders_kodu = (SoapObject)objectNames; SoapObject ders_adi = (SoapObject)objectNames; String dersKodu = ders_kodu.getProperty("dersKodu").toString(); String dersAdi = ders_adi.getProperty("dersAdi").toString(); valuesList.add(dersKodu+ " " + dersAdi); } ArrayAdapter&lt;String&gt; ad = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,valuesList);
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24010595
score: 3
answers question: http://stackoverflow.com/q/24010595

http://stackoverflow.com/comment/117768849
type: Comment
comment on: http://stackoverflow.com/a/60389787
score: 0
type: AnswerComment
has text: This works for Kotlin, tks. And in kotlin the type was Long

http://stackoverflow.com/comment/37036812
type: QuestionComment
has text: Keep in mind this is an aircraft whose nose points towards its direction of movement.
type: Comment
comment on: http://stackoverflow.com/q/24026418
score: 0

http://stackoverflow.com/comment/37070706
type: QuestionComment
has text: Edited to display the whole class. I'm quite baffled as I have never had this problem with java before.
comment on: http://stackoverflow.com/q/24041747
score: 0
type: Comment

http://stackoverflow.com/comment/63156578
score: 0
has text: thanks @MadProgrammer, but if we want the character of DOS' Blinking is it possible? Which character is that?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24027567

http://stackoverflow.com/q/24058392
has answer: http://stackoverflow.com/a/24058530
type: AnsweredQuestion
tagged with: java
has title: how big a json/xml response is alright
tagged with: sharepoint
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24058530
tagged with: ajax
has body: Say, I retrieve a xml/json response which contains almost 1000 items.what would be the impact on processing it? leaving pagination aside, I would also need to attach event handlers to most of the items in the response. Is it practical in the sense that client side javascript can handle this much processing? will it cause the script to hang?

http://stackoverflow.com/a/23969981
has comment: http://stackoverflow.com/comment/36931284
has body: The rules are the same, it's just that Double.MAX_VALUE is so large that 12345 is roughly 300 orders of magnitude (10300 times) smaller. Adding a number that is so much smaller than Double.MAX_VALUE does not change its value. Adding a number that is of the same order of magnitude would make a difference, though: Double.MAX_VALUE + 1E300 produces a positive infinity result, which is not the same as Double.MAX_VALUE (demo)
answers question: http://stackoverflow.com/q/23969930
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23969930

collections
tags question: http://stackoverflow.com/q/23971980
tags question: http://stackoverflow.com/q/24002379
tags question: http://stackoverflow.com/q/24030239
tags question: http://stackoverflow.com/q/24042523
tags question: http://stackoverflow.com/q/24081605
tags question: http://stackoverflow.com/q/24030884
tags question: http://stackoverflow.com/q/24102194
tags question: http://stackoverflow.com/q/23941860
tags question: http://stackoverflow.com/q/23952142
tags question: http://stackoverflow.com/q/24067159
tags question: http://stackoverflow.com/q/23993169
type: Tag
tags question: http://stackoverflow.com/q/24097251
tags question: http://stackoverflow.com/q/24086925
tags question: http://stackoverflow.com/q/23996735
tags question: http://stackoverflow.com/q/23976344
tag name: collections
tags question: http://stackoverflow.com/q/24021858
tags question: http://stackoverflow.com/q/23959661
tags question: http://stackoverflow.com/q/24074736
tags question: http://stackoverflow.com/q/24065127
tags question: http://stackoverflow.com/q/23962881
tags question: http://stackoverflow.com/q/24010987
tags question: http://stackoverflow.com/q/23945738
tags question: http://stackoverflow.com/q/23957393

http://stackoverflow.com/a/24631969
type: Answer
has body: Use netty-socketio java realtime framework, it supports long-polling and websocket transports. javascript, ios, android client libs also available.
upvote count: 1
answers question: http://stackoverflow.com/q/23991376
score: 1
downvote count: 0

http://stackoverflow.com/q/24058212
has comment: http://stackoverflow.com/comment/37095346
has comment: http://stackoverflow.com/comment/37095501
tagged with: buildpath
has answer: http://stackoverflow.com/a/24058460
type: UnansweredQuestion
score: 0
tagged with: package
has answer: http://stackoverflow.com/a/24058566
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37095453
type: Question
has comment: http://stackoverflow.com/comment/37095216
answer count: 2
has body: In my Java class, I would like to output the code of another (uncompiled) Java class of the same project. This is the package structure: main (package) files (package) SampleClass.java SampleFile.txt CodeOutput.java And the code of CodeOutput.java: public class CodeOutput { public void run() { InputStream in = getClass().getResourceAsStream("files/SampleClass.java"); BufferedReader stream = new BufferedReader(new InputStreamReader(in)); try { System.out.println(stream.readLine()); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { new CodeOutput().run(); } } I try to load the file SampleClass.java from the files package and output its first line. However, the Java file doesn't remain in the package after compilation. I also tried to exclude the file from the build path (in the file's context menu: Build Path -> Exclude), so the code isn't compiled to a .class file, but still the Java file doesn't appear in the package. It works fine with the SampleFile.txt, so I'm sure it has something to do with the project/build path settings. Any ideas how to treat Java files like other resources in a package?
has title: Keeping Java files in packages during compilation

http://stackoverflow.com/q/24081717
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24081787
has body: public static List subList(List l) { List evenL = new ArrayList(); for (int i = 0; i &lt; l.size(); i++) { if (l.get(i))%2 ==0) { evenL.add(i); } } return evenL; } Getting an error that % is undefined in this case. Not sure how else to retrieve an create a new list with even numbers.
has comment: http://stackoverflow.com/comment/37138236
type: Question
has answer: http://stackoverflow.com/a/24081805
has comment: http://stackoverflow.com/comment/37138209
possible better answer: http://stackoverflow.com/a/24081762
tagged with: arraylist
upvote count: 0
has comment: http://stackoverflow.com/comment/37138523
has answer: http://stackoverflow.com/a/24081733
score: -6
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/24081778
accepted answer: http://stackoverflow.com/a/24081787
has title: Java creating an even ArrayList
downvote count: 6
has answer: http://stackoverflow.com/a/24081762

http://stackoverflow.com/comment/37170213
score: 0
type: QuestionComment
has text: Why not, in the unit compareTo, just do return getValue(0) - CompareUnit.getValue(0)?
type: Comment
comment on: http://stackoverflow.com/q/24098373

http://stackoverflow.com/comment/36887671
comment on: http://stackoverflow.com/q/23946833
score: 0
has text: have you tried after initializing `posts` ArrayList inside `getPosts` method ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36887913
has text: are you sure you want to enter like `{50, 90, 100}` in `InputDialog`?
comment on: http://stackoverflow.com/q/23946995
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24063884
favorite count: 0
tagged with: binding
type: UnansweredQuestion
tagged with: oracle-adf
tagged with: jsf
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37111768
has title: JSF Page fragments & ADF Data Binding
type: Question
has answer: http://stackoverflow.com/a/24085582
has answer: http://stackoverflow.com/a/24077646
has body: Is there any way to use adf bindings in jsf page fragments? When I create jsf page fragment and layout my components without any binding and when I add this page fragment on my destination page all work well, but when I use adf binding in page fragments it doesn't work. How can I deal with data binding in fragment within jsf page?
answer count: 2
downvote count: 0

http://stackoverflow.com/q/23954388
downvote count: 2
has answer: http://stackoverflow.com/a/23954539
has answer: http://stackoverflow.com/a/23954530
has answer: http://stackoverflow.com/a/23954564
has answer: http://stackoverflow.com/a/23954461
has answer: http://stackoverflow.com/a/23954642
type: Question
has body: I don't understand why my code does not work see below I am supposed to transform this code public class Iteration { public static void main(String[] args) { int x, y, z, sum, tal; for(x=1;x&lt;10;x++) for(y=0;y&lt;10;y++) for(z=0;z&lt;10;z++){ tal=x*100+y*10+z; sum=(x*x*x)+(y*y*y)+(z*z*z); if(sum==tal) System.out.print(tal+" "); } } } into a code with a while loop, but it does not work the same! I dont understand why...... public class testasaker { public static void main(String[] args) { int sum, tal, x = 1, y = 0, z = 0; while (x&lt;10 &amp;&amp; y&lt;10 &amp;&amp; z&lt;10) { tal = x * 100 + y * 10 + z; sum=(x*x*x)+(y*y*y)+(z*z*z); if(sum==tal) System.out.print(tal+" "); z++; y++; x++; } } }
has comment: http://stackoverflow.com/comment/36901107
tagged with: java
has comment: http://stackoverflow.com/comment/36901020
has title: Code not working while lopp with &&
score: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/36901042
favorite count: 0
upvote count: 2
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/a/24079966
has body: You can not! Only public, final and abstract modifier are allowed in a Java Class. However, you can write a static, private nested class. But only in nested class.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24079952
score: 2
downvote count: 0

http://stackoverflow.com/q/23964862
downvote count: 0
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/36923563
type: UnansweredQuestion
tagged with: swing
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/36921774
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36922522
type: Question
has title: Java applications on Mac using Java7, have a limited window width
has body: I'm developing a desktop application for Mac. When I run the application using Java6 it works fine, but when I run it using Java7, the application window seems to be limited to a width 1024 pixels (i.e. when it starts the window is 1024px wide, and can't be expanded/dragged to make it wider). I've tried all sorts of ways to adjust the size (setting window state to maximized, explicitly setting the width, etc.). I've also tried changing where I set the Window size, but so far no luck. I have tried searching for anyone who has had similar problems, but have not had much luck. The only real hit I got was from an OTN discussion forum: https://community.oracle.com/thread/2617106, but there is no resolution and the discussion seems to be archived so I can't reply to it. If anyone out there has come across this issue, I'd love to hear about it. Environment: Operating System: Mac OS X 10.7.5 Java Version: 1.7.0_55 (Oracle Corporation) New Information: Have found a related bug report in OpenJDK: https://bugs.openjdk.java.net/browse/JDK-8046008?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel This seems to indicate that it is a problem for Mac OS X 10.7.5, which I am using.

http://stackoverflow.com/comment/37001702
type: Comment
comment on: http://stackoverflow.com/a/24006605
has text: the no. of students in your list is **exam.length** or **count** but you are iterating over the loop **100 - count** times. just correct that and you are good to go...
type: AnswerComment
score: 0

http://stackoverflow.com/q/24064723
has body: I have a collection of events its structure is as follows : { "_id" : ObjectId("537b3ff288f4ca2f471afcae"), "Name" : "PREMISES MAP DELETED", "ScreenName" : "AccessPointActivity", "Timestamp" : NumberLong("1392113758000"), "EventParams" : "null", "TracInfo" : { "ApplicationId" : "fa41f204bfc711e3b9f9c8cbb8c502c4", "DeviceId" : "2_1VafJVPu4yfdbMWO1XGROjK6iQZhq4hAVCQL837W", "UserId" : "pawan", "SessionId" : "a8UHE16mowNwNGyuLXbW", "WiFiAP" : "null", "WiFiStrength" : 0, "BluetoothID" : "null", "BluetoothStrength" : 0, "NetworkType" : "null", "NetworkSubType" : "null", "NetworkCarrier" : "Idea", "Age" : 43, "Gender" : "Female", "OSVersion" : "16", "Manufacturer" : "samsung", "Resolution" : "600*976", "Platform" : "Android", "Latitude" : 40.42, "Longitude" : -74, "City" : "Monmouth County", "CityLowerCase" : "monmouth county", "Country" : "United States", "CountryLowerCase" : "united states", "Region" : "New Jersey", "RegionLowerCase" : "new jersey", "Time_zone" : "null", "PinCode" : "07732", "Locale" : ", Paradise Trailer Park", "Accuracy" : 0, "Timestamp" : NumberLong("1392113758000") } } their are many event on different screens. My expected output is as follows : { ApplicationId:"fa41f204bfc711e3b9f9c8cbb8c502c4", EventName:"PREMISES MAP DELETED", Eventcount:300, ScreenviewCount:20, DeviceCount:10, UserCount:3 } EventCount : It is count of EventName ScreenviewCount : It is the count of distinct screenName distinct per session DeviceCount : It is the count of distinct deviceId UserCount : It is the count of distinct userCount Their will be multiple event on multiple screens(ScreenName). Currently i' am using following approach : Using aggregation to get each event name and it count eg : { _id: { ApplicationId:"fa41f204bfc711e3b9f9c8cbb8c502c4", EventName:"PREMISES MAP DELETED" } EventCount:300 } For each event name from above aggregation result I call following queries in while loop until aggregation output has documents: a) Distinct query using eventName from aggregat…
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/37125053
score: 1
tagged with: java
tagged with: mapreduce
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/24072813
answer count: 1
downvote count: 0
tagged with: aggregation-framework
has comment: http://stackoverflow.com/comment/37121922
has comment: http://stackoverflow.com/comment/37124987
favorite count: 0
accepted answer: http://stackoverflow.com/a/24072813
has title: Get multiple fields count from one query in MongoDB?
upvote count: 1

http://stackoverflow.com/q/23955313
tagged with: java-time
has title: java - how to hold time?
type: Question
has answer: http://stackoverflow.com/a/67743634
linked to: http://stackoverflow.com/q/38922754
has body: I'm building a little android app where the user would choose a start time for some operation. I'm using the TimerPickerDialog: mTimePicker = new TimePickerDialog(getContext(), new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) { startTimeHours = selectedHour; startTimeMinutes = selectedMinute; }, hour, minute, is24hours); and when a time is selected it returns an int for the hour and int for the minutes, which I save as a global variable. later in my app I want to convert those numbers into a Time object which I can then use to see if the current time is bigger or smaller than the time represented in that class. what I've done is this: Time tStart = new Time(startTimeHours, startTimeMinutes, 0); but eclips says that this constructor is deprecated. however the constructor that takes long is does not seem to be deprecated. I looked around and in one post someone recommended to use the Calendar object - but I couldn't figure it out - how to get a new instance of it and set my time. it looks like an overhead for just containing the time. What is the best practice for such a scenario? if I need to use the constructor that accepts the long variable - how do I convert my 2 integers to that long value?
has answer: http://stackoverflow.com/a/23955525
has answer: http://stackoverflow.com/a/23955732
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36903337
favorite count: 0
tagged with: time
type: UnansweredQuestion
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/36902844
score: 1
tagged with: java

http://stackoverflow.com/a/24039272
has comment: http://stackoverflow.com/comment/37060227
downvote count: 0
has body: Its a question of what you are trying to achieve together with real world problem domain in this case factorial. If the constructor has everything then the constructor knows about many other objects. It becomes dependent on all those objects. When features are added: Example: What if i want the all positions where an Employee can sit around a table. The class above will not be able to as it is too tightly dependent for creation. So you will have to expand you domain to include overloaded constructors and soon enough you will realise it becomes unmaintainable with increasing dependencies and population of Domain specific objects. It is best programming practise to split it up. Service concept proposed in Domain-Driven Design. Best to now read about different Design patterns particularly http://en.wikipedia.org/wiki/Design_Patterns#Creational Factories and why we use them problem of creating objects without specifying the exact class of object http://en.wikipedia.org/wiki/Factory_method_pattern Then i will suggest going forward reading about of Dependency injection and Inversion of control and why/how it decouples code. http://martinfowler.com/articles/injection.html Hope this helps!
score: 1
has comment: http://stackoverflow.com/comment/37059990
has comment: http://stackoverflow.com/comment/37059918
upvote count: 1
has comment: http://stackoverflow.com/comment/37060144
answers question: http://stackoverflow.com/q/24038907
type: Answer

http://stackoverflow.com/a/24038735
has comment: http://stackoverflow.com/comment/40145787
has comment: http://stackoverflow.com/comment/106110465
type: Answer
has body: try this one: BufferedImage bImage = SwingFXUtils.fromFXImage(logo.getImage(), null); ByteArrayOutputStream s = new ByteArrayOutputStream(); ImageIO.write(bImage, "png", s); byte[] res = s.toByteArray(); s.close(); //especially if you are using a different output stream. should work depending on the logo class you need to specify a format while writing and reading, and as far as I remember bmp is not supported so you will end up with a png byte array on the database
upvote count: 16
has comment: http://stackoverflow.com/comment/37059195
answers question: http://stackoverflow.com/q/24038524
has comment: http://stackoverflow.com/comment/106113325
score: 16
has comment: http://stackoverflow.com/comment/45310741
accepted answer of: http://stackoverflow.com/q/24038524
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37059349

http://stackoverflow.com/q/24053393
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24164509
has body: I'm using bi publisher webservices api to assign roles to users. The code for this is SecurityService_Service sevice = new SecurityService_Service(); SecurityService securityService = sevice.getSecurityService(); List&lt;String&gt; rolesList=new ArrayList&lt;String&gt;(); rolesList.add("Testers"); securityService.assignRolesToUser("testuser3", rolesList , "weblogic", "password123"); After running i'm getting error. Stack trace is : Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: org.xml.sax.SAXException: Found character data inside an array element while deserializing at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:197) at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:130) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:125) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136) at $Proxy32.removeRolesFromUser(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84) at $Proxy33.removeRolesFromUser(Unknown Source) at view.BIPSecurityInfo.main(BIPSecurityInfo.java:89)
tagged with: web-services
type: AnsweredQuestion
tagged with: bi-publisher
accepted answer: http://stackoverflow.com/a/24164509
has title: javax.xml.ws.soap.SOAPFaultException: org.xml.sax.SAXException: Found character data inside an array element while deserializing
has comment: http://stackoverflow.com/comment/37091609
tagged with: java

http://stackoverflow.com/comment/36893063
type: Comment
comment on: http://stackoverflow.com/q/23949812
type: QuestionComment
score: 2
has text: The answer to the question in your *title* is "yes." It's unclear, though, whether that's the question you're actually asking in your text.

http://stackoverflow.com/q/24058656
has body: I want to write an application which takes application id and certificate of my client's app registered in APNS server and tries to push a notification to the concrete device in his name. I should recieve the data from my client in JSON form. The problem is I can't make him to send me a certificate in JSON. I would like to use this method call later: Push.alert("Hello World!", "keystore.p12", "keystore_password", false, "Your token"); Is there a way to do this without .cer file? Can client of mine send me just some text information to fill in place of "keystore.p12", "keystore_password"?
tagged with: ios
tagged with: ssl
score: 0
tagged with: push-notification
answer count: 1
has answer: http://stackoverflow.com/a/24196022
type: UnansweredQuestion
tagged with: java
has title: Push notification to apple device with no certificate file
type: Question

http://stackoverflow.com/a/24036351
upvote count: 1
answers question: http://stackoverflow.com/q/24036013
has body: public List&lt;Category&gt; getCategories() throws Exception{ List&lt;Category&gt; tmp= new ArrayList&lt;Category&gt;(); try{ sql = "SELECT cat_id, cat_name FROM crm_categories"; prep = conn.prepareStatement(sql); rs = prep.executeQuery(); while(rs.next()){ cat = new Category(); cat.setAttributes(rs.getInt("cat_id"), rs.getString("cat_name")); tmp.add(cat); } } catch(Exception e){ e.printStackTrace(); } this.catList = tmp; return tmp; } Right answer has been posted, but id like to point, that you should not use class field in this method. If you will launch this method in two threads at the same time, it will cause to double some DB entries (in some cases all entries will be doubled). Use local field and if this method should modify class field, do so before returning result. access object is of course for (Category c: getCategories()) { c.getAttributes(); }
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/36908233
has text: Delivering java application through a server: did you check Java WebStart?
comment on: http://stackoverflow.com/q/23957824
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24089940
type: Question
has title: Uploading Files to AWS S3 from an Android App
tagged with: amazon-s3
tagged with: java
score: -1
answer count: 1
tagged with: amazon-web-services
favorite count: 0
tagged with: android
has body: Edited 7th June,14 My Android app needs to have a feature where clients can upload their files. I want AWS S3 as my storage. Moreover i dont want to use SECRET_KEY and ACCESS_KEY_ID on client side. What is the the best way to do this. Can someone provide the working code too ? I read that i can request to AWS for a signed URL and then make client directly upload to that URL. How to achieve this ?
has answer: http://stackoverflow.com/a/24154136
upvote count: 0
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/q/23950554
has body: We have an old .net program that makes registry keys. I don't know the code for the program, but it makes keys for an 32 bit machine with windows xp on HKLM\SOFTWARE\TESTPROGRAM\INSTALL\PROG1 But if you install the same on a 64 bit pc with windows 7 the key is at: HKLM\SOFTWARE\Wow6432Node\TESTPROGRAM\INSTALL\PROG1 Now I just installed it at windows 8 and the key is installed in another location at: HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\Wow6432Node\TESTPROGRAM\INSTALL\PROG1 It seems the old .net program automatically knows where to install the keys and also where to read the keys from. Because I don't know the code I don't know what it uses to read the keys. But I have to read the same keys from java. At the moment I use the system command reg query to do this. Is there an option to automatically detect which entry he has to search the key for in java?
tagged with: registry
upvote count: 1
answer count: 0
score: 1
tagged with: java
has title: find registry key through a java program from another application
type: Question
downvote count: 0
tagged with: windows
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36923756
type: Comment
score: 2
has text: The fun ends here :(. +1
type: AnswerComment
comment on: http://stackoverflow.com/a/23966037

http://stackoverflow.com/q/23961472
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
has title: Change layout weight programmatically
tagged with: java
type: Question
downvote count: 0
answer count: 1
has body: I am trying to set the layout weight of a view programmatically to a random number. I think I have the right approach, but I am unable to get some of the technical details. This is what I have so far: public class EnterText extends Activity { View view = findViewById(R.id.view1); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_enter_text); Random r = new Random(); int i1 = r.nextInt(5 - 1) + 1; //This is to put the weight in a format like "1f" String weight = new StringBuilder(String.valueOf(i1)).append("f").toString(); int height1; view.getLayoutParams().height = height1; int width1; view.getLayoutParams().height = width1; //Set the weight view.setLayoutParams(new LayoutParams(LayoutParams.height1, LayoutParams.width1, weight)); } } I believe this is close to working, but I am running into some errors. First, I get the error The method StringBuilder(String) is undefined for the type EnterText, which I don't think should be occurring. Second, at 0dip, I get the errors Syntax error on token ".0d", . expected. Does anyone know how to fix this, and does anyone know a better way of doing what I'm trying to do?
has answer: http://stackoverflow.com/a/23961557

http://stackoverflow.com/comment/37144743
type: Comment
type: QuestionComment
has text: @LuiggiMendoza That's correct. Sorry for the confusion, I probably should have worded it that way originally.
comment on: http://stackoverflow.com/q/24084864
score: 0

http://stackoverflow.com/comment/37029626
comment on: http://stackoverflow.com/a/23983342
type: Comment
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/55013/discussion-between-alessandro-suglia-and-joshua-taylor).
score: 0

http://stackoverflow.com/comment/37081156
has text: Yes, by endpoint element, I meant the outbount-endpoint XML element, sorry for the confusion. So I'm assuming the connector attribute could indeed take a mule expression holding a reference to the connector dynamically created, or maybe it would simply take its name, like in your example with the muleClient.send() call. Thanks for all the help!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24047253

http://stackoverflow.com/comment/37111087
comment on: http://stackoverflow.com/q/24066305
score: 0
type: Comment
type: QuestionComment
has text: :) Could you edit it into your question?

http://stackoverflow.com/comment/36916533
comment on: http://stackoverflow.com/a/23962252
score: 0
type: Comment
has text: Yes, you are correct. It would seem that I have misread. I'll fix the post to reflect that.
type: AnswerComment

http://stackoverflow.com/q/23965087
tagged with: indexof
has comment: http://stackoverflow.com/comment/36921991
tagged with: arrays
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23965222
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23965253
type: Question
has title: Get index of objects in an array
tagged with: java
answer count: 3
upvote count: 1
has body: I am trying to find the index of each object in my array. public class MonsterTest { public static void main(String[] args) { // TODO Auto-generated method stub Monster [] ma = new Monster[3]; ma[0] = new Vampire(); ma[1] = new Dragon(); ma[2] = new Monster(); for(int x = 0; x &lt; 3; x++) { System.out.println(ma[x].getClass()); System.out.println(java.util.Arrays.asList(ma[x]).indexOf(x)); ma[x].frighten(x); } } } Am I using the java.util.Arrays.asList(ARRAY).indexOf(element) method here correct? (Well I am obviously not because the output is incorrect.
has answer: http://stackoverflow.com/a/23965196

http://stackoverflow.com/comment/36946722
type: AnswerComment
has text: No, polymorphism does not require a cast.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23978414

http://stackoverflow.com/comment/37074946
type: QuestionComment
type: Comment
score: 1
has text: Seems like the DTD for some of your xml files cannot be retrieved ... possibly the server is down, or your network connection. You can probably remove the reference to the DTD from the xml file, since validation is usually optional.
comment on: http://stackoverflow.com/q/24046976

http://stackoverflow.com/comment/37060790
type: QuestionComment
comment on: http://stackoverflow.com/q/24039680
score: 0
has text: Because you're going from index 0 to index array.length - 2, instead of -1. Fix that, and you'll probably be fine.
type: Comment

http://stackoverflow.com/comment/37125137
comment on: http://stackoverflow.com/q/24074312
has text: It's not 0xA4, it's -0x5C. What is -0x5C << 16? It's -0x5C0000. What is 0x44000000 | -0x5C0000?
type: Comment
type: QuestionComment
score: 0

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/24032121
tags question: http://stackoverflow.com/q/24099454
tags question: http://stackoverflow.com/q/24003802
tags question: http://stackoverflow.com/q/24046008
tags question: http://stackoverflow.com/q/24056440
tags question: http://stackoverflow.com/q/24091654
tag name: android-actionbar
tags question: http://stackoverflow.com/q/24021126

http://stackoverflow.com/q/24094172
has comment: http://stackoverflow.com/comment/37162650
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37162604
has comment: http://stackoverflow.com/comment/37162689
has comment: http://stackoverflow.com/comment/37162517
answer count: 0
has comment: http://stackoverflow.com/comment/37162675
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Array of string with JSON and custom adapter
has comment: http://stackoverflow.com/comment/37162701
type: Question
has body: Good morning, i'm retrieving some values from my MySQL database because i want to display them into a ListView with custom adapter. I have this code. for(int i=0; i&lt;jsonArray.length();i++) { ogge = new Ogge(); json = jsonArray.getJSONObject(i); ogge.title = json.getString("Title"); ogge.array = new String[] {json.getString("field1"), json.getString("field2"), json.getString("field3"), json.getString("field4"), json.getString("field5"), json.getString("field6")}; ogge.adapter = Ogge.MY_CUSTOM; list.add(ogge); } This for is correct because the values are put in the array in Ogge class. This is the adapter case Ogge.MY_CUSTOM: view = inflater.inflate(R.layout.custom, null); textView = (TextView)view.findViewById(R.id.textView1); textView2 = (TextView)view.findViewById(R.id.textView2); textView3 = (TextView)view.findViewById(R.id.textView3); textView.setText(Html.fromHtml(ogge.title)); textView2.setText(MyJsonClass.DATABASE_FIELD[position]); textView3.setText(ogge.array[position]); break; The problem is the follow: when i open my app i see only the first and the second value of ogge.array but i want to show all. If i make a for into the adapter to get the value from the array the values are all stored into the array so the array is correct but, then, why i show only the first two values and not all? Adapter full code public MyCustomAdapter(Context context, int resource, ArrayList&lt;Ogge&gt; list) { super(context, resource, list); // TODO Auto-generated constructor stub this.context = context; this.list = list; } @SuppressLint("CutPasteId") @Override public View getView(int position, View view, ViewGroup parent) { inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final Ogge ogge = list.get(position); switch(ogge.adapter) { case Ogge.MY_CUSTOM: view = inflater.inflate(R.layout.custom, null); textView = (TextView)view.findViewById(R.id.textView1); textView2 = (TextView)view.findViewById(R.id.textView2); textView3 = (TextView)view.fin…
has comment: http://stackoverflow.com/comment/37162618
has comment: http://stackoverflow.com/comment/37162670
score: 0
has comment: http://stackoverflow.com/comment/37162737

http://stackoverflow.com/comment/37138121
type: Comment
has text: What benefit would there be, in your view? What do you dislike about calling `new StringBuilder(s)`?
type: QuestionComment
comment on: http://stackoverflow.com/q/24081618
score: 5

println
tags question: http://stackoverflow.com/q/24089748
tag name: println
type: Tag
tags question: http://stackoverflow.com/q/24006358

http://stackoverflow.com/comment/37194644
type: QuestionComment
comment on: http://stackoverflow.com/q/23981421
score: 1
type: Comment
has text: Try AutoIt. It's designed for this.

http://stackoverflow.com/q/24063958
tagged with: android-listview
answer count: 1
has comment: http://stackoverflow.com/comment/37106394
has answer: http://stackoverflow.com/a/24064405
accepted answer: http://stackoverflow.com/a/24064405
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: How to identify which list view item is clicked when using same list view layout for multiple lists in android?
has body: I have created a single dialog box in one function, and passing list view layout resource in it, to make listview inside dialog. I have set onClickItemListener in it to get the listener of what item is clicked. As i am using same dialog box with same list view, having different values. I want to identify which listview is clicked by some unique key. I tried looking in google but didn't find any solution. I am reusing same dialog code with list view for multiple functionality. One time i am showing category, but other time showing type and selecting one using click on item, but not able to identify which click is for type and which one for category. Please guide me in right direction. Can i set some parameter in listview and read it when item is clicked to parse and get to know which listview is clicked?
tagged with: listviewitem
type: Question
has comment: http://stackoverflow.com/comment/37106749
tagged with: listview
score: 0

http://stackoverflow.com/comment/37061172
comment on: http://stackoverflow.com/q/24039021
score: 0
type: Comment
type: QuestionComment
has text: @BoristheSpider got it, seems I've completely misunderstood the question, will remove the comment thou, I thought OP was asking how to be sure to iterate on an unmodifiable snapshot of the initial map

http://stackoverflow.com/comment/62148172
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23968969
has text: also a .net dev new to java & if i hear async immediately assume IO Completion Ports (windows) and WHATEVER / POSIX AIO (linux)? and was wondering what okhttp3's docs mean with "responses are processed on the request thread" (WTF?) and how that worked with the RxJava call adaptor (which takes a RxScheduler). finally found this line https://github.com/square/retrofit/blob/28d350d99430c87b4ada7d1aa9e08c96884cb388/retrofit-adapters/rxjava/src/main/java/retrofit2/adapter/rxjava/RxJavaCallAdapterFactory.java#L171 and boom..they sync call in rx, using scheduler in place of okhttp3 dispatcher
score: 1

http://stackoverflow.com/a/23990260
downvote count: 0
answers question: http://stackoverflow.com/q/23955684
accepted answer of: http://stackoverflow.com/q/23955684
upvote count: 2
has body: You can exclude single or multiple files from building. Right click on project select Properties. Go to Java Build Path in Source tab add this text file in excluded list. Refer pic below.
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/36965907
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23988977
has text: Did you notice that the max is **exclusive** ? To generate 0 or 1, you need to pass 2.

http://stackoverflow.com/comment/47314968
type: Comment
type: QuestionComment
has text: @Stan Update Android-Studio. Update SDK. Update all modules. Update support library. Update everything... Also use latest SDK (targetSdk set to 22)
comment on: http://stackoverflow.com/q/24044903
score: 0

http://stackoverflow.com/a/24049672
answers question: http://stackoverflow.com/q/24048202
has comment: http://stackoverflow.com/comment/37129776
score: 0
has comment: http://stackoverflow.com/comment/37121638
has comment: http://stackoverflow.com/comment/37122844
type: Answer
has body: You might use an image processing framework, like Marvin or ImageJ, for such purpose, as shown below. input: output: source code: import marvin.image.MarvinColorModelConverter; import marvin.image.MarvinImage; import marvin.io.MarvinImageIO; import marvin.math.MarvinMath; import static marvin.MarvinPluginCollection.*; public class ClosingDemo { public ClosingDemo(){ MarvinImage image = MarvinImageIO.loadImage("./res/closingIn.png"); image = MarvinColorModelConverter.rgbToBinary(image, 127); morphologicalClosing(image.clone(), image, MarvinMath.getTrueMatrix(60, 60)); MarvinImageIO.saveImage(image, "./res/closingOut.png"); } public static void main(String[] args) { new ClosingDemo(); System.exit(0); } }

http://stackoverflow.com/comment/37030151
has text: @Chandrew : what do you mean?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24022912

http://stackoverflow.com/q/24096729
type: AnsweredQuestion
has body: I have two questions. First int i = 0; System.out.println("\nint i is" + (i == 0) ? "i==0" : "i!=0"); I receive this error: Type mismatch: cannot convert from String to boolean Eclipse tells me 1 quick fix available: Insert != null check Second System.out.println("\nint i is" + (i == 0) != null ? "i==0" : "i!=0"); With the != null check I get no error, but "\nint i is" is not printed, only the result i==0. I totally not understand the errors. Please help =)
tagged with: java
type: Question
tagged with: ternary
downvote count: 0
has answer: http://stackoverflow.com/a/24096762
answer count: 1
tagged with: operator-keyword
score: 1
has comment: http://stackoverflow.com/comment/37167218
favorite count: 0
has title: Java Ternary Operator insert != null check and syso not printed
accepted answer: http://stackoverflow.com/a/24096762
upvote count: 1

http://stackoverflow.com/q/23952426
score: -12
upvote count: 0
downvote count: 12
has comment: http://stackoverflow.com/comment/36897570
has answer: http://stackoverflow.com/a/23952529
has comment: http://stackoverflow.com/comment/36897648
favorite count: 0
tagged with: exception
possible better answer: http://stackoverflow.com/a/23952529
accepted answer: http://stackoverflow.com/a/23952670
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36897583
tagged with: java
has title: Java Class Exception
type: Question
has comment: http://stackoverflow.com/comment/36897622
has comment: http://stackoverflow.com/comment/36897726
has comment: http://stackoverflow.com/comment/36897598
has comment: http://stackoverflow.com/comment/36897565
has answer: http://stackoverflow.com/a/23952670
answer count: 2
has body: I have Some class exception to create class FirstException extends Exception class IllegalValue extends FirstException class IllegalIntValue extends FirstException I want to use this exception also in sub packeges. Their is a way to creat One class file with this classes and use them? Like nested classes.. Or the only way is to create this in 3 files of public classes? Thanks

http://stackoverflow.com/a/31560659
type: Answer
answers question: http://stackoverflow.com/q/23969953
upvote count: 1
has body: This error means you can not directly load data from file system because there are security issues behind this. The only solution that I know is create a web service to serve load files.
has comment: http://stackoverflow.com/comment/67393284
score: 1
downvote count: 0

http://stackoverflow.com/comment/37090658
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24055159
has text: Can you show us the whole code? I installed Groovy here and execute the following code: `println URLEncoder.encode("URL encoding fine!")`, it prints `URL+encoding+fine%21`. Moreover, using `import java.net.URLEncoder` or static import also works fine.

http://stackoverflow.com/q/23949547
has comment: http://stackoverflow.com/comment/37050197
tagged with: webdriver
has comment: http://stackoverflow.com/comment/37063317
has comment: http://stackoverflow.com/comment/40257639
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37091293
has comment: http://stackoverflow.com/comment/37092877
favorite count: 0
has comment: http://stackoverflow.com/comment/36942790
upvote count: 3
has body: I am using Selenium Web Driver HtmlUnitDriver for searching elements on a web page. I am able to search only those elements that are visible in the Page Source. However I can see these elements details using the Internet Explorer Developer Tools (F12). When I use these details (id/name/XPath) using Selenium, it throws a org.openqa.selenium.NoSuchElementException. The code I have written is : public static void main(String[] args) { WebDriver driver = new HtmlUnitDriver(){ @Override protected WebClient modifyWebClient(WebClient client) { DefaultCredentialsProvider credentialsProvider = new DefaultCredentialsProvider(); credentialsProvider.addNTLMCredentials("username", "password", null, -1, "localhost", "domain"); client.setCredentialsProvider(credentialsProvider); return client; } }; driver.get("URL"); System.out.println(driver.getPageSource()); WebElement myDynamicElement = (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfElementLocated(By.id("ppm_timesheet"))); } PAGE SOURCE <?xml version="1.0" encoding="UTF-8"?> Title If I search the element "ppm", it is successful which is present in page source. When I search the element "ppm_timesheet" I am getting following exception maybe because this element is not present in the page source. But when I press F12 in Internet Explorer and select this element in developer tools, this element is present there in HTML: The full exception is: Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 20 seconds Build info: version: '2.8.0', revision: '14056', time: '2011-10-06 12:41:26' System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1 build 7601 Service Pack 1', java.version: '1.6.0' Driver info: driver.version: unknown at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:220) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:188) at com.auto.Automation.main(Automation.java:32) Caused by: org.openqa.selenium.NoSuchElementExceptio…
has comment: http://stackoverflow.com/comment/37096002
tagged with: selenium-webdriver
type: UnansweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/24056898
type: Question
has comment: http://stackoverflow.com/comment/37095546
score: 3
has comment: http://stackoverflow.com/comment/36963365
has comment: http://stackoverflow.com/comment/37096357
tagged with: java
has answer: http://stackoverflow.com/a/61791773
tagged with: htmlunit-driver
has title: Selenium WebDriver not able to find elements which are not present in the Page Source but present in HTML when seen through Developer Tools

http://stackoverflow.com/comment/36889285
has text: Could be a function in Eclipse (like a drag on drop item) but yes Android
comment on: http://stackoverflow.com/q/23947717
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37128759
comment on: http://stackoverflow.com/q/24065450
has text: Hi @Jens. I have already added the `c3p0` and `mchange-commons-java`dependencies to my `pom.xml` file.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24008395
score: 12
tagged with: oracle-database
downvote count: 1
favorite count: 0
tagged with: oracle-sqldeveloper
has comment: http://stackoverflow.com/comment/37004009
has title: SQL Developer error Unable to find Java Virtual Machine
duplicate of: http://stackoverflow.com/q/7385550
type: AnsweredQuestion
tagged with: java
tagged with: oracle11g
type: Question
has answer: http://stackoverflow.com/a/24009933
accepted answer: http://stackoverflow.com/a/24009933
answer count: 1
upvote count: 13
linked to: http://stackoverflow.com/q/7385550
has body: After installing Oracle 11g client, when I tried to run SQL Developer it's asked me to give it java.exe path. As I didn't know I gave it the wrong path to program files java installation. Which I later found out that I should have given the path to java.exe inside oracle folder. Now every time I run it doesn't ask me for java.exe path, but shows the next error: Unable to find Java Virtual Machine. I think to correct this I need to give Java path to it in oracle folder, but how to change the path that I have already given?

http://stackoverflow.com/q/24096723
has title: unit tests for new programming features in Java
has answer: http://stackoverflow.com/a/24100703
tagged with: nio
score: 0
tagged with: junit
answer count: 1
duplicate of: http://stackoverflow.com/q/8492157
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8492157
tagged with: java
tagged with: unit-testing
has body: I'm interested to look at JUnit tests for new features in Java. Lets say I am talking about new file system API (NIO 2.0) which has been added into java 7. However, when I look at OpenJDK source code (or its mirror version on Github) I could not find any JUnit test. In fact, there are some code in \openjdk\jdk\test\java\nio which are not junit. Does anyone know whether java has been JUnit tested? Thanks
type: Question

http://stackoverflow.com/comment/37074882
type: QuestionComment
has text: Related: [Avoiding “!= null” statements in Java?](http://stackoverflow.com/q/271526/1065197), just that in this case you avoid from `try/catch` block.
score: 1
comment on: http://stackoverflow.com/q/24046971
type: Comment

http://stackoverflow.com/a/23978371
type: Answer
answers question: http://stackoverflow.com/q/23977909
score: 0
has body: In my projects I'm also using a custom key, because i need entities with a unique identity already before persist() was called. My solution is not using the @GeneratedValue annotation, but initialize the id-field manually. The @GeneratedValue annotation depends on your database and the primary key is provider by it. In your case the id field could be calculated and set before calling EntityManager.persist() or that step can be handled in a @PrePersist annotated EntityListener method (http://www.java2s.com/Tutorial/Java/0355__JPA/EntityListenerPreUpdate.htm). Apart from that extending annotations is not possible (Why is not possible to extend annotations in Java?); you could only combine annotations by using stereotypes or create your own annotations.
has comment: http://stackoverflow.com/comment/36948857

http://stackoverflow.com/q/23994037
has answer: http://stackoverflow.com/a/23995121
downvote count: 1
tagged with: alignment
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23995637
has comment: http://stackoverflow.com/comment/36977018
upvote count: 0
tagged with: java
has title: Alignment issue in Java Swing screen
has comment: http://stackoverflow.com/comment/36977417
tagged with: swing
type: Question
has body: I am facing an alignment issue in Java Swing screen. I have borderLayout here. My requirement is based on different buttons click suitable query will be executed and populated in JTable. But this screen is having an alignment problem, and JTable is hiding all other components. Below is the code: public class UI { static JTextField inputText = new JTextField(20); static JLabel errMsgLbl = new JLabel(); static PreparedStatement ptsmt; static ResultSet rs; static JButton nameButton; static JButton accnoButton; static JButton countryButton; static JButton altaccButton; static JButton showAllButton; static JButton clearButton; static JButton exitButton; static JButton prevButton; static JButton nextButton; static JLabel searchBy; static String[] columnNames = { "ID", "Name", "Original Name", "Account Number", "Country", "Alternate Account No", "Related Party Name", "Select" }; static JTable table; static JComponent createHorizontalSeparator() { JSeparator x = new JSeparator(SwingConstants.HORIZONTAL); x.setForeground(Color.BLACK); x.setPreferredSize(new Dimension(50, 3)); return x; } public static void main(String args[]) { try { DBConfig.loadEngineConfiguration(); } catch (Exception ex) { ex.printStackTrace(); } JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); final JTable table = new JTable(50, 8); JPanel topPnl = new JPanel(new BorderLayout()); JPanel cntrPnl = new JPanel(new BorderLayout()); JPanel bottomPnl = new JPanel(new BorderLayout()); JPanel hdrPnl = new JPanel((LayoutManager) new FlowLayout( FlowLayout.LEFT)); JPanel srchPnl = new JPanel((LayoutManager) new FlowLayout( FlowLayout.LEADING)); JPanel topBtnPnl = new JPanel((LayoutManager) new FlowLayout( FlowLayout.LEADING)); JPanel bottombtnPnl = new JPanel((LayoutManager) new FlowLayout( FlowLayout.LEADING)); JPanel navbtnPnl = new JPanel((LayoutManager) new FlowLayout( FlowLayout.TRAILING)); JPanel tblPnl = new JPanel((LayoutManager) new FlowLayout( FlowLayout.CENTER)); hdrPnl.add(new JLabel(…
score: -1
answer count: 2

http://stackoverflow.com/a/24087682
score: 0
answers question: http://stackoverflow.com/q/24087440
type: Answer
has body: Initialize initialMoneyOutput and finalMoneyOutput to 0 just before the for loop where you output it. Also why do you need to add all the initial money values in that for loop. Just get the latest one and convert it.
has comment: http://stackoverflow.com/comment/37150113

http://stackoverflow.com/q/24042592
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37069169
has comment: http://stackoverflow.com/comment/37108946
type: UnansweredQuestion
tagged with: xtext
has comment: http://stackoverflow.com/comment/45983999
tagged with: maven
has body: I build my xtext eclipse plugin project with maven and jenkins and the junit tests with tycho surefire. Jenkins runs on a 64 bit ubuntu and tests are failing with: java.lang.IllegalStateException: Unresolved proxy http://url/from/mydsl#//element. Make sure the EPackage has been registered. I tried to solve this problem with an overidden register function in the StandaloneSetup class like described at Switching from an inferred Ecore model to an imported one in your Xtext grammar but this didn't work for me. I tried to run the tests on ubuntu 32 bit and it surprisingly works without failure. I hope somebody can help me
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37068376
type: Question
tagged with: tycho-surefire-plugin
has title: Tycho surefire JUnit tests fail only on 64 bit ubuntu
has comment: http://stackoverflow.com/comment/37104558
tagged with: junit
downvote count: 0

http://stackoverflow.com/q/23986950
answer count: 1
accepted answer: http://stackoverflow.com/a/23987316
score: 0
has title: How to use Custom Log Configuration - Spring Boot
linked to: http://stackoverflow.com/q/20485059
has body: In a typical Spring Boot application like this, how do we configure it to use a "custom" log configuration? For example, in the current environment that my app runs, logback is causing error, how can I use other logging for example: [INFO] java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details. [INFO] at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:100) [INFO] at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:58) [INFO] at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:181) [INFO] at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:122) [INFO] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) [INFO] at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:92) [INFO] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:58)
has comment: http://stackoverflow.com/comment/36962928
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
has answer: http://stackoverflow.com/a/23987316
type: Question

http://stackoverflow.com/comment/36963022
comment on: http://stackoverflow.com/q/23987358
score: 0
type: Comment
type: QuestionComment
has text: Multiplication : a *= 2 (is similar to a=a*2) All are like same.

http://stackoverflow.com/a/24090862
has comment: http://stackoverflow.com/comment/37156434
answers question: http://stackoverflow.com/q/24090760
has body: You can't do what you want for many reasons. You can't refer to variables by name, not without lots of hideous reflection code. Strings are immutable in Java so eve if you could get a variable by name, you could not change the value of the String with the indirection you want.
score: 0
type: Answer

http://stackoverflow.com/comment/36996017
comment on: http://stackoverflow.com/a/24004611
score: 0
type: AnswerComment
type: Comment
has text: Might be nice to include that this is because the standard is to use 32-bit ALUs, rather than "just because". :)

list
type: Tag
tags question: http://stackoverflow.com/q/23962708
tags question: http://stackoverflow.com/q/23983791
tags question: http://stackoverflow.com/q/24055319
tags question: http://stackoverflow.com/q/24087285
tags question: http://stackoverflow.com/q/24085675
tags question: http://stackoverflow.com/q/23957176
tags question: http://stackoverflow.com/q/24072926
tags question: http://stackoverflow.com/q/24088961
tags question: http://stackoverflow.com/q/23993169
tags question: http://stackoverflow.com/q/24016100
tags question: http://stackoverflow.com/q/24079468
tag name: list
tags question: http://stackoverflow.com/q/23983301
tags question: http://stackoverflow.com/q/24103532
tags question: http://stackoverflow.com/q/23976327
tags question: http://stackoverflow.com/q/24092257
tags question: http://stackoverflow.com/q/24080702
tags question: http://stackoverflow.com/q/23985809
tags question: http://stackoverflow.com/q/24090406
tags question: http://stackoverflow.com/q/23983415
tags question: http://stackoverflow.com/q/23961673
tags question: http://stackoverflow.com/q/23989854
tags question: http://stackoverflow.com/q/24081184
tags question: http://stackoverflow.com/q/24025392
tags question: http://stackoverflow.com/q/23951410
tags question: http://stackoverflow.com/q/24070211
tags question: http://stackoverflow.com/q/23994747
tags question: http://stackoverflow.com/q/24010109
tags question: http://stackoverflow.com/q/23986079

http://stackoverflow.com/comment/37058479
has text: This is giving the output , but I need the output in a single string with comma separator. :(
comment on: http://stackoverflow.com/a/24037454
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37044250
type: Comment
type: QuestionComment
has text: Thank you for replaying! I am also use version 4.3.23, How can I update my Google Play Services project to 4.4?
comment on: http://stackoverflow.com/q/24016707
score: 0

http://stackoverflow.com/comment/36945529
type: Comment
score: 0
has text: here the scenario is, where there is no app yet deployed. am trying to understand how html response got triggered as shown above for 'GET /' request
type: AnswerComment
comment on: http://stackoverflow.com/a/23967554

http://stackoverflow.com/a/24027645
answers question: http://stackoverflow.com/q/24027542
has body: In a class it is usually a good idea to have some variables as private fields in you class and that your constructor is responsible the initial collection of and initialization of these variables. So as you have public Client(String host, int port) throws IOException { this.host = host; this.port = port; } and then other methods will do one piece of work e.g. public void connect () { //Stores the host string into a usable IP. InetAddress address = InetAddress.getByName(host); //Instantiate a socket with the given IP and port name. this.socket = new Socket(address, port); // yes another field } and then other methods will do the reading and writing. Also you may find that you need to use separate Threads, so try following a Chat example which you can easily find on the internet.
score: 0
type: Answer

http://stackoverflow.com/a/23959280
has comment: http://stackoverflow.com/comment/36911544
has comment: http://stackoverflow.com/comment/36911028
has comment: http://stackoverflow.com/comment/36911077
type: Answer
has comment: http://stackoverflow.com/comment/36913080
answers question: http://stackoverflow.com/q/23958792
upvote count: 2
score: 2
has body: You should use putStringSet instead of putString. Basically you need to create a set with all of your strings. Set set =new HashSet(); set.add("String 1"); set.add("String 2"); set.add("String 3"); Then you can write: SharedPreferences prefs = getSharedPreferences("MyPrefs", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putStringSet("strings", set); Boolean flag = editor.commit(); To get it back the next time you run the app you can do: SharedPreferences prefs = getSharedPreferences("MyPrefs", Activity.MODE_PRIVATE); Set set=new HashSet(); set=prefs.getStringSet("strings", null);
has comment: http://stackoverflow.com/comment/36913717
downvote count: 0
has comment: http://stackoverflow.com/comment/36910956

http://stackoverflow.com/comment/36977522
comment on: http://stackoverflow.com/a/23995113
type: AnswerComment
score: 0
type: Comment
has text: Additional notice: read also about CSRF protection, because POST request can also be provoked by attacker.

http://stackoverflow.com/comment/37020999
type: Comment
has text: Hmmm I'm not sure if I'm implementing it the right way. EDIT: I added the code of how I'm building my table
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24005865

http://stackoverflow.com/q/24102007
tagged with: java
has body: I've written a custom JTable to show the contents of my SQLite database in my Java program. Here's the code: public class SortableJTable extends JTable{ public SortableJTable() { super(); } public SortableJTable(DefaultTableModel dtm) { super(dtm); } @Override public void setValueAt(Object obj, int row, int col) { super.setValueAt(obj, row, col); PRGView.dbc.updateOrdersWithTicketRequestID(this.getColumnName(col).toString(), obj, (Integer)this.getValueAt(row, 0)); } @Override public Class getColumnClass(int c) { switch (c) { case 0: return Integer.class; case 1: return Integer.class; case 2: return String.class; case 3: return String.class; case 4: return Double.class; case 5: return Double.class; default: return String.class; } } } As you can see, I'd like whenever someone edits a cell in the custom JTable (which is when the setValueAt method is called) to be able to immediately modify the database contents to reflect those changes. Here's the database code that is called within that method. public void updateOrdersWithTicketRequestID(String columnName, Object columnValue, Integer ticketRequestID) { try { String sql = "UPDATE ORDERS SET ? = ? WHERE Ticket_Request_ID = ?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, columnName); pstmt.setObject(2, columnValue); pstmt.setInt(3, ticketRequestID); pstmt.executeUpdate(); pstmt.close(); } catch (SQLException e){} } Once my code gets to this statement: pstmt = conn.prepareStatement(sql); in the above code, it returns the error: SQL error or missing database (near "?": syntax error). I have two questions: 1) Why am I getting this error message? (Am I doing the prepared statement incorrectly?) 2) The getColumnClass in my custom JTable class is not sorting my columns correctly. They are always sorted in String order, rather than using the switch cases I have laid out. Am I doing this wrong? Thanks for any help!
has answer: http://stackoverflow.com/a/24102087
has title: Database Update & Sortable JTable Issues
tagged with: sqlite
answer count: 1
tagged with: netbeans-7
score: 0
accepted answer: http://stackoverflow.com/a/24102087
type: AnsweredQuestion
tagged with: swing
type: Question

http://stackoverflow.com/comment/37006580
type: QuestionComment
comment on: http://stackoverflow.com/q/24010505
score: 0
has text: see the expm function in jblas: https://github.com/mikiobraun/jblas/blob/master/src/main/java/org/jblas/MatrixFunctions.java, or use jblas.
type: Comment

http://stackoverflow.com/comment/62750541
score: 0
type: Comment
comment on: http://stackoverflow.com/a/37634078
has text: If you are resetting `counter` every time you do not match, but not `count` I think you are going to get false positives. Also, because you do not backtrack, you are going to miss some matches, when for example the input is: { 1 6 2 1 2 1 2 1 3 5 } { 1 2 1 3 }
type: AnswerComment

infinispan
tags question: http://stackoverflow.com/q/24058913
tags question: http://stackoverflow.com/q/24011607
tags question: http://stackoverflow.com/q/24061561
type: Tag
tags question: http://stackoverflow.com/q/23998507
tag name: infinispan
tags question: http://stackoverflow.com/q/24015260

http://stackoverflow.com/comment/37143673
type: AnswerComment
comment on: http://stackoverflow.com/a/24083829
score: 0
type: Comment
has text: You do not get it as an int but always as a String. But maybe I did not understand the needs. I think he need to add 0 after its value. no?

http://stackoverflow.com/comment/37055972
has text: Show us some of your code, then we can point out what's wrong.
score: 1
comment on: http://stackoverflow.com/q/24037238
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24096348
upvote count: 2
tagged with: scala
has answer: http://stackoverflow.com/a/24096692
tagged with: jco
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24096652
tagged with: java
type: Question
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24097788
possible better answer: http://stackoverflow.com/a/24096652
has title: Can you use the SAP JCo connector with SCALA?
answer count: 3
has answer: http://stackoverflow.com/a/24097788
has body: Goodnight Stackoverflow. I've been using the JCo recently with Java, and I think it's great, but I have been using SCALA more and more recently as more of a hobby and something I find makes programming more pleasing. For those that don't know what the SAP JCo is and want to save yourselves a search: SAP Java Connector (SAP JCo) is a middleware component that enables the development of SAP-compatible components and applications in Java. SAP JCo supports communication with the SAP Server in both directions: inbound calls (Java calls ABAP) and outbound calls (ABAP calls Java). SAP JCo can be implemented with Desktop applications and with Web server applications. Source And I got curious, is it possible to use the SAP JCo connector together with SCALA? I know there isn't a direct way to do so, but does anyone have experience doing so? It'd be a highly attractive solution to me. I prefer programming in SCALA over Java when possible, and my company is not that big so I often undertake entire programs by myself, which means I wouldn't be affecting anyone by using SCALA instead of Java. Does anyone have any experience with this? Cheers!
score: 2

http://stackoverflow.com/a/24005317
has comment: http://stackoverflow.com/comment/36998468
has body: You can't reconnect a socket after a failed connection attempt, as the exceptions would have told you. You have to close it and create a new one.
has comment: http://stackoverflow.com/comment/36997201
has comment: http://stackoverflow.com/comment/36997774
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39687061
upvote count: 1
has comment: http://stackoverflow.com/comment/36999033
answers question: http://stackoverflow.com/q/24005184
downvote count: 0

http://stackoverflow.com/q/24012047
accepted answer: http://stackoverflow.com/a/24012697
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37010596
has body: I had a job interview for probation(? I'm not sure if that's the word) and interviewer asked me to tell him what are the differences between structure and class. So I told him everything I knew and everything that I've read on msdn. And the guy said "not enough", I didn't have a clue. So he said: The struct are optimized, so if there is and integer and float, which have some bites identical, then it will save this space, so struct with int=0 and float=0 is half the size of int=int.MAX, float=float.MIN. Okay. So I was like - didn't hear about that. But then, after the interview I was thinking about it and it doesn't really make sense to me. It would mean, that the struct size differs while we're changing the value of some variable in it. And it can't really be in the same place in memory, what if there is a collision while expanding. And we would have to write somewhere what bits we're skiping, not sure if it would give any optimization. Also, he asked me at the begging what is the difference in struct and class in Java. To which I have answered, that there is no struct in Java and he said "Not for programmers, but Numeric types are structures" I was kind of like WTF. Basically the question is: Did this guy know something, which is very hard to get to know (I mean, I was looking for it on the web, can't find a thing) or maybe he doesn't know anything about his job and tries to look cool at the job interviews.
has comment: http://stackoverflow.com/comment/37009854
type: Question
tagged with: struct
linked to: http://stackoverflow.com/q/13324368
tagged with: c#
has comment: http://stackoverflow.com/comment/37009381
linked to: http://stackoverflow.com/q/3131136
tagged with: optimization
has comment: http://stackoverflow.com/comment/37009588
answer count: 2
has comment: http://stackoverflow.com/comment/37009968
has answer: http://stackoverflow.com/a/24012697
has comment: http://stackoverflow.com/comment/37009209
downvote count: 0
has comment: http://stackoverflow.com/comment/37009289
favorite count: 0
has comment: http://stackoverflow.com/comment/37009673
has title: C# struct memory optimization?
has comment: http://stackoverflow.com/comment/37009477
linked to: http://stackoverflow.com/q/13049
score: 6
possible better answer: http://stackoverflow.com/a/24037634
has comment: http://stackoverflow.com/comment/37009321
tagged with: memory-optimization
upvote count: 6
has answer: http://stackoverflow.com/a/24037634

http://stackoverflow.com/comment/37136883
type: Comment
comment on: http://stackoverflow.com/a/24080810
type: AnswerComment
has text: A map is such a waste, each `T` is stored twice, once as key and once as value. If I store millions of values, that is a considerable waste of space. It is hilarious that there is no space efficient set in `java.util`...
score: 0

http://stackoverflow.com/a/23988858
answers question: http://stackoverflow.com/q/23988802
type: Answer
has body: here is a code sample that explains how to get battery information: To sum it up, a broadcast receiver for the ACTION_BATTERY_CHANGED intent is set up dynamically, because it can not be received through components declared in manifests, only by explicitly registering for it with Context.registerReceiver(). public class Main extends Activity { private TextView batteryTxt; private BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){ @Override public void onReceive(Context ctxt, Intent intent) { int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); batteryTxt.setText(String.valueOf(level) + &quot;%&quot;); } }; @Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main); contentTxt = (TextView) this.findViewById(R.id.batteryTxt); this.registerReceiver(this.mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); } }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36965713
upvote count: 1

http://stackoverflow.com/q/24076476
has comment: http://stackoverflow.com/comment/37129029
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/24076522
has body: im beginner in java and i found an example that input from txt files. public class MyCollection { private String mInputFilePath = null; private String mOutputFilePath = null; private ArrayList&lt;Document&gt; mDocuments = null; private HashMap&lt;String, Integer&gt; mDocumentFrequencies = null; public MyCollection(String inputFile, String outputFile) { mInputFilePath = inputFile; mOutputFilePath = outputFile; mDocuments = new ArrayList&lt;Document&gt;(); mDocumentFrequencies = new HashMap&lt;String, Integer&gt;(); } public void process(){ BufferedReader inputBufferedReader = null; BufferedWriter outputBufferedWriter = null; try { inputBufferedReader = new BufferedReader(new FileReader(new File(mInputFilePath))); outputBufferedWriter = new BufferedWriter(new FileWriter(new File(mOutputFilePath))); } I cant understand this code here: inputBufferedReader = new BufferedReader(new FileReader(new File(mInputFilePath))); outputBufferedWriter = new BufferedWriter(new FileWriter(newFile(mOutputFilePath))); how can i write this to lines more analytical?
downvote count: 1
has comment: http://stackoverflow.com/comment/37128906
type: Question
score: -1
tagged with: class
has comment: http://stackoverflow.com/comment/37129021
has title: Program uses files
answer count: 2
has answer: http://stackoverflow.com/a/24076554
upvote count: 0
has comment: http://stackoverflow.com/comment/37128905
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37167547
type: Comment
score: 0
type: QuestionComment
has text: the items of ListView-1 is stored in an ArrayList, but that's coming from a RSS feed. Database-SQL is not used in my app yet.
comment on: http://stackoverflow.com/q/24096836

utf-8
tags question: http://stackoverflow.com/q/24056851
tags question: http://stackoverflow.com/q/24001207
tags question: http://stackoverflow.com/q/24038998
tags question: http://stackoverflow.com/q/24009119
tags question: http://stackoverflow.com/q/24021857
tags question: http://stackoverflow.com/q/23984340
tags question: http://stackoverflow.com/q/24095626
tags question: http://stackoverflow.com/q/23949293
tag name: utf-8
type: Tag
tags question: http://stackoverflow.com/q/23952726
tags question: http://stackoverflow.com/q/24094101

http://stackoverflow.com/q/23992509
has comment: http://stackoverflow.com/comment/36972324
tagged with: directory-structure
type: Question
has answer: http://stackoverflow.com/a/24117127
accepted answer: http://stackoverflow.com/a/24117127
answer count: 2
tagged with: unzip
linked to: http://stackoverflow.com/q/1844688
has answer: http://stackoverflow.com/a/45964189
favorite count: 0
upvote count: 3
has body: I had planned to use ZipEntry's isDirectory() method to identify whether a zip file contained a directory when validating the file structure of the zip file. The zip files should have the following file structure: - content/file1.pdf - afile.xml - anotherfile.xml Every zip file must have a folder which must contain some content. I would like to have been able to rely on isDirectory() to check if there is a directory, for example: //this is part of a unit test which checks the structure of zipped file. public List&lt;String&gt; unzip(String outpath) { List&lt;String&gt; fnames = new ArrayList&lt;String&gt;(); try { FileInputStream fin = new FileInputStream(outpath); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; boolean contentFound = false; while ((ze = zin.getNextEntry()) != null) { if(ze.isDirectory()) { contentFound = true; } else { fnames.add(ze.getName()); zin.closeEntry(); } } zin.close(); assertTrue("Content folder not found", contentFound); } catch(Exception e) { } return fnames; } When isDirectory() was never true despite providing a zip file which contained the content directory, I used the following to see what was being picked up: public List&lt;String&gt; unzip(String outpath) { List&lt;String&gt; fnames = new ArrayList&lt;String&gt;(); try { FileInputStream fin = new FileInputStream(outpath); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; boolean contentFound = false; while ((ze = zin.getNextEntry()) != null) { System.out.println(ze.getName()); fnames.add(ze.getName()); zin.closeEntry(); } zin.close(); assertTrue("Content folder not found", contentFound); } catch(Exception e) { } return fnames; } Output for this is: content/file2.pdf content/file1.pdf anotherfile.xml file.xml I think isDirectory() is never evaluating to be true because the path "content/file2.pdf" is pointing to a file which is contained in the directory and not to the directory itself. I'm not sure what I have to do to identify the directory on it…
has comment: http://stackoverflow.com/comment/36972299
has title: Discovering whether a ZipEntry is a Directory or Not using isDirectory()
possible better answer: http://stackoverflow.com/a/45964189
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/37067214
comment on: http://stackoverflow.com/q/24042963
type: Comment
has text: this just create's the txt file with the name equal to the number of where the for loop is at that point. also it automaticly checks wether this succeeded or not
score: 0
type: QuestionComment

http://stackoverflow.com/q/23953358
type: Question
possible better answer: http://stackoverflow.com/a/23953415
has answer: http://stackoverflow.com/a/23953415
tagged with: pointers
tagged with: inheritance
has comment: http://stackoverflow.com/comment/36899180
tagged with: nullpointerexception
upvote count: 1
answer count: 4
linked to: http://stackoverflow.com/q/218384
favorite count: 0
has answer: http://stackoverflow.com/a/23953418
downvote count: 0
has title: Exception NullPointer, suggestions?
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/23953424
has body: I am following the ebook Big Java Late Objects - and I have problem resolving on of the tasks. It is about inheritance. There is Question class and one sub ChoiceQuestion class that extends it. But when I run the code in my testclass it calls the null exception and I don't know why. Exception in thread "main" java.lang.NullPointerException at ChoiceQuestion.addChoice(ChoiceQuestion.java:12) at TestClass.main(TestClass.java:21) 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:120) Here are my classes: public class Question { private String text; private String answer; /** * Constructs a queston with empty question and answer. */ public Question(){ text = ""; answer = ""; } //=============Setter methods============ public void setText(String questionText){ text = questionText; } public void setAnswer(String correctResponse){ answer = correctResponse; } //==============Getter Methods============= public boolean checkAnswer(String response){ return answer.equals(response); } public void display(){ System.out.println(text); } } And here is my subclass: class ChoiceQuestion extends Question { private ArrayList&lt;String&gt; choices; //=========Methods============== public void addChoice(String choice,boolean correct){ choices.add(choice); if(correct){ //convert choices.size() to string String choiceString = "" + choices.size(); this.setAnswer(choiceString); } } public void display(){ // Display the question text super.display(); // Display the answer choices for(int i=0;i&lt;choices.size();i++){ int choiceNumber = i + 1; System.out.println(choiceNumber + ": " + choices.get(i)); } } } And my test Class: import java.util.Scanner; public class TestClass { public static void pre…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23953408
accepted answer: http://stackoverflow.com/a/23953408
score: 1
has comment: http://stackoverflow.com/comment/36899319
tagged with: java

http://stackoverflow.com/comment/37133131
type: Comment
comment on: http://stackoverflow.com/q/24044760
type: QuestionComment
has text: As the [wiki](https://github.com/libgdx/libgdx/wiki/Viewports) says, `FitViewport` will generate black bars if the dimensions don't match. Why do you say `StretchViewport` doesn't look good? A screenshot would help.
score: 0

http://stackoverflow.com/comment/36986239
has text: This doesn't even come close to compiling. Also, try and format your code...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23999575

http://stackoverflow.com/comment/37109493
type: QuestionComment
type: Comment
has text: Have you tried changing Window-Preferences-Java-Compiler-Compatibility level?
comment on: http://stackoverflow.com/q/24064260
score: 0

emulation
tags question: http://stackoverflow.com/q/23955636
tags question: http://stackoverflow.com/q/24065642
tag name: emulation
type: Tag

http://stackoverflow.com/comment/37084507
comment on: http://stackoverflow.com/q/24052258
has text: no not in webview, i have daynightoverlay.js file using that i need to create a image of daynightoverlay
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36993638
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24003199
has text: I can show the code in couple of hours.. I have it on my work machine. I can add a snippet early tomorrow. Sorry and thanks for your interest.

http://stackoverflow.com/comment/37182339
score: 1
comment on: http://stackoverflow.com/a/24104254
type: AnswerComment
type: Comment
has text: The sample problem occurs in the first loop. It's really equivalent to `for (int i = 0; i < ((String[])k.t).length); i++)`.

http://stackoverflow.com/a/24057038
type: Answer
answers question: http://stackoverflow.com/q/24056453
has body: Here is a complete solution. I did not try it, but it should work. NB: Be carefull about input limits: I am not sure it will work if the date is 01/01/2015 for example. I let you test this. private boolean checkSameDate(Calendar cal1, Calendar cal2) { if ((cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)) &amp;&amp; (cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR))) { return true; } return false; } private void checkDate(Date date) { Calendar cal = new GregorianCalendar(); cal.setTime(new Date()); Calendar cal2 = new GregorianCalendar(); cal2.setTime(date); cal.add(Calendar.DAY_OF_YEAR, 1); if (checkSameDate(cal, cal2)) { // Your input date is tomorrow. } else { cal.add(Calendar.DAY_OF_YEAR, -2); if (checkSameDate(cal, cal2)) { // Your input date is yesterday. } else { DateFormat sdf = new SimpleDateFormat("dd MMMM - HH:mm"); System.out.println(sdf.format(date)); } } } Edit Sorry, I think it will not work for a date in 31/12/YYYY-1 when today is 01/01/YYYY. Maybe you can fix this code with this kind of solution: Check if one date is exactly 24 hours or more after another For SimpleDateFormat, I let you check here https://ideone.com/dsxKN9 if this is the format you need. Edit 2 I just see that you want today and not tomorrow :). My bad! I'll try fix this, but if you understand the logical, you'll be able to do it.
score: 0

http://stackoverflow.com/q/24094036
type: Question
score: 3
tagged with: hadoop
has title: Pig Server log4j:ERROR Could not instantiate class [org.apache.hadoop.log.metrics.EventCounter]
answer count: 1
downvote count: 0
favorite count: 0
has body: I work with Pig embeded in Java. I want to instantiate PigServer to execute a Pig sentence. My first sentence is: PigServer pigServer = new PigSever("local") When I execute this code I got the following error: log4j:ERROR Could not instantiate class [org.apache.hadoop.log.metrics.EventCounter]. java.lang.ClassNotFoundException: org.apache.hadoop.log.metrics.EventCounter 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 java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198) at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:326) at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:752) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483) at org.apache.log4j.LogManager.&lt;clinit&gt;(LogManager.java:127) at org.apache.log4j.Logger.getLogger(Logger.java:104) at org.apache.commons.logging.impl.Log4JLogger.&lt;init&gt;(Log4JLogger.java:102) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccesso…
upvote count: 3
tagged with: apache-pig
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/35712129

http://stackoverflow.com/comment/37023019
comment on: http://stackoverflow.com/a/24019093
score: 0
type: Comment
has text: How is that a solution? Let me rephrase that question: what kind of business requirement were you trying to solve for which this is a valid maintainable solution? You might as well create your own version of InetAddress which hardcoded returns google.com when you feed it that IP.
type: AnswerComment

http://stackoverflow.com/comment/36878090
score: 0
comment on: http://stackoverflow.com/q/23941860
type: Comment
type: QuestionComment
has text: Would that work? http://stackoverflow.com/a/5207170/1362049

http://stackoverflow.com/a/23992800
upvote count: 1
has comment: http://stackoverflow.com/comment/36973162
has comment: http://stackoverflow.com/comment/36982906
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36973945
accepted answer of: http://stackoverflow.com/q/23992691
type: Answer
answers question: http://stackoverflow.com/q/23992691
has body: Calling .toList() on menu_list should do the job. MainFragment.menu_list.toList edit: In case you need to convert scala Map to java.util.Map also, this snippet should work: menu_list.map(_.asInstanceOf[java.util.Map[String, Any]]) val javaMenuList: java.util.List[java.util.Map[String, Any]] = menu_list.map { map =&gt; val javaMap: java.util.Map[String, Any] = map javaMap }
has comment: http://stackoverflow.com/comment/36973615

http://stackoverflow.com/comment/37123747
type: AnswerComment
has text: Would there be any issue if lets say one of the "non relevant" key words in the string contain -l? I can't think of an example right now, but perhaps some vehicle model like lexus-l300-v1234-l12205? I'm just trying to be sure I don't encounter a rare case.
type: Comment
comment on: http://stackoverflow.com/a/24073507
score: 0

http://stackoverflow.com/comment/36888949
has text: oh thank you very much it skips the header... and please suggest how do i skip the first column ? with companycodes ??
type: Comment
comment on: http://stackoverflow.com/a/23947010
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37254813
has text: Ok, next challenge, still same approach :) - I updated my answer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24083525
type: Comment

http://stackoverflow.com/comment/37101532
has text: `System.IO` has many IO functions. I cant say how similar they are to java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24061650
score: 0

http://stackoverflow.com/comment/37138320
score: 0
type: Comment
has text: or i can also add in the annotation i think rollbackFor =
comment on: http://stackoverflow.com/a/24069545
type: AnswerComment

http://stackoverflow.com/comment/38511518
type: Comment
comment on: http://stackoverflow.com/a/24014920
score: 3
has text: One possible downsides is the loss of configuration. Say you have a class that mocks some functionality in development, then you want to swap it out for another class in the UAT environment. Using XML, then its just a matter of changing the config and allowing the application to run/restart. With these new class configurations, the classes would have to be recompiled.
type: AnswerComment

http://stackoverflow.com/a/23957203
answers question: http://stackoverflow.com/q/23956824
has body: Use the following code: Query query = session.createQuery("from Admin where loginAdmin= :login and password = :passwordAdmin"); query.setParameter("login", login); query.setParameter("password", password ); Admin admin = (Admin)query.uniqueResult(); Creating the HQL query (or any other type of DB query that is) by concatenating Strings is a bad idea since that way you are opening up your system to SQL injections!
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23956824

http://stackoverflow.com/comment/37003458
score: 0
type: QuestionComment
has text: You've tried to use Comparator?
type: Comment
comment on: http://stackoverflow.com/q/24008589

http://stackoverflow.com/q/24103660
has answer: http://stackoverflow.com/a/24103739
has comment: http://stackoverflow.com/comment/37181231
type: UnansweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37181267
has comment: http://stackoverflow.com/comment/37181370
tagged with: java
has comment: http://stackoverflow.com/comment/38671639
has comment: http://stackoverflow.com/comment/37181317
tagged with: comparison
has comment: http://stackoverflow.com/comment/37181236
has comment: http://stackoverflow.com/comment/37181301
linked to: http://stackoverflow.com/q/327544
answer count: 1
score: -7
has body: I get that this is a dumb question but I couldn't figure this out on google so this is my last resort. Why is it that when I try to compare two doubles that are variables that I know are equal, it returns false? Here's an example that I hope is more clear: double x = 323.23 double y = 323.23 System.out.println(x==y) Output: false Why does this happen? Also, why does it print true if you just compare two doubles that are not variables or a double that is a variable and a double that is not? example: double x = 323.23 System.out.println(x==323.23) System.out.println(323.23==323.23) output: true true
favorite count: 0
duplicate of: http://stackoverflow.com/q/327544
downvote count: 8
tagged with: double
has comment: http://stackoverflow.com/comment/37183652
has title: Why doesn't it work when I try to compare doubles in java?

http://stackoverflow.com/comment/37465496
score: 1
type: AnswerComment
has text: I got excited when I saw this post as it seemed a likely issue and an easy oversight. However I'm using the cucumber.api.java.Before annotation. I can't find cucumber.annotation.Before, I presume it was removed in later releases.
comment on: http://stackoverflow.com/a/24234403
type: Comment

http://stackoverflow.com/q/23952011
upvote count: 15
tagged with: enterprise-architect
tagged with: orm
has answer: http://stackoverflow.com/a/23955294
type: Question
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41553447
tagged with: java
tagged with: hibernate
tagged with: mysql
possible better answer: http://stackoverflow.com/a/23954627
has comment: http://stackoverflow.com/comment/36898047
has answer: http://stackoverflow.com/a/23954627
has title: ORM modeling: Database first vs classes first
has comment: http://stackoverflow.com/comment/36898095
accepted answer: http://stackoverflow.com/a/51132362
has answer: http://stackoverflow.com/a/23954888
has comment: http://stackoverflow.com/comment/36897618
downvote count: 1
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/51132362
has body: I'm attempting to use Sparx Enterprise Architect to design a data model that will end up in a MySQL database. My first approach was a Data Model diagram, which can be used to generate DDL (or the other way round by reverse engineering). This works quite well but a colleague pointed out a snag: We're intending to use an ORM (almost certainly Hibernate) to map tables to Java classes. His comment was a "database first" approach would preclude the use of good OO techniques such as inheritance. This seems a good point but I'm wondering if there are any limitations. If I started from scratch with a Class Diagram instead of a Data Model diagram, would there be a way of including all necessary Hibernate annotations, config etc. in this model? And if I later needed to model database-specific functionality such as constraints, triggers etc. would all this be possible in the model given that a Class Diagram isn't really aimed at this type of thing?
has comment: http://stackoverflow.com/comment/36898166

http://stackoverflow.com/q/24081179
has comment: http://stackoverflow.com/comment/37173686
favorite count: 0
has comment: http://stackoverflow.com/comment/37172979
tagged with: android
has comment: http://stackoverflow.com/comment/37163507
linked to: http://stackoverflow.com/q/24112943
has comment: http://stackoverflow.com/comment/37155677
tagged with: node.js
upvote count: 3
has answer: http://stackoverflow.com/a/25052524
type: UnansweredQuestion
tagged with: java
downvote count: 1
tagged with: socket.io
type: Question
has comment: http://stackoverflow.com/comment/37163575
has body: I am trying to communicate simple node js (socket.io) server with my android app I am using Gottox socket.io-java-client lib converted to jar file as client but it always returning the error (error while handshaking file not found) I am testing the app on my mobile device on local network using wifi my ip is 192.168.1.69 I have tested the server communication over web it is working fine Code of node js socket server var mongo = require('mongodb').MongoClient, Client = require('socket.io').listen(8080).sockets; mongo.connect('mongodb://192.168.1.69/chat',function(err, db){ if(err) throw err; Client.on('connection',function(socket){ //get mongo db collection console.log("Connected to server"); var col = db.collection("messages"), sendStatus = function(s){ socket.emit('status',s); }; //emit all messages col.find().limit(100).sort({_id:1}).toArray(function(err, res){ if(err) throw err; socket.emit("output",res); }); //wait for input socket.on('input',function(data){ console.log("data-------&gt; name: "+data.name+" message: "+data.message); //insert into mongodb server //json data from client var name = data.name, message = data.message, whitespacePattern = /^\s*$/; if(whitespacePattern.test(name) || whitespacePattern.test(message)){ sendStatus("Name and Message is required."); console.log("invalid data"); }else{ col.insert({name: name,message:message},function(){ //emit latest to all clients Client.emit('output',[data]); sendStatus({ message:"message sent", clear:true }); }); } //on input }); //on connection }); //mongo db connect }); Code of android client package com.example.socketio; import java.net.MalformedURLException; import org.json.JSONObject; import io.socket.IOAcknowledge; import io.socket.IOCallback; import io.socket.SocketIO; import io.socket.SocketIOException; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class M…
has answer: http://stackoverflow.com/a/24136827
has comment: http://stackoverflow.com/comment/37162752
answer count: 2
has title: Gottox socket.io-java-client “Error while handshaking Caused by: java.io.FileNotFoundException: http://192.168.1.69:8080/socket.io/1/
score: 2
has comment: http://stackoverflow.com/comment/37180343

http://stackoverflow.com/comment/37149960
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24087573
has text: I'm implementing a semaphore using a `ReentrantLock` and a `Condition`. It's for an assignment.

http://stackoverflow.com/q/24087573
favorite count: 0
has body: I'm not sure whether the following implementation is correct. My reason is that if the current thread is interrupted while it is waiting to be signaled, the finally block will be called, but because it's not holding the lock, an IllegalMonitorStateException will be thrown. Did I implement a try-finally block correctly in this case or rather should one be implemented? public void acquire() throws InterruptedException { try { lock.lockInterruptibly(); while (permits == 0) { condition.await(); } permits--; } finally { lock.unlock(); } }
duplicate of: http://stackoverflow.com/q/6950078
has comment: http://stackoverflow.com/comment/37150035
type: Question
tagged with: semaphore
has comment: http://stackoverflow.com/comment/37149927
tagged with: java
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24088419
has answer: http://stackoverflow.com/a/24087677
has comment: http://stackoverflow.com/comment/37149960
has comment: http://stackoverflow.com/comment/37162514
type: UnansweredQuestion
tagged with: concurrency
has comment: http://stackoverflow.com/comment/37150212
has answer: http://stackoverflow.com/a/24088217
has title: Correct implementation of lock for semaphore?
linked to: http://stackoverflow.com/q/6950078
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37149953
has comment: http://stackoverflow.com/comment/37151631

http://stackoverflow.com/q/24017126
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24017325
favorite count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/24022057
tagged with: input
score: -2
possible better answer: http://stackoverflow.com/a/24017508
has comment: http://stackoverflow.com/comment/37018548
has comment: http://stackoverflow.com/comment/37018547
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/24017325
has answer: http://stackoverflow.com/a/24017508
tagged with: loops
has title: New Java developer - Simple Q
upvote count: 0
has comment: http://stackoverflow.com/comment/37020725
has body: I have just recently started coding and am quite the beginner. I'm trying to make a program that simply asks the user to enter a "password", and depending on whether the password is correct; increment a counter. And, once the counter reaches 10, print out a message. Basically what I'm trying to make is like a "clip-card", like one of those you can get at a coffee shop (you get every 10th coffee free). So, this is what I have now. I just need to know how to make the program continue after inputting a password, and keep track of the inputs. Ohhh and... If this is unclear, please say so and I will try to clarify. This is what I have to far... import java.util.Scanner; public class Coffee { public static void main(String [] args){ int count = 0; String pass = "hey"; System.out.println("Enter password: "); Scanner key = new Scanner(System.in); String moves = key.nextLine(); if(moves.compareTo(pass) == 0){ count++; System.out.println("You're one step closer to a free coffe! You have so far bought " + count + " coffe(s)"); } if(count % 10 == 0 &amp;&amp; count != 0){ System.out.println("You've got a free coffe!"); } if(moves.compareTo(pass) != 0){ System.out.println("Wrong password! Try again.\n"); } } }
type: Question

http://stackoverflow.com/comment/37084875
type: QuestionComment
type: Comment
has text: What's your question?
comment on: http://stackoverflow.com/q/24052595
score: 0

http://stackoverflow.com/q/23963159
has comment: http://stackoverflow.com/comment/36918340
has answer: http://stackoverflow.com/a/23963366
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23963366
has body: I was reading a tutorial for using I/O streams in java and stumbled upon the following code for inputstream: InputStream input = new FileInputStream("c:\\data\\input-file.txt"); int data = input.read(); while(data != -1){ data = input.read(); } The tutorial mentions that InputStream returns only one byte at a time. So if I want to receive more bytes at a time, is that possible using a different method call?
has comment: http://stackoverflow.com/comment/36918249
has comment: http://stackoverflow.com/comment/36918277
has answer: http://stackoverflow.com/a/23963414
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23963466
tagged with: java
has title: Java InputStream
type: Question
accepted answer: http://stackoverflow.com/a/23963414
tagged with: inputstream

http://stackoverflow.com/q/23963218
type: Question
has body: I see this error in the error list but can't seem to find a fix for it. Everything I try doesn't seem to make a difference. if (this.mouseX &gt;= 522 + paddingX + (clientSize &gt;= 1 ? 3 - (this.longTabs ? 240 : 0) : 0)) { if (this.mouseX &lt;= 762 + paddingX + (clientSize &gt;= 1 ? 3 - (this.longTabs ? 240 : 0) : 0)) { if (this.mouseY &gt;= '©' + (clientSize &gt;= 1 ? 261 + (this.longTabs ? 37 : 0) : 0) + paddingY) { if (this.mouseY &lt; '�' + (clientSize &gt;= 1 ? 261 + (this.longTabs ? 37 : 0) : 0) + paddingY) { break label244; } //Where the error is } } } } But the label244 is set here: { int i; label244: i = 0; for (int x = 0; i &lt; 8; x += 30) { Could I be told how to fix these with some examples please? I have 17 of these errors remaining.
duplicate of: http://stackoverflow.com/q/8802287
tagged with: eclipse
linked to: http://stackoverflow.com/q/8802287
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36918878
has title: Java "The label Label244 is missing" error
has comment: http://stackoverflow.com/comment/36950728
favorite count: 0
has comment: http://stackoverflow.com/comment/36950980
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36919517
has answer: http://stackoverflow.com/a/23963309

http://stackoverflow.com/comment/37059815
has text: Try this: driver.findElement(By.xpath("//*[@id='valid element id']//input[text()='AmaWaterways']")).click();
comment on: http://stackoverflow.com/q/24031417
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24104366
has comment: http://stackoverflow.com/comment/37182938
has comment: http://stackoverflow.com/comment/37182704
has body: you can Create a new instance of array using the reflection to avoid ClassCastException example: import java.lang.reflect.Array; public class MyCollection&lt;T&gt; { T[] t; MyCollection(Class&lt;T&gt; clazz, int size) { t = (T[]) Array.newInstance(clazz, size); } boolean addElement(T e, int i) { if (i &lt; t.length - 1) { t[i] = e; return true; } return false; } public static void main(String[] ss) { MyCollection&lt;String&gt; k = new MyCollection&lt;String&gt;(String.class, 3); k.addElement("a", 0); k.addElement("b", 1); k.addElement("c", 2); for (int i = 0; i &lt; k.t.length; i++) System.out.println(k.t[0]); } }
score: 0
answers question: http://stackoverflow.com/q/24104207
type: Answer
has comment: http://stackoverflow.com/comment/37182815

http://stackoverflow.com/a/25929662
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24074068
has body: You are trying to post a form with the credentials - that is not what you want. For a standard basic authentication (same as done with curl -u username:password) you should webResource.addFilter(new HTTPBasicAuthFilter(username, password));

http://stackoverflow.com/q/24056275
has comment: http://stackoverflow.com/comment/37091843
has answer: http://stackoverflow.com/a/24056465
type: Question
has body: I want to convert my ArrayList&lt;object&gt; to a JSON String and back to ArrayList&lt;object&gt; But I really don't know how to do that : Something like : Convert ArrayList&lt;data&gt; arrayData = new ArrayList&lt;data&gt;(); JSONObject retObject = new JSONObject(); retObject.put("data", new JSONArray(arrayData )); Return convert idk...
has comment: http://stackoverflow.com/comment/37092885
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/24056463
has title: How to convert ArrayList to String and vice versa
answer count: 3
has comment: http://stackoverflow.com/comment/37092717
linked to: http://stackoverflow.com/q/17037340
has answer: http://stackoverflow.com/a/24056549
has comment: http://stackoverflow.com/comment/37093098
accepted answer: http://stackoverflow.com/a/24056465
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24056463
has comment: http://stackoverflow.com/comment/37092007
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/23967022
downvote count: 1
has body: I'm developing a game in Java and I'm using the MVC Design Pattern and swing for the GUI. Model, view and controller communicate between them with observer/observable design pattern. Now in the controller and in the view I must throw exception when a player wants to do an illegal action in the game. For example, if the player wants to buy anything in the game but he has 0 coins, in the view will throw an exception. There is a way to show a JDialog when an exception is throw to show to the player that he can't do that action? Can the view catch the exception of the controller and of the view?
tagged with: model-view-controller
tagged with: java
type: Question
answer count: 2
has title: MVC, Swing and exception in Java
has answer: http://stackoverflow.com/a/24507142
has comment: http://stackoverflow.com/comment/36930026
score: 0
has comment: http://stackoverflow.com/comment/36925525
tagged with: exception
has comment: http://stackoverflow.com/comment/36931888
favorite count: 0
has answer: http://stackoverflow.com/a/24506578
has comment: http://stackoverflow.com/comment/36925468
type: UnansweredQuestion
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/24006836
type: Question
tagged with: processing
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24006919
score: 1
tagged with: java
has body: I am experimenting with creating my own particle effect (simple) when the mouse is clicked on the screen. I dont think the language is relevant (but I'm still learning) Is my logic as follows correct: Each time I click, the particles get added to an ArrayList to be iterated through to increment size, color and opacity Now this would still work if I had multiple clicks on the screen because each set of particles would simple be added to the ArrayList... however, this does not seem efficient because when the first particle blast has ended, it is no longer needed in the ArrayList and should not take up memory Could someone help me with the logic? And would animating a PNG series be more efficient than dynamically creating your own particle effect? Thanks PS - I'm not creating a game/application...just experimenting with concepts I'm learning
accepted answer: http://stackoverflow.com/a/24006908
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24006908
has answer: http://stackoverflow.com/a/24006919
upvote count: 1
has title: Understanding ArrayList in conjunction with Objects

http://stackoverflow.com/comment/36911100
comment on: http://stackoverflow.com/q/23959505
score: 3
type: Comment
type: QuestionComment
has text: Debug it. See what's in the input that is mismatching

http://stackoverflow.com/q/24029763
tagged with: gwt2
tagged with: gwt
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am using GWT MVP and I would like to handle events in columns of DataGrid from Presenter. From GWT DataGrid ShowCase ... // First name. Column&lt;ContactInfo, String&gt; firstNameColumn = new Column&lt;ContactInfo, String&gt;(new EditTextCell()) { @Override public String getValue(ContactInfo object) { return object.getFirstName(); } }; firstNameColumn.setSortable(true); sortHandler.setComparator(firstNameColumn, new Comparator&lt;ContactInfo&gt;() { @Override public int compare(ContactInfo o1, ContactInfo o2) { return o1.getFirstName().compareTo(o2.getFirstName()); } }); dataGrid.addColumn(firstNameColumn, constants.cwDataGridColumnFirstName()); firstNameColumn.setFieldUpdater(new FieldUpdater&lt;ContactInfo, String&gt;() { @Override public void update(int index, ContactInfo object, String value) { // Here I would like to call RPC methods } }); dataGrid.setColumnWidth(firstNameColumn, 20, Unit.PCT); Above example , this code is writing in View side and it just really example. As mvp pattern , I just need to call rpc request to update database. This can't be done in View side but I have no idea how to set FieldUpdater from my presenter. Please help me how can I figure it out ? Thanks greatly .
type: Question
tagged with: gwt-rpc
upvote count: 1
has answer: http://stackoverflow.com/a/24032286
accepted answer: http://stackoverflow.com/a/24032286
answer count: 1
favorite count: 0
tagged with: gwt-mvp
has title: How to handle Datagrid column's events from Presenter?

http://stackoverflow.com/q/24063357
has comment: http://stackoverflow.com/comment/37127313
has answer: http://stackoverflow.com/a/24063948
score: 0
has answer: http://stackoverflow.com/a/24063728
has answer: http://stackoverflow.com/a/24081049
has body: Ok so i have two classes: Content and TrackUserChanges . They have the same fields. public class Content{ private Long id; ...... private SortedSet&lt;Content&gt; children = new TreeSet&lt;Content&gt;(); } public class TrackUserChanges{ private Long id; ..... private SortedSet&lt;Content&gt; children = new TreeSet&lt;Content&gt;(); } I want to clone the data from Content to TrackUserChanges: I have the children from an instance of content: SortedSet&lt;Content&gt; children = content.getChildren(); This can contain many other contents, and that contents can have also children, etc. SortedSet&lt;TrackUserChanges&gt; children1 = convertContentSetToTrackUserChangesSet(children); This is the method: public SortedSet&lt;TrackUserChanges&gt; convertContentSetToTrackUserChangesSet(SortedSet&lt;Content&gt; children){ SortedSet&lt;TrackUserChanges&gt; children1 = new TreeSet&lt;TrackUserChanges&gt;(); for(Content c : children){ TrackUserChanges trackU = new TrackUserChanges(); trackU.setCategory(c.getCategory()); trackU.setId(c.getId()); trackU.setBook(c.getBook()); trackU.setInsertUser(c.getInsertUser()); trackU.setParent(c.getParent()); trackU.setParentId(c.getParentId()); trackU.setRelativeSortOrder(c.getRelativeSortOrder()); trackU.setText(c.getText()); trackU.setType(c.getType()); children1.add(trackU); } return children1; } I need somehow to call recusively or something like that... and I can't do trackU.setChildren(c.getChildren()) because the types don't match :/ @Mifmif try { FileOutputStream fout = new FileOutputStream("a.dat"); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(content); oos.close(); } catch (Exception e) { e.printStackTrace(); } TrackUserChanges trackUserChanges11 = new TrackUserChanges(); try { FileInputStream fin = new FileInputStream("a.dat"); MyCustomObjectInputStream custom = new MyCustomObjectInputStream(fin); // custom.readClassDescriptor(); trackUserChanges11 = (TrackUserChanges) custom.readObject(); System.out.println(…
answer count: 4
has comment: http://stackoverflow.com/comment/37105785
type: UnansweredQuestion
tagged with: set
has comment: http://stackoverflow.com/comment/37105490
has comment: http://stackoverflow.com/comment/37104943
type: Question
has comment: http://stackoverflow.com/comment/37104865
tagged with: java
has comment: http://stackoverflow.com/comment/37185866
has comment: http://stackoverflow.com/comment/37104909
has title: Cloning data between two objects with a field sorted set Java
has answer: http://stackoverflow.com/a/24063613

http://stackoverflow.com/q/23948257
type: Question
has comment: http://stackoverflow.com/comment/36890574
tagged with: java
has comment: http://stackoverflow.com/comment/36890380
linked to: http://stackoverflow.com/q/6175139
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/36890232
has body: The jtable I'm using fetches results from database. currently I have added scrollbars(vertical and horizontal). Just wanted to know that is it possible to display the results pagewise-say show 10 results per page. Is it possible ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36890324
has title: display results in jtable pagewise i.e. not using scroll bar to navigate
duplicate of: http://stackoverflow.com/q/6175139
answer count: 0
tagged with: swing

http://stackoverflow.com/a/24036246
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24036096
has body: I dont know your exact requirements, but I would probably use just the "users" collection, and embed interests the way you have. If you want a list of all the different interests, you can try: db.users.distinct("interests");
answers question: http://stackoverflow.com/q/24036096
has comment: http://stackoverflow.com/comment/37055638
score: 0
has comment: http://stackoverflow.com/comment/37054237

http://stackoverflow.com/comment/37064893
type: Comment
has text: Oh, I'm terribly sorry, I didn't know the difference between implicit and explicit cast. I retract! :-) !
comment on: http://stackoverflow.com/a/24041769
type: AnswerComment
score: 0

http://stackoverflow.com/q/23946995
has comment: http://stackoverflow.com/comment/36888173
has body: bSo, I have 3 integer arrays and they are, colorRed[]; colorGreen[]; colorBlue[]; What I am trying to accomplish is to make it so the block that I am making which is twelve by twelve in squares. Each square has its own color. I have a ton of it done and all of it works but a new feature I am trying to add which is an option to import the array of color that you want for all 3 color arrays. I need to enter the array as an string and I have converted it to an integer. The problem is, I can't get it to work! The squares always end up black instead of the color. Here is the code. public void importing() { String Red = JOptionPane.showInputDialog("What is the red? "); String Green = JOptionPane.showInputDialog("What is the green? "); String Blue = JOptionPane.showInputDialog("What is the blue? "); String[] redred = Red.replaceAll("\\{", "").replaceAll("\\}", "").split(","); String[] greengreen = Green.replaceAll("\\{", "").replaceAll("\\}", "").split(","); String[] blueblue = Blue.replaceAll("\\{", "").replaceAll("\\}", "").split(","); int[] red1 = new int[redred.length]; int[] green1 = new int [greengreen.length]; int[] blue1 = new int [blueblue.length]; for(int i = 0; i &lt; redred.length; i++) { try{ red1[i] = Integer.parseInt(redred[i]); } catch (NumberFormatException nfe) {}; } for(int k = 0; k &lt; greengreen.length; k++) { try{ green1[k] = Integer.parseInt(greengreen[k]); } catch (NumberFormatException nfe) {}; } for(int l = 0; l &lt; blueblue.length; l++) { try{ blue1[l] = Integer.parseInt(blueblue[l]); } catch (NumberFormatException nfe) {}; } for(int m = 0; m &lt; 144; m++) { colorRed[m] = red1[m]; colorGreen[m] = green1[m]; colorBlue[m] = blue1[m]; } } Sorry I put the wrong variable on the colored[m] = redred[m] and all of the others. Also, the top left square actually changes the color to the correct color.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36887913
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23947973
tagged with: arrays
has comment: http://stackoverflow.com/comment/36916043
has comment: http://stackoverflow.com/comment/36889214
has title: Trying to import arrays of color?
score: 0
answer count: 1

http://stackoverflow.com/a/23953811
has body: Reflexion is an answer, but you need to get all the classes from the classpath, and examinate it to find the implementation of your interface. You can use this reflection library and get all the implementations like this (if your interface name is MyInterface): Reflections reflections = new Reflections("your.base.package", new SubTypesScanner(), new TypeAnnotationsScanner()); Set&lt;Class&lt;T extends MyInterface&gt;&gt; classes = reflections.getSubTypesOf(MyInterface.class); for (Class&lt;T extends MyInterface&gt; c : classes) { check if c is the rigth implementation!. } If you don't want to use a external library, you can use the Java Reflection API, and scan all packages, somethis like (see this answers to use instrumentation): Instrumentation inst = InstrumentHook.getInstrumentation(); for (Class&lt;?&gt; c: inst.getAllLoadedClasses()) { if (MyInterface.class.isAssignableFrom(c)) { check if c is the rigth implementation!. } } The first option allow you to save the Reflections object as a xml, so the component scan is saved and it's done only one time. To check if the clazz have a Qualifier you can use: if (c.isAnnotationPresent(Qualifier.class)) { bingo!. } or is a property of the annotation: if (c.isAnnotationPresent(Qualifier.class)) { Qualifier q = c.getAnnotation(Qualifier.class); if (q.theRight()) { bingo! } } I recommend you to see if the FactoryProblem is applycable to your problem, choose always Factory instead of Reflection. An example "proxy": public class MyProxy implements GenericI { Map&lt;Category, GenericI&gt; generics; public MyProxy() { Reflections reflections = new Reflections("your.base.package", new SubTypesScanner(), new TypeAnnotationsScanner()); Set&lt;Class&lt;T extends MyInterface&gt;&gt; classes = reflections.getSubTypesOf(MyInterface.class); generics = new HashMap&lt;Category, GenericI&gt;(); for (Class&lt;T extends MyInterface&gt; c : classes) { map.put(c.getAnnotation(MyAnnotation.class).value(), c.newInstance()); } } void method1(CA…
accepted answer of: http://stackoverflow.com/q/23953481
score: 1
has comment: http://stackoverflow.com/comment/36904276
has comment: http://stackoverflow.com/comment/36900068
has comment: http://stackoverflow.com/comment/36907243
has comment: http://stackoverflow.com/comment/36902359
has comment: http://stackoverflow.com/comment/36904161
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36912247
downvote count: 0
has comment: http://stackoverflow.com/comment/36904225
answers question: http://stackoverflow.com/q/23953481
type: Answer
has comment: http://stackoverflow.com/comment/36899998

http://stackoverflow.com/q/24101284
tagged with: javascript
has answer: http://stackoverflow.com/a/24108613
tagged with: javascript-engine
type: UnansweredQuestion
tagged with: scriptengine
has body: Executing the following code in Java7 ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("js"); Bindings b = scriptEngine.createBindings(); b.put("x", true); scriptEngine.eval("x&amp;y", b); I get the error sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "b" is not defined. (&lt;Unknown Source&gt;#1) in &lt;Unknown Source&gt; at line number 1 Is there an option to evaluate to null/false for undefined objects, like in JavaScript? I know that an option will be to do something like "this.x&amp;this.y" instead of "x&amp;y", but I don't have control over that string (user entered).
tagged with: java
type: Question
score: 0
has title: Undefined objects in JavaScript engine in Java
answer count: 1

http://stackoverflow.com/q/24019427
type: Question
upvote count: 5
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24036772
linked to: http://stackoverflow.com/q/4892925
has answer: http://stackoverflow.com/a/24020063
score: 5
tagged with: jpa
downvote count: 0
favorite count: 0
has body: I want just that those attributes which are not used will get removed from DB (orphanRemoval=true). What I got is that it first tries to update the refrence PRODUCT_ID and then delete its. but as the refrence is part of the key it cannot. Parent: @Entity @Table(name = "STYLE") public class Style implements IterableById, Serializable { ... @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL, orphanRemoval=true) @JoinColumn(name="PRODUCT_ID", referencedColumnName = "PRODUCT_ID") private List&lt;Attribute&gt; attributes; ... Its Child @Entity @Table(name="ATTRIBUTE") public class Attribute{ @EmbeddedId private Id id; ... @Embeddable public static class Id implements Serializable{ private static final long serialVersionUID = -8631874888098769584L; @Column(name="PRODUCT_ID") protected Long productId; @Column(name="NAME") protected String name; @Column(name="COUNTRY_CODE") protected String countryCode; ... After i take a list of attributes and clear then, and thtne try to commit i get ... Hibernate: update ATTRIBUTE set PRODUCT_ID=null where PRODUCT_ID=? Hibernate: delete from ATTRIBUTE where COUNTRY_CODE=? and NAME=? and PRODUCT_ID=? javax.persistence.RollbackException: Error while committing the transaction Caused by: javax.persistence.OptimisticLockException: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 ... Does anyone know why Hibernate tries to update the reference first, and then deletes it. Can I somehow prevent it from. All I want is that those childs(attributes) which are not used have to get deleted and not just cut the reference. ...
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/53578034
answer count: 4
has title: hibernate update to null, then try to delete by updated column
has answer: http://stackoverflow.com/a/39742908

http://stackoverflow.com/comment/37097848
score: 0
type: Comment
has text: See my update in the post. I just replace DateFormat by SimpleDateFormat in the code due to error. ANd i set my input date.
type: AnswerComment
comment on: http://stackoverflow.com/a/24057065

http://stackoverflow.com/q/24004143
favorite count: 0
tagged with: bouncycastle
type: UnansweredQuestion
tagged with: encryption
tagged with: android
has body: I would like to encrypt and decrypt data using public/private key pairs in a native Java app for Android. I am having trouble wading through old posts / documentation. From my understanding: Early versions of Android used a crippled version of the bouncy castle encryption libraries. In particular it did not include the elliptic curve methods. Elliptic curve cryptography is the way to go on mobile devices because smaller key size means less computation and/or more secure. People suggested including your own copy of the bouncy castle libraries to get full functionality except rename the packages (or use spongy castle which is bouncy castle with renamed packages) Later versions of Android changed in a way that allow one to use bouncy castle without renaming packages Even later versions of Android began including bouncy castle with full functionality. So the question is- as of June 2014 how should one encrypt data on Android? Are there any simple projects on github doing things the "right way"?
has answer: http://stackoverflow.com/a/24004327
has comment: http://stackoverflow.com/comment/36996462
has comment: http://stackoverflow.com/comment/36995363
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36995171
type: Question
has title: How should one encrypt data on Android in 2014?
tagged with: spongycastle
upvote count: 3
downvote count: 1
answer count: 1

http://stackoverflow.com/a/24001857
has comment: http://stackoverflow.com/comment/36990824
has body: since you seem to be matching URLs which meet each case, then filtering by those, it is fairly simple to match URLs which DO contain 2 &amp;s. (&amp;.*&amp;)+ That will match anything containing a sequence with at least 2 ampersands
upvote count: 1
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24001821

http://stackoverflow.com/comment/37004710
has text: Can you post your `dataSource` declaration? That error message means that Hibernate can't connect to your database
comment on: http://stackoverflow.com/a/24009231
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24065817
has comment: http://stackoverflow.com/comment/37109865
tagged with: persistence
has body: I am learning to use Hibernate in my Java web app. I have the following sessionFactory started with a configuration for the location of my hibernate.cfg.xml file, but it still complains: resources/hibernate.cfg.xml not found The "resources" folder is a subdirectory of my "src" folder in the java project. public class HibernateUtil { private static final SessionFactory sessionFactory = new Configuration().configure("resources/hibernate.cfg.xml").buildSessionFactory(); public static void main(String[] args) { Session session = sessionFactory.getCurrentSession(); Transaction tx = session.beginTransaction(); Book book1 = new Book("John Wright", "Unknown Title"); session.save(book1); tx.commit(); System.out.println("Book committed: book title: " + book1.getTitle() + ", author is: " + book1.getAuthor()); sessionFactory.close(); } } The hibernate dependency I'm using in my pom.xml is as follows, but intelliJ warns that the buildSessionFactory() method is deprecated by highlight a "Strikethrough" org.hibernate hibernate-core 4.3.5.Final I am posting the error message from my i at the very bottom as well. What is going wrong? thanks 10:43:12.737 [main] INFO o.h.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.4.Final} 10:43:12.746 [main] INFO org.hibernate.Version - HHH000412: Hibernate Core {4.3.1.Final} 10:43:12.747 [main] INFO org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found 10:43:12.749 [main] INFO org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:259) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116) Caused by: org.hibernate.HibernateException: resources/hibernate.cfg.xml not found at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173) at org.hibernate.cfg.Configuration.getConfigurationInputStr…
has answer: http://stackoverflow.com/a/24067648
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24066912
has comment: http://stackoverflow.com/comment/37109749
has comment: http://stackoverflow.com/comment/37109798
has comment: http://stackoverflow.com/comment/37109651
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37110216
has title: resources/hibernate.cfg.xml not found
type: Question
tagged with: configuration
has comment: http://stackoverflow.com/comment/37109612
score: 0
answer count: 2

http://stackoverflow.com/comment/36933498
type: Comment
has text: @Pshemo Look at my comment above, I separated join and start into different loops.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23971217

http://stackoverflow.com/comment/36942577
type: Comment
comment on: http://stackoverflow.com/a/23976488
has text: Thanks for the answer! I think I fixed my problem by changing the while (xPos < 220) to while(true). But after doing a full loop, my command prompt glitched out. Not sure how to solve this issue. -- I added in an if statement to increment the counter and fixed the issue. thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37135842
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24080387
has text: for (int m=0; m What does it mean?

http://stackoverflow.com/q/23954394
type: Question
has answer: http://stackoverflow.com/a/23954551
linked to: http://stackoverflow.com/q/5698150
downvote count: 0
has comment: http://stackoverflow.com/comment/36901025
has comment: http://stackoverflow.com/comment/36901026
accepted answer: http://stackoverflow.com/a/23954915
favorite count: 0
has answer: http://stackoverflow.com/a/23954524
has title: How can i make an object to associate a number with a specific string
upvote count: 1
has comment: http://stackoverflow.com/comment/36901195
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23954524
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23954506
has body: I have an object named skill, that is initialized with 6 int values. I'm trying to make the object to associate that number with a specific string, so the object will internally substitute the received int by specific string. Example of the association i want: 1=disastous, 2=poor, 3=weak ... I can't remember how i can do that in java, i suppose that it's not with an enumerated. How can I do that?
has answer: http://stackoverflow.com/a/23954915

http://stackoverflow.com/q/23967115
tagged with: jlabel
tagged with: animation
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23967160
tagged with: java
downvote count: 2
upvote count: 1
tagged with: swing
tagged with: jbutton
type: Question
has body: how can i set JButton that changes the JLabel location on the JPanel when it pressed? how to implement the actionlistener for this on the JButton?
has title: how to make JButton changes the location of the text inside JLabel
score: -1
has answer: http://stackoverflow.com/a/23967160
has comment: http://stackoverflow.com/comment/36925599
answer count: 1
has comment: http://stackoverflow.com/comment/36925465
favorite count: 0

http://stackoverflow.com/a/24084255
answers question: http://stackoverflow.com/q/24083495
has comment: http://stackoverflow.com/comment/37146976
has comment: http://stackoverflow.com/comment/37179503
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/37156879
has comment: http://stackoverflow.com/comment/37156710
accepted answer of: http://stackoverflow.com/q/24083495
has body: There is object JavaConverters that will do the trick for you: import scala.collection.JavaConverters.mapAsJavaMapConverter Map("param1"-&gt; 1, "param2"-&gt; 2).asJava //&gt; res0: java.util.Map[String,Int] = {param1=1, param2=2} Edit: It is indeed a bad programming habbit to use wildcard imports as they will clutter your namespace and they might introduce accidental implicit conversion/values into the scope. So changed wildcard import to explicit import.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37076475
comment on: http://stackoverflow.com/q/24047789
score: 0
type: Comment
type: QuestionComment
has text: Yes, mikeswright49 running an emulator.

http://stackoverflow.com/q/24055272
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24056733
accepted answer: http://stackoverflow.com/a/24056733
tagged with: java
possible better answer: http://stackoverflow.com/a/24072853
tagged with: comparable
has comment: http://stackoverflow.com/comment/37092261
type: Question
upvote count: 4
tagged with: comparator
answer count: 2
downvote count: 0
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/37092509
has answer: http://stackoverflow.com/a/24072853
tagged with: android
has comment: http://stackoverflow.com/comment/37121766
has comment: http://stackoverflow.com/comment/37093815
has title: Comparable not sorting object
has body: I'm having a hard time sorting out my objects according to its properties. I have this list of patient objects that I want to sort according to their last name but it doesn't sort them at all. Can you tell me what am I doing wrong? Here are some relevant code. Patient.java import java.util.Comparator; public class Patient implements Comparable&lt;Patient&gt; { String fname, lname, mname, ID; public static class OrderByLastName implements Comparator&lt;Patient&gt; { @Override public int compare(Patient p1, Patient p2) { return p1.lname.compareTo(p2.lname); } } public static class OrderByID implements Comparator&lt;Patient&gt; { @Override public int compare(Patient p1, Patient p2) { return p1.ID.compareTo(p2.ID); } } @Override public int compareTo(Patient another) { // TODO Auto-generated method stub return 0; } } MainActivity.java public class PatientList extends ActionBarActivity { String[] newFName = {"Mark","Andy","Bryan"}; String[] newLName = {"Uy","Igy","Nator"}; String[] newMName = {"Wi","Menos","Pat"}; String[] newID = {"3","5","1"}; ArrayList&lt;Patient&gt; patientList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); createPatientList(); sortPatient(1); } private void createPatientList() { patientList = new ArrayList&lt;Patient&gt;(); for (int i = 0; i &lt; newFName.length; i++) { Patient patient = new Patient(); patient.lname = newLName[i]; patient.fname = newFName[i]; patient.mname = newMName[i]; patient.ID = newID[i]; patientList.add(patient); } } private void sortPatient(int order){ switch (order) { case 1: Collections.sort(patientList, new Patient.OrderByLastName()); break; case 2: Collections.sort(patientList, new Patient.OrderByID()); break; default: break; } } }

http://stackoverflow.com/comment/80325929
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23958916
has text: I think this interface will confuse developer, they will think that the function will do something with Threads
score: 0

http://stackoverflow.com/q/24043057
type: Question
tagged with: intellij-idea
score: 0
has comment: http://stackoverflow.com/comment/37100510
has comment: http://stackoverflow.com/comment/37099396
has body: I have a working ServerSocket based java server and a client (based on AS3 XMLSocket). This works out well on my IDE (Intellij). However my java server uses a lot of dependencies like Bounty castle and JSON parsing libs as JARs. These are working in the IDE. Once I export the java ServerSocket as a standalone JAR, the dependencies are not reachable any more. I always get the error :- Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/crypto/BlockCipher This is purely a class path issue. Hence I tried to put all the dependency JAR's in a separate lib folder and the folder structure looks like MyServer.jar libs and in the libs are all the dependencies. In the manifest file.. I have defined as Manifest-Version: 1.0 Main-Class: com.myserver.StartMe Class-Path: libs/*.jar but still the error persists. Did any one come across such an issue..with java ServerSocket ?. Would highly appreciate that. thanks Dom
type: UnansweredQuestion
answer count: 0
tagged with: java
has title: Java Socket Server and dependencies

http://stackoverflow.com/comment/36959735
type: QuestionComment
has text: @Hovercraft Full Of Eels - Sorry, I didn't word it right. What I meant was that in these particular circumstances, the variable has to be static because or else I get a `Cannot find symbol` when trying to access it from the encryption class. I edited the question with more precise wording.
comment on: http://stackoverflow.com/q/23985497
score: 0
type: Comment

http://stackoverflow.com/q/24023956
tagged with: eclipse
downvote count: 1
possible better answer: http://stackoverflow.com/a/24967126
has comment: http://stackoverflow.com/comment/37034174
accepted answer: http://stackoverflow.com/a/24026064
upvote count: 42
has answer: http://stackoverflow.com/a/26485438
type: Question
has comment: http://stackoverflow.com/comment/37032882
has answer: http://stackoverflow.com/a/24967126
answer count: 8
has answer: http://stackoverflow.com/a/24166264
has comment: http://stackoverflow.com/comment/37220361
has comment: http://stackoverflow.com/comment/37034139
has comment: http://stackoverflow.com/comment/37046157
has comment: http://stackoverflow.com/comment/37032047
has comment: http://stackoverflow.com/comment/37035125
has comment: http://stackoverflow.com/comment/37053392
tagged with: osx-yosemite
has body: Right after upgrading to Mac OS Yosemite (10.10), my Eclipse won't start anymore. Instead I get The JVM shared library /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol. I checked java -version and get java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) I search and have found one similar problem Reinstalling Java 7 JDK on OSX. It is suggesting a reinstallation of Java. I am not sure if my problem falls into the same category as his. So, is reinstallation a good way to solve the problem? Any other advice? Thanks!
tagged with: macos
favorite count: 0
score: 41
has answer: http://stackoverflow.com/a/24026064
linked to: http://stackoverflow.com/q/13806477
has title: Eclipse won't start after installing Mac OS X Yosemite (Mac OS 10.10)
has answer: http://stackoverflow.com/a/26424975
has comment: http://stackoverflow.com/comment/37046085
has comment: http://stackoverflow.com/comment/37048449
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29800140
has answer: http://stackoverflow.com/a/26623149
has answer: http://stackoverflow.com/a/26463165
tagged with: java
linked to: http://stackoverflow.com/q/26438628
has comment: http://stackoverflow.com/comment/37043726

http://stackoverflow.com/q/24035898
has answer: http://stackoverflow.com/a/24036271
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24036271
tagged with: jtable
answer count: 3
tagged with: tablemodel
score: 0
tagged with: mouselistener
possible better answer: http://stackoverflow.com/a/24036141
has body: I have a table and whenever I click on a cell of the table read its value. I want to store this data in an arraylist or something so you can take this information to another form of my application. Is this possible? Does anyone could help me please? Thank you very much. Code where I get the value from jTable jMyTable.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { { int selectedRowIndex = jMyTable.getSelectedRow(); int selectedColumnIndex = jMyTable.getSelectedColumn(); Object selectedObject = (Object) jMyTable.getModel().getValueAt(selectedRowIndex, selectedColumnIndex); System.out.println(selectedObject); } }); }
tagged with: swing
has answer: http://stackoverflow.com/a/24036141
type: AnsweredQuestion
has title: How save value from a getValueAt - Java
has answer: http://stackoverflow.com/a/24035994

http://stackoverflow.com/q/24061089
tagged with: vaadin
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24074352
has body: In Vaadin 7.x, I have a ComboBox setup using a JPAContainer. It's setup like: mycombo.setItemCaptionPropertyId("name"); Works great. However, the entity that is mapped to that combo uses a CHAR(50) column for the name and this cannot be changed. Everything works fine, but it's annoying to see all of those spaces when I copy/paste, for example, from the combo to some other text input. Naturally, I .trim() the combo value when I pass it in programmatically but I would like to always trim the display automatically. Would I do this by creating a custom converter? Thanks
has comment: http://stackoverflow.com/comment/37111867
answer count: 1
tagged with: combobox
favorite count: 0
tagged with: trim
has comment: http://stackoverflow.com/comment/37110772
has title: How can I .trim() the display field of a Vaadin combobox?
type: UnansweredQuestion
tagged with: vaadin7
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/37005939
type: QuestionComment
has text: Actually this requirement originated from client development team. They must do alphabetic sorting in javascript code. What they say is that these special characters ğ, ş, ü and etc. makes this sorting impossible. Since I have very limited knowledge of javascript, I could not propose any workaround. May be you have a solution for this problem? That way I do not need to do anything :)
comment on: http://stackoverflow.com/q/24009894
score: 0
type: Comment

http://stackoverflow.com/comment/36917713
comment on: http://stackoverflow.com/q/23962708
type: Comment
type: QuestionComment
score: 0
has text: Ok, but I don't know how to start to program it......I want to catch the text of all notifications (messages push-up) and manage them...

http://stackoverflow.com/comment/37078735
comment on: http://stackoverflow.com/q/24048907
score: 0
type: Comment
type: QuestionComment
has text: @Doodad What do you mean by "opposite of what you want"?

http://stackoverflow.com/a/24077196
has comment: http://stackoverflow.com/comment/37130553
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37130794
answers question: http://stackoverflow.com/q/24077149
has comment: http://stackoverflow.com/comment/37130628
accepted answer of: http://stackoverflow.com/q/24077149
has comment: http://stackoverflow.com/comment/37130971
type: Answer
has comment: http://stackoverflow.com/comment/37131036
score: 1
has body: You can pass an array as a ... parameter: c.newInstance(args)
upvote count: 1
has comment: http://stackoverflow.com/comment/37130802
has comment: http://stackoverflow.com/comment/37130441

http://stackoverflow.com/comment/37183600
has text: Most probably you are using `null` layout?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24104820

http://stackoverflow.com/q/23959349
tagged with: for-loop
answer count: 1
has body: How to fill a matrix with the informations contained in an Array: eg. 'matrix' is a matrix of Strings. String[] form = {"hey", "guys", "how", "are", "you", "bye"} //the size is 3*2 for (int k = 0; k &lt; 2; k++) for (int x = 0; x &lt; 3; x++) matrix[k][x] = form[...] how could I iterate properly on the list 'form' to fill the matrix? I would like to receive something like: hey guys how are you bye
tagged with: matrix
has title: Fill a matrix with the informations contained in an Array
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23959452
score: 0
tagged with: loops
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23959452

http://stackoverflow.com/q/23967423
favorite count: 0
has comment: http://stackoverflow.com/comment/36925982
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/23967468
answer count: 4
has answer: http://stackoverflow.com/a/23967481
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36925984
tagged with: java
tagged with: seconds
downvote count: 4
has answer: http://stackoverflow.com/a/23967528
tagged with: for-loop
has answer: http://stackoverflow.com/a/23967531
has title: How to make a loop or something that does a task every 5 seconds and then reset itself?
has comment: http://stackoverflow.com/comment/36925987
has body: I need to have the for loop at the bottom do everything in the body every 5 seconds but it's not working for some reason! Sorry if this sounds very dumb, I am very new to java! If you could help, that'd be great! Thanks! :) package rBP; import java.applet.Applet; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class Main extends Applet implements MouseListener { public void init() { super.init(); addMouseListener(this); } public long numClicks = 0; // 16385 public int autoFingerNum = 0; public int faultyButtonNum = 0; public int slickButtonNum = 0; public int coolButtonNum = 0; public int heatSinkNum = 0; public int superButtonNum = 0; public int aFCost = 30; public int aFValue = 1; public int fBCost = 75; public int fBValue = 3; public int slBCost = 300; public int slBValue = 10; public int cBCost = 1000; public int cBValue = 25; public int hSCost = 5000; public int hSValue = 80; public int suBCost = 10000; public int suBValue = 200; @Override public void paint(Graphics g) { this.setSize(1010, 360); g.setColor(Color.cyan); g.fillRect(0, 0, 1010, 360); // background g.setColor(Color.black); g.fillOval(47, 47, 205, 205); // button outline g.setColor(Color.red); g.fillOval(50, 50, 200, 200); // button g.setColor(Color.yellow); g.fillRect(2, 5, 290, 30); // yellow boxes g.fillRect(300, 25, 100, 250); g.fillRect(410, 25, 100, 250); g.fillRect(520, 25, 100, 250); g.fillRect(630, 25, 100, 250); g.fillRect(740, 25, 100, 250); g.fillRect(850, 25, 100, 250); g.setColor(Color.black); g.drawLine(300, 100, 400, 100); // lines on yellow boxes g.drawLine(410, 100, 510, 100); g.drawLine(520, 100, 620, 100); g.drawLine(630, 100, 730, 100); g.drawLine(740, 100, 840, 100); g.drawLine(850, 100, 950, 100); g.drawLine(300, 190, 400, 190); g.drawLine(410, 190, 510, 190); g.drawLine(520, 190, 620, 190); g.drawLine(630, 190, 730, 190); g.drawLine(740, 190, 840, 190); g.drawLine(850, 190, 95…
has comment: http://stackoverflow.com/comment/36925991

http://stackoverflow.com/a/24079175
type: Answer
has comment: http://stackoverflow.com/comment/37133771
score: 0
answers question: http://stackoverflow.com/q/24078847
has body: Requests sent from a router to a server outside that local network will all have the same IP address. This is one reason session ids are useful. If you need an identifier that MUST be unique for each user even if they are underneath the same local network you will need to use session variables. Consider looking at this post Where is session.id in Play 2.0? Essentially create your unique ID. (Code taken from referenced SO post) // Generate a unique id String uuid=session("uuid"); if(uuid==null) { uuid=java.util.UUID.randomUUID().toString(); session("uuid", uuid); }

http://stackoverflow.com/q/24094443
tagged with: ajax
has answer: http://stackoverflow.com/a/24094557
type: AnsweredQuestion
has title: Servlet is not getting called by using jquery ajax in JSP?
type: Question
possible better answer: http://stackoverflow.com/a/24094557
tagged with: java
has comment: http://stackoverflow.com/comment/37163093
has answer: http://stackoverflow.com/a/24094691
accepted answer: http://stackoverflow.com/a/24094691
tagged with: servlets
score: 0
answer count: 2
has body: I am working with JSP and Ajax for the first time. I am trying to get one column data from database and populate it in my drop down list in my JSP page using Ajax call. I don't want to refresh the page so that is the reason, I am making an Ajax call. Here is my jsfiddle which has Process button and as soon as I click Process button, it will show an empty drop down list as of now. This is in my another test.jsp page. I have a table as account and I need to make this select query from the jsp - SELECT USERS FROM ACCOUNT; As soon as I am clicking Process button, I need to execute above SQL query on my POSTGRESQL database using Ajax. And whatever users, I am getting back from the database, I need to populate those USERS in my drop down list as shown in my above jsfiddle. Below is my servlet code which I am calling from a JSP page using Ajax. @WebServlet("/someservlet/*") public class SomeServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { try { System.out.println("Hello Test"); // Step 1. Load the JDBC driver Class.forName("org.postgresql.Driver"); // Step 2. Create a Connection object Connection con = DriverManager.getConnection( "jdbc:postgresql://localhost/test","root", "root!"); Statement s = con.createStatement(); String sql ="SELECT USERS FROM ACCOUNT"; ResultSet rs = s.executeQuery(sql); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); while (rs.next()) { list.add(rs.getString("email")); } String json = new Gson().toJson(list); response.getWriter().write(json); rs.close(); s.close(); con.close(); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (SQLException e2) { e2.printStackTrace(); } catch (Exception e3) { e3.printStackTrace(); } } } And below is my jquery ajax call from the above jsp page as shown in the jsfiddle from where I am calling the above servlet on the click of Process button - &lt;script type="text/javascript"&gt; $(document).ready(function() { $('.btn-primary').click(function() { alert…
tagged with: jsp
tagged with: jquery

http://stackoverflow.com/comment/37099786
has text: Thanks Shazin. I understand the issue is broad but I was expecting it to be a common design problem. Unfortanely I havent come across many topics or discussion covering this.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24060483
score: 0

http://stackoverflow.com/comment/37157904
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24087020
has text: I don't understand the question. The size() method appears to provide exactly what you want.

http://stackoverflow.com/q/24062782
has answer: http://stackoverflow.com/a/24063051
upvote count: 1
has comment: http://stackoverflow.com/comment/37104216
has comment: http://stackoverflow.com/comment/37103781
has title: Regex extract last numbers from String
has comment: http://stackoverflow.com/comment/37103870
has comment: http://stackoverflow.com/comment/37103767
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37103740
type: Question
has comment: http://stackoverflow.com/comment/37103993
accepted answer: http://stackoverflow.com/a/24063051
has comment: http://stackoverflow.com/comment/37104069
downvote count: 0
answer count: 1
favorite count: 0
has body: I have some strings which are indexed and are dynamic. For example: name01, name02, name[n] now I need to separate name from index. I've come up with this regex which works OK to extract index. ([0-9]+(?!.*[0-9])) But, there are some exceptions of these names. Some of them may have a number appended which is not the index.(These strings are limited and I know them, meaning I can add them as "exceptions" in the regex) For example, panLast4[01] Here the last '4' is not part of the index, so I need to distinguish. So I tried: [^panLast4]([0-9]+(?!.*[0-9])) Which works for panLast4[123] but not panLast4[43] Note: the "[" and "]" is for explanation purposes only, it's not present in the strings What is wrong? Thanks
has comment: http://stackoverflow.com/comment/37103787
has comment: http://stackoverflow.com/comment/37104142
has comment: http://stackoverflow.com/comment/37103926
tagged with: regex
has comment: http://stackoverflow.com/comment/37103910

http://stackoverflow.com/q/24021858
has comment: http://stackoverflow.com/comment/37027670
has comment: http://stackoverflow.com/comment/37028221
tagged with: java
has comment: http://stackoverflow.com/comment/37028044
has title: Moving to previous element in the Collection
tagged with: collections
has answer: http://stackoverflow.com/a/24022079
type: Question
has comment: http://stackoverflow.com/comment/37027571
tagged with: struts
has body: I have a Collection object returned from the DB. I want to see if there size is 0 or >0 and direct my forward accordingly. To accomplish that I used iterator and hasNext() like below, if (!report.getFtRecords().iterator().hasNext()) { NoRecord = true; } if (NoRecord) forwardName = "successNoRecord"; // retains in the same page else forwardName = "success"; //goes to 2nd page page In the JSP I use the same report object and in scriptlet they are performing iterator.hasNext(). This works fine for '0' records returned from DB and more than 1 record returned from DB. However if there is only one record, I use the same report object and since I do hasNext() in action class and do the same in JSP, Cursor moves out of the 1st record and displays nothing in the JSP (since the resultset has 1 record). Since it's an iterator I cannot reset the collection. I cannot get the size() of the collection too since my class extends abstract collection, so anything that calls .size() throws exception. How do I handle the same? I tried to handle in the DB by sending the last column with the count but will end up having the same issue. Any suggestions?
score: 0
has comment: http://stackoverflow.com/comment/37027858
answer count: 1
tagged with: jsp
type: UnansweredQuestion

spongycastle
tags question: http://stackoverflow.com/q/24004143
type: Tag
tag name: spongycastle

http://stackoverflow.com/q/23960638
downvote count: 0
score: 1
tagged with: java
has title: How to make state variable thread safe
has body: Suppose I have a class having static member variable.There are two synchronized methods,static and instance, present in that class and both the methods are trying to modify the value of static member variable. First thread is having lock on object of that class , so first thread can access both static synchronized and instance synchronized method. Second thread is having class level lock , so it can access only static synchronized method. In this scenario , how to achieve thread safety.
type: Question
has comment: http://stackoverflow.com/comment/36915778
has answer: http://stackoverflow.com/a/23960710
accepted answer: http://stackoverflow.com/a/23960710
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36913350
favorite count: 0
has comment: http://stackoverflow.com/comment/36913242
has comment: http://stackoverflow.com/comment/36916405
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36913227
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2120248

http://stackoverflow.com/q/24039605
tagged with: java
has answer: http://stackoverflow.com/a/24056624
type: Question
tagged with: c#
has body: I need some help with Google Calendar API. I tried to find information in google docs but still can't make application working. We have a console application that works on server and performs exchange with Google calendar. This application uses Google Calendar API to get/update events in users' calendars. However, as we're accessing private user data we need to ask user about permissions to update his calendar. The issue is that when console application tries to access private data (e.g. events) web page in browser is opened where user must press "Accept" button. I would like to avoid this situation and somehow automatically press this button (or even bypass this step at all). Can anyone help me with this? I tried to use API access and service accounts but got Unauthorized error.
has title: google calendar api server application
score: 0
accepted answer: http://stackoverflow.com/a/24056624
tagged with: .net
answer count: 1
tagged with: google-api
tagged with: google-calendar-api
type: AnsweredQuestion

http://stackoverflow.com/q/24015221
tagged with: libgdx
has title: libgdx change background when game reset
score: 0
has answer: http://stackoverflow.com/a/24016402
linked to: http://stackoverflow.com/q/24057817
answer count: 1
has body: I want to change my background after three attempts from day to night and back again after three attempts. I have put an integer in the gamerenderer class. I created two methods drawDAY and drawNight. I want to change by GAMEOVER or HIGHSCORE. Any idea how to set this up in GameWorld? public void changeBG(int x){ if(x == 3){ drawDAY();} else if (x == 6){ drawNIGHT();} x = 0; } private void drawNIGHT() { // TODO Auto-generated method stub } private void drawDAY() { // TODO Auto-generated method stub }
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/36935781
comment on: http://stackoverflow.com/q/23973131
score: 0
type: Comment
type: QuestionComment
has text: Right. Then try to build the .war and look in the WEB-INF/lib to see what jars Maven resolves.

http://stackoverflow.com/a/24082002
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24060747
type: Answer
has body: Try this type of format, may be it will help you.. &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/marginTop" android:orientation="horizontal" &gt; &lt;ImageButton android:id="@+id/browseButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:background="@null" android:scaleType="fitCenter" /&gt; &lt;View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /&gt; &lt;ImageButton android:id="@+id/searchButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@null" android:scaleType="fitCenter" /&gt; &lt;View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /&gt; &lt;ImageButton android:id="@+id/favButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right|center_vertical" android:background="@null" android:scaleType="fitCenter" /&gt; &lt;/LinearLayout&gt;
downvote count: 0

http://stackoverflow.com/comment/37109477
type: QuestionComment
comment on: http://stackoverflow.com/q/24065821
type: Comment
score: 3
has text: Java. Python doesn't even make sense (as in it's not meant for android).

http://stackoverflow.com/a/24035494
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24035404
has comment: http://stackoverflow.com/comment/37053000
answers question: http://stackoverflow.com/q/24035404
has body: Try to put @Transactional over your method like below @Async @Transactional public void writeSomethingASync() throws InterruptedException{ mydao.insertData(testObj); // This is started from second thread } So basically what is happening your database operation is not in any active transaction so either u have to do manual txn management or have to use automatic transaction management using @Transactional
has comment: http://stackoverflow.com/comment/133839757

http://stackoverflow.com/comment/37079305
has text: Are you getting `"LinearLayout is null"` in LogCat?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24049285
type: Comment

http://stackoverflow.com/comment/37003417
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24008589
has text: Check out this: http://stackoverflow.com/questions/215271/sort-arrays-of-primitive-types-in-descending-order

http://stackoverflow.com/a/24012034
answers question: http://stackoverflow.com/q/24011963
type: Answer
downvote count: 0
score: 1
has body: The class ServletRequest has a method getAsynContext() that returns the asynchronous context. The class AsynContext has a method getRequest() that returns a ServletRequest, which can be use to call getAsynContext()... So you can call those methods infinitely.
upvote count: 1

http://stackoverflow.com/q/24090431
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24090629
score: -1
has comment: http://stackoverflow.com/comment/37155747
tagged with: arraylist
has title: Dynamically outputting array information after parsing information
has comment: http://stackoverflow.com/comment/37155811
upvote count: 0
answer count: 1
tagged with: arrays
has body: I'm trying to parse through some defined font styles to create an array to use for determining what font styling to use in a document. Currently, I'm just displaying the information that's being stored in the array just to see if I'm getting it right, but I've noticed that it's storing the information statically, which isn't what I want. This is the information I'm parsing through: &lt;!Font Definitions, F2 = Times 6, F3 = Times 10, F7 = Times 10 Bold, F8 = Times 9, F6 = Times 12, F9 = Symbols 12, F12 = Times 10 Italic, F13 = Helvetica 14 Bold, F15 = Times 12 Bold, F16 = Times 15, F17 = Times 14 Bold, F18 = Times 18 Bold, F25 = Times 6 Bold, F26 = Times 6 Italic, F27 = Times 21 Bold, F28 = Times 27 Bold, F30 = Times 15 Bold, F37 = Times 9 Bold, F38 = Times 9 Italic&gt; I've tried two different times to get the output that I want. This was the first attempt: *Note: the text.jor.ildoc file is a QuickSilver file. The information I'm parsing works the same if you were to put it into a text document instead. public class Test { private class FontF { private String FontID; private String FontFamily; private String FontSize; private String FontAttribute; } Test test = new Test(); FontF fontF = test.new FontF(); public static void main(String[] args) { File infile = new File("C:\\Users\\Jake\\Sandbox\\test.jor.ildoc"); ArrayList&lt;FontF&gt; fontStuff = new ArrayList&lt;FontF&gt;(); try { FileReader in = new FileReader(infile); BufferedReader readFile = new BufferedReader(in); String line; while (!((line = readFIle.readLine()).contains("&lt;!Font Definitions,"))) { } int counter = 0; while (!((line = readFile.readLine()).compareTo("") == 0)) { String id,temp; id = line.substring(0, line.indexOf(" ")); id = id.trim(); temp = line.substring(line.indexOf("=") + 1); temp = temp.trim(); temp = temp.substring(0, temp.length() - 1); String[] array = temp.split(" "); fontStuff.add(fontF); fontStuff.get(counter).FontID = id; fontStuff.get(counter).FontFamily = array[0]; fontStuff.ge…
has comment: http://stackoverflow.com/comment/37156225
favorite count: 0
accepted answer: http://stackoverflow.com/a/24090629
has comment: http://stackoverflow.com/comment/37156224
tagged with: java
downvote count: 1

lucene
tags question: http://stackoverflow.com/q/24065884
tags question: http://stackoverflow.com/q/24056987
tags question: http://stackoverflow.com/q/24017754
tags question: http://stackoverflow.com/q/24057613
tags question: http://stackoverflow.com/q/24096227
tags question: http://stackoverflow.com/q/24022780
tags question: http://stackoverflow.com/q/24101240
tags question: http://stackoverflow.com/q/24076439
tags question: http://stackoverflow.com/q/23967143
type: Tag
tags question: http://stackoverflow.com/q/24044530
tag name: lucene
tags question: http://stackoverflow.com/q/24047613

http://stackoverflow.com/q/24081928
has comment: http://stackoverflow.com/comment/37138616
has answer: http://stackoverflow.com/a/24082031
type: AnsweredQuestion
has title: Is it possible to a single void method's body with mockito?
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37138692
accepted answer: http://stackoverflow.com/a/24082031
has body: I want to override the implementation of a single void method of a class using Mockito. The other methods should be stubbed. I have tried something like this, but it does not compile since java.lang.Void != void: MyObj obj = mock(MyObj.class); doAnswer(new Answer&lt;Void&gt;() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { return null; } }).when(obj.myMethod(any(String.class))); Is there no "doInvoke" or something like that? Must I resort to standard Java class extend-and-override before mocking the extended class?
tagged with: mockito
answer count: 1
score: 0

http://stackoverflow.com/q/23951148
tagged with: java
has body: I am newbie in Java 8 Streams. Please advice, how to Convert Stream Stream&lt;HashMap&lt;String, Object&gt;&gt; to HashMap Array HashMap&lt;String, Object&gt;[] ? For example, I has some stream in code: Stream&lt;String&gt; previewImagesURLsList = fileNames.stream(); Stream&lt;HashMap&lt;String, Object&gt;&gt; imagesStream = previewImagesURLsList .map(new Function&lt;String, HashMap&lt;String, Object&gt;&gt;() { @Override public HashMap&lt;String, Object&gt; apply(String person) { HashMap&lt;String, Object&gt; m = new HashMap&lt;&gt;(); m.put("dfsd", person); return m; } }); How I can do something like HashMap&lt;String, Object&gt;[] arr = imagesStream.toArray(); ? Sorry my bad English.
answer count: 1
has title: How to Convert Stream Stream<HashMap<String, Object>> to HashMap Array HashMap<String, Object>[]?
has answer: http://stackoverflow.com/a/23951206
accepted answer: http://stackoverflow.com/a/23951206
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
tagged with: java-8
tagged with: java-stream
upvote count: 2

http://stackoverflow.com/q/24058899
upvote count: 2
tagged with: java
downvote count: 2
tagged with: nutch
has comment: http://stackoverflow.com/comment/37155115
type: Question
has comment: http://stackoverflow.com/comment/37096746
has body: Can anyone please tell me if there is any way for apache nutch to ignore or bypass robots.txt while crawling. I am using nutch 2.2.1. I found that "RobotRulesParser.java"(full path:-src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/ RobotRulesParser.java) is responsible for the reading and parsing the robots.txt. Is there any way to modify this file to ignore robots.txt and go on with crawling? Or is there any other way to achieve the same?
has answer: http://stackoverflow.com/a/24124623
tagged with: web-crawler
has comment: http://stackoverflow.com/comment/37096982
tagged with: robots.txt
score: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24124623
has comment: http://stackoverflow.com/comment/37096572
has title: how to bypass robots.txt with apache nutch 2.2.1
type: AnsweredQuestion

http://stackoverflow.com/q/24051152
has comment: http://stackoverflow.com/comment/37082561
has answer: http://stackoverflow.com/a/24051202
has answer: http://stackoverflow.com/a/24051803
accepted answer: http://stackoverflow.com/a/24051803
has title: Converting string of hex values to readable string in Java
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/24051202
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37082524
score: 2
tagged with: hex
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37082480
has body: I have string in the following format: String input = "4E 65 73 74 6C C3 A9" Which I need to convert to below output: Nestlé Is there any utility library or java function I can use to make it work?
tagged with: java
type: Question

http://stackoverflow.com/q/23960114
has comment: http://stackoverflow.com/comment/36912404
has title: Java swing with synth checkboxes/radio button borders disappear after long uptime
favorite count: 0
has comment: http://stackoverflow.com/comment/36915768
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: checkbox
has comment: http://stackoverflow.com/comment/36912279
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36923388
type: Question
tagged with: radio-button
upvote count: 1
downvote count: 0
tagged with: synth
has body: I have a GUI app that is supposed to run continuously, if the user wishes, showing the state of some database operations. It uses checkboxes in a column in a JTable, as well as stand alone checkboxes. After a couple days of up-time the box in the checkbox refuses to render, though the text is still visible. This occurs for checkboxes active on the screen as well as those that are in new windows, instantiated after the problem is noticed. A similar situation is observed for radio buttons. The users can still interact with the components. The GUI can use quite a bit of memory, but the logs (from log4j) do not indicate any problems. It sound, to me, like a bug in swing or synth. Now you see them. Now you don't. I have not been able to find any documentation of a bug in swing or synth. Has anybody else observed this problem? Is there a resolution?

http://stackoverflow.com/comment/37164719
type: AnswerComment
has text: http://www.mediafire.com/download/hbok4m2bg8i78y4/VimeoDownloader.zip this will work but u will need gson.
type: Comment
comment on: http://stackoverflow.com/a/23977889
score: 0

http://stackoverflow.com/comment/37123300
score: 0
type: AnswerComment
has text: Yikes indeed, problem with re-inventing wheels
type: Comment
comment on: http://stackoverflow.com/a/24073265

http://stackoverflow.com/comment/36951753
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23981379
has text: @learner Just updated. Essentially, the compiler sees that you have some compile-time constants, so it can optimize that away by doing the operation at compile-time instead of at runtime. Kind of like if you do `int x = 1 + 2;`, it'll be more efficient to evaluate that at compile time and simply compile `int x = 3;` instead of wasting execution resources performing a simple addition of constants.
score: 0

http://stackoverflow.com/q/23952888
has answer: http://stackoverflow.com/a/35984622
linked to: http://stackoverflow.com/q/25644023
answer count: 3
favorite count: 0
score: 8
tagged with: http://stackoverflow.com/tag/xml
has title: Solution for secure-processing org.xml.sax.SAXNotRecognizedException causing java.lang.IllegalStateException running inside Tomcat
has comment: http://stackoverflow.com/comment/36901189
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28292528
has comment: http://stackoverflow.com/comment/40367465
tagged with: java
has comment: http://stackoverflow.com/comment/74901019
has answer: http://stackoverflow.com/a/51491539
upvote count: 8
type: Question
downvote count: 0
has body: I'm facing this exception when receiving an Xml and trying to parse it. The code responsible for that is well tested when running as an standalone application. However I'm now integrating it in Tomcat. The stack trace is: java.lang.IllegalStateException: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing at com.sun.xml.internal.bind.v2.util.XmlFactory.createParserFactory(XmlFactory.java:121) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getXMLReader(UnmarshallerImpl.java:139) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:204) Digging around I found this, so maybe the solution is to change the options Tomcat sets. So the question is: Which is the problem's root? Best way to solve it? Is a good approach to change Tomcat options? how is this done? Update This happens when running it with Java 8, reverting to Java 7 works ok.

http://stackoverflow.com/comment/37201868
score: 0
type: AnswerComment
type: Comment
has text: actually i think the problem is that i have an actor inside another actor (group) and then both go to the stage, because if i draw w shapeRenderer that take everything from the group (we can define origin and rotation in the shapeRenderer.rect) then i'll get perfectly what i want, the problem is that i cannot create a rectangle with a given rotation, which is very weird... and i don't know how to draw a rectangle using polygons and make it look to the right angle
comment on: http://stackoverflow.com/a/24103549

http://stackoverflow.com/q/24096059
has answer: http://stackoverflow.com/a/24096215
downvote count: 1
type: Question
upvote count: 5
possible better answer: http://stackoverflow.com/a/24096215
score: 4
has answer: http://stackoverflow.com/a/48739929
has answer: http://stackoverflow.com/a/24096194
answer count: 3
has comment: http://stackoverflow.com/comment/37166436
accepted answer: http://stackoverflow.com/a/24096194
favorite count: 0
tagged with: serialization
has title: Why default constructor is not called while deserialization process?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37166611
has comment: http://stackoverflow.com/comment/37165988
has body: ObjectInputStream is = new ObjectInputStream(new FileInputStream("test.ser")); TestClass tc = (TestClass)is.readObject(); I get the object of TestClass after deserialization but TestClass default constructor is not called. As per my understanding there are two ways to create object i.e either with new operator or TestClass.class.newInstance(). Both calls the default constructor. Looks like deserialization process creates the object not with about two methods thats why default constructor is not called. Question is how deserialization creates the object ? Another point is if TestClass extends BaseTestClass and BaseTestClass does not implements serialization , constructor of BaseTestClass is called but not TestClass. Why so ? I am sure there will be some logical reason behind it. But i am not getting it?
tagged with: java

http://stackoverflow.com/q/23974608
has answer: http://stackoverflow.com/a/23974618
has title: am i allowed to use member variables in static inner class for fragments?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23974618
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36938721
upvote count: 1
has body: All my static fragments are: public static class SomeFragment extends Fragment { int somenum; String name; } are the values of somenum and name shared between different instances because the class is static?
type: Question
has comment: http://stackoverflow.com/comment/36938751

http://stackoverflow.com/comment/36969101
has text: @AndrewThompson - "The problem is, that after pressing buttons, there is no action in JPanel." - I'll admit that *could* be unclear, but given the action snippet at the start, it seems pretty evident.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23981877
score: 0

http://stackoverflow.com/comment/36976775
type: Comment
has text: 64000000 characters in a small alphabet shouldn't be a big compressed textfile either. On the other hand, if you don't have problems with using an image format, then go for it (i personally would prefer parsing text over images, but that's a matter of taste)
comment on: http://stackoverflow.com/a/23994436
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37001221
type: Comment
comment on: http://stackoverflow.com/q/24007711
score: 0
has text: What do you mean by "functions?"
type: QuestionComment

http://stackoverflow.com/comment/36917447
comment on: http://stackoverflow.com/a/23958289
score: 0
type: AnswerComment
has text: Yes I meant `glDisableVertexAttribArray(0)`, and no I believe that `in vec4 position` will cause the values you don't send to be filled with 0, except for the last (w) which becomes 1, so you would not need `glVertexAttribPointer(0, 4, …)`. You might want to try it though I could be wrong.
type: Comment

http://stackoverflow.com/comment/37171329
type: Comment
type: QuestionComment
has text: Does it work if you use the correct index with `Arrays.copyOfRange` ("byte+int+long = "`1+4+8 =13 != 11`)?
comment on: http://stackoverflow.com/q/24098617
score: 0

http://stackoverflow.com/q/24009211
favorite count: 0
has body: I'm a beginner in tapestry and I was wondering If it is possible to use a java expression as test into an component I've been trying this way but it's not working &lt;t:loop source="pathologies" value="valueFromCda"&gt; &lt;t:if test="valueFromCda instanceof String"&gt; the error is the following one : Could not convert 'valueFromCda instanceof StrucDocList' into a component parameter binding: Error parsing property expression 'valueFromCda instanceof StrucDocList': line 1:0 no viable alternative at input 'valueFromCda' valueFromCda and pathologies are properties in my controller: @Property private Object valueFromCda; @Property private List&lt;Object&gt; pathologies; Thank you for your answers ! have a good afternoon ;)
has title: Tapestry use Java expression into <t:if> component
type: Question
type: AnsweredQuestion
tagged with: if-statement
tagged with: expression
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24010305
accepted answer: http://stackoverflow.com/a/24010305
upvote count: 1
answer count: 1
downvote count: 0
tagged with: tapestry

http://stackoverflow.com/comment/37061286
type: AnswerComment
type: Comment
has text: There are many, many cases where you don't start a for loop with i = 0. But in most cases for counting, you definitely do want to.
comment on: http://stackoverflow.com/a/24039787
score: 0

http://stackoverflow.com/comment/37240138
score: 0
type: Comment
type: QuestionComment
has text: May be its some problem with the version 1.5.0, can you try this in pom.xml -> spring.framework.version 3.1.2.RELEASE, mongodb java driver 2.11.0, Spring data mongodb 1.2.0.RELEASE, cglib 2.2.2, spring-data-mongodb-log4j 1.3.3.RELEASE
comment on: http://stackoverflow.com/q/24056776

http://stackoverflow.com/q/24085257
has comment: http://stackoverflow.com/comment/37145242
answer count: 2
tagged with: replaceall
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24085283
tagged with: arraylist
has title: Removing punctuation is not working in Java with string replacement
has answer: http://stackoverflow.com/a/24085297
has comment: http://stackoverflow.com/comment/37145309
has body: So, what I'm trying to do is compile a single word list with no repeats out of 8 separate dictionary word lists. Some of the dictionaries have punctuation in them to separate the words. Below is what I have that pertains to the punctuation removal. I've tried several different solutions that I've found on stack overflow regarding regex expressions, as well as the one I've left in place in my code. For some reason, none of them are removing the punctuation from the source dictionaries. Can someone tell me what it is I've done wrong here and possibly how to fix it? I'm at a loss and had a coworker check it and he says this ought to be working as well. int i = 1; boolean checker = true; Scanner inputWords; PrintWriter writer = new PrintWriter( "/home/htarbox/Desktop/fullDictionary.txt"); String comparison, punctReplacer; ArrayList&lt;String&gt; compilation = new ArrayList&lt;String&gt;(); while (i &lt;9) { inputWords = new Scanner(new File("/home/htarbox/Desktop/"+i+".txt")); while(inputWords.hasNext()) { punctReplacer = inputWords.next(); punctReplacer.replaceAll("[;.:\"()!?\\t\\n]", ""); punctReplacer.replaceAll(",", ""); punctReplacer.replaceAll("\u201C", ""); punctReplacer.replaceAll("\u201D", ""); punctReplacer.replaceAll("’", "'"); System.out.println(punctReplacer); compilation.add(punctReplacer); } } inputWords.close(); } i = 0;
possible better answer: http://stackoverflow.com/a/24085297
has comment: http://stackoverflow.com/comment/37145349
accepted answer: http://stackoverflow.com/a/24085283
upvote count: 1
has comment: http://stackoverflow.com/comment/37145276
type: Question
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/23977837
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36945203
has body: Solution Remove the statics from your member variables in your kisi class. But also note new kisi("1","betül") So your id is a String. When you go through the list comparing ids you do so with ==. == in java is a same comparison, not an equal comparison. This is unlike the behavior for strings in C# say. So what you should do is this: for (int i = 0; i &lt; x.size(); i++) { if (x.get(i).id.equals(k.id)) { //change here Object obj = x.remove(i); break; } } In this simple example this is not causing the problem because the two "2" strings are the same. Which leads me to conclude there's something funny going on your kisi constructor. This is the one I used and the code worked as was: public class kisi { public String id; public kisi(String id, String string2) { this.id = id; } } A constructor like this will break the code without the .equals call: public kisi(String id, String string2) { this.id = id + string2; }
type: Answer
has comment: http://stackoverflow.com/comment/36945205
accepted answer of: http://stackoverflow.com/q/23977769
answers question: http://stackoverflow.com/q/23977769
score: 0

http://stackoverflow.com/a/36747647
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24080541
has body: I am using Jetty in my project and got the same error. My quick solution was to exclude embedded Tomcat from the Maven dependency: org.springframework.boot spring-boot-starter-ws 1.2.0.RELEASE org.springframework.boot spring-boot-starter-tomcat
downvote count: 0

http://stackoverflow.com/a/23980449
answers question: http://stackoverflow.com/q/23980404
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36949977
has comment: http://stackoverflow.com/comment/36949862
has comment: http://stackoverflow.com/comment/36949878
has comment: http://stackoverflow.com/comment/36950050
upvote count: 1
has body: The pipe character (|) connects the standard output of the command to the left to the standard input of the command to the right. So it's already doing what you ask. If your question is actually related to Java, you probably want the official Pipe class (courtesy @kajacx).
type: Answer

http://stackoverflow.com/a/46352674
downvote count: 0
answers question: http://stackoverflow.com/q/24010109
type: Answer
has body: Answering specific question of reversing with IntStream, below worked for me: IntStream.range(0, 10) .map(x -&gt; x * -1) .sorted() .map(Math::abs) .forEach(System.out::println);
score: 1
upvote count: 1

http://stackoverflow.com/comment/37037603
score: 0
has text: [procexp](http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx), [procmon](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) or profile with [depends](http://www.dependencywalker.com/).
type: QuestionComment
comment on: http://stackoverflow.com/q/24001521
type: Comment

http://stackoverflow.com/a/24030804
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24023986
accepted answer of: http://stackoverflow.com/q/24023986
has comment: http://stackoverflow.com/comment/37085110
upvote count: 1
type: AcceptedAnswer
has body: Don't duplicate reuse the same entity combine annotations with some xml mapping to specify the table. To retrieve use the name you gave the entity instead of the class. <entity name="ConcDualKey" class="ConcDualKey" table="conc_dual_key" /> <entity name="ConcFindingDualKey " class="ConcDualKey" table="conc_finding_dual_key" /> Something like this. You could also make the ConcFindingDualKey read-only. The mappings go in a file called orm.xml this file should reside in the META-INF directory of your project. (That is the default location specified in the JPA specification, you can put it anywhere but then you have to explicitly tell hibernate where to find the file by including a mapping-file element in the persistence.xml).
type: Answer
has comment: http://stackoverflow.com/comment/37078028

jakarta-ee
tags question: http://stackoverflow.com/q/24067571
tags question: http://stackoverflow.com/q/24085365
tags question: http://stackoverflow.com/q/24014911
tags question: http://stackoverflow.com/q/24088836
tags question: http://stackoverflow.com/q/23962438
tags question: http://stackoverflow.com/q/23961030
tags question: http://stackoverflow.com/q/24085653
tags question: http://stackoverflow.com/q/24076246
tags question: http://stackoverflow.com/q/23993440
tags question: http://stackoverflow.com/q/24073313
tags question: http://stackoverflow.com/q/23993608
type: Tag
tags question: http://stackoverflow.com/q/23993032
tags question: http://stackoverflow.com/q/24011458
tags question: http://stackoverflow.com/q/23992755
tags question: http://stackoverflow.com/q/23978556
tags question: http://stackoverflow.com/q/23977629
tags question: http://stackoverflow.com/q/24075901
tags question: http://stackoverflow.com/q/24056328
tags question: http://stackoverflow.com/q/24101556
tags question: http://stackoverflow.com/q/24047533
tags question: http://stackoverflow.com/q/24033405
tags question: http://stackoverflow.com/q/24005607
tags question: http://stackoverflow.com/q/24051216
tags question: http://stackoverflow.com/q/24031552
tags question: http://stackoverflow.com/q/24078840
tags question: http://stackoverflow.com/q/24029164
tags question: http://stackoverflow.com/q/23983895
tags question: http://stackoverflow.com/q/23974610
tags question: http://stackoverflow.com/q/24074868
tags question: http://stackoverflow.com/q/24033804
tags question: http://stackoverflow.com/q/24017038
tags question: http://stackoverflow.com/q/23946629
tags question: http://stackoverflow.com/q/24093242
tags question: http://stackoverflow.com/q/24082437
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/23996602
tags question: http://stackoverflow.com/q/24066367
tags question: http://stackoverflow.com/q/24065966
tags question: http://stackoverflow.com/q/24082684
tags question: http://stackoverflow.com/q/24075170
tags question: http://stackoverflow.com/q/23964628
tags question: http://stackoverflow.com/q/24009377
tags question: http://stackoverflow.com/q/24082427
tags question: http://stackoverflow.com/q/24099317
tags question: http://stackoverflow.com/q/24039400
tags question: http://stackoverflow.com/q/24073418
tags question: http://stackoverflow.com/q/23963122
tags question: http://stackoverflow.com/q/24004668
tags question: http://stackoverflow.com/q/24103393
tags question: http://stackoverflow.com/q/24074772
tags question: http://stackoverflow.com/q/23983734
tags question: http://stackoverflow.com/q/24017089
tags question: http://stackoverflow.com/q/24052191
tags question: http://stackoverflow.com/q/24049291
tags question: http://stackoverflow.com/q/24101135
tags question: http://stackoverflow.com/q/24015626
tags question: http://stackoverflow.com/q/24011096
tags question: http://stackoverflow.com/q/24039305
tags question: http://stackoverflow.com/q/24001951
tags question: http://stackoverflow.com/q/24055314
tags question: http://stackoverflow.com/q/24034974
tags question: http://stackoverflow.com/q/23973138
tags question: http://stackoverflow.com/q/23987546
tags question: http://stackoverflow.com/q/23966027
tags question: http://stackoverflow.com/q/24045213
tags question: http://stackoverflow.com/q/24000191
tags question: http://stackoverflow.com/q/24045342

http://stackoverflow.com/q/24040233
has title: String from XML file and \n
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24045381
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37061742
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37062083
tagged with: java
has body: This is my problem: I get a String from an xml file that includes "\n" end of line character. If I put this String in a graphics object (in LibGDX Game Window) it has printed with "\n" but if I write the String directly (so not got from XML file) it will print without "\n" and new line occur after the point at "\n". How can I have this behavior also when I get the String from the xml file?
has comment: http://stackoverflow.com/comment/37071461
type: Question
has comment: http://stackoverflow.com/comment/37071186
has comment: http://stackoverflow.com/comment/37062123
tagged with: libgdx
answer count: 1
accepted answer: http://stackoverflow.com/a/24045381

http://stackoverflow.com/a/23970049
has body: Many browsers have changed their security policies to no longer allow reading data directly from file shares or even local resources. You need to either place the files somewhere that your tomcat instance can serve them up and put a "regular" http url in the html you generate. This can be accomplished by either providing a servlet which reads and provides the file putting the file into a directory where tomcat will serve it up as "static" content.
downvote count: 0
answers question: http://stackoverflow.com/q/23969953
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/37052846
has text: You are passing using key `places` but retrieving using `nvp`. Why?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24035311

http://stackoverflow.com/q/24003774
downvote count: 0
has title: Jfugue: Improper MusicXML Format
has comment: http://stackoverflow.com/comment/83063336
score: 2
tagged with: musicxml
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/39637776
type: Question
has body: I'm working on a personal project in Java and I'm using JFugue to simplify music generation and playback. I'm trying to output a MusicXML file for each of my saved MIDI files so They can be viewed in Finale NotePad, but the MusicXML files that are output don't seem to be properly formatted. They end abruptly like so: "... /0.0 <". Here is the code I'm using to write the files: System.out.print("Enter name of MIDI file: "); String midi = scan.next(); try { Pattern pat = player.loadMidi(new File(midi + ".mid")); MidiParser parser = new MidiParser(); MusicXmlRenderer renderer = new MusicXmlRenderer(); FileWriter writer = new FileWriter(midi + ".xml"); parser.addParserListener(renderer); parser.parse(player.getSequence(pat)); writer.write(renderer.getMusicXMLString()); writer.close(); } catch(InvalidMidiDataException e) { System.out.println(e.toString()); } catch(IOException e) { System.out.println(e.toString()); }
tagged with: jfugue

http://stackoverflow.com/q/24083116
has title: How do I keep latest of three setter values
has comment: http://stackoverflow.com/comment/37141382
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37150322
type: Question
has comment: http://stackoverflow.com/comment/37205941
score: -1
tagged with: xpages
has answer: http://stackoverflow.com/a/24083178
answer count: 3
has body: I am maintaining an XPages application. There is a "ServiceCost" object which has a field named "BudgetCode" and this has a corresponding field in the database. The problem I have is that the interface has three tabs each displaying the ServiceCost object values and its BudgetCode field and when I amend the BudgetCode field in the first tab the objects setter "SetBudgetCode" is called three times and over writes the new value with the old value from the second and third tab. How do I keep the new value? That is how do I keep the value the first call to the "setBudgetCode" setter creates? Thank you Here is the tab controller showing the three relevant tabs; &lt;xe:djTabContainer id="ContracttabbedPanel" title="container" style="width: 100%;" persist="true" tabPosition="top" doLayout="false" rendered="#{ServiceSpendController.initialstagecomplete}"&gt; &lt;xe:djTabPane title="Baseline" id="tab_baseline"&gt; &lt;xc:ContractBaseline&gt;&lt;/xc:ContractBaseline&gt; &lt;/xe:djTabPane&gt; &lt;xe:djTabPane title="Planned" id="tab_planned"&gt; &lt;xc:ContractPlanned&gt;&lt;/xc:ContractPlanned&gt; &lt;/xe:djTabPane&gt; &lt;xe:djTabPane title="Actual" id="tab_actual"&gt; &lt;xc:ContractActual&gt;&lt;/xc:ContractActual&gt; &lt;/xe:djTabPane&gt; &lt;/xe:djTabContainer&gt; And here is the XPage code for the budgetCode field; &lt;xp:inputText id="editBudgetCode" value="#{rowData.budgetCode}" style="width:75.0px" required="true"&gt; &lt;xp:this.attrs&gt; &lt;xp:attr name="triggeringhandlerid" value="btnsavehandlerid"&gt; &lt;/xp:attr&gt; &lt;xp:attr name="triggeringhandlerid" value="btnbaservicespendrecalculatehandler"&gt; &lt;/xp:attr&gt; &lt;xp:attr name="invalidstring" value=""&gt; &lt;/xp:attr&gt; &lt;xp:attr name="message" value="Baseline Tab - Budget Code. This field cannot be null"&gt; &lt;/xp:attr&gt; &lt;xp:attr name="friendlyname" value="Budget Code"&gt; &lt;/xp:attr&gt; &lt;xp:attr name="insertfieldid" value="dspService"&gt; &lt;/xp:attr&gt; &lt;xp:attr name="tab" value=…
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24083525
has answer: http://stackoverflow.com/a/24083190
accepted answer: http://stackoverflow.com/a/24083525
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24083178

http://stackoverflow.com/comment/127416769
comment on: http://stackoverflow.com/a/44950496
type: Comment
has text: worked for me, thats simplest answer
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37017777
type: Comment
comment on: http://stackoverflow.com/a/23997405
has text: Thanks for the information. I'm trying to mavenize my project, but when I click "Mavenize" from the contextual menu on my project, I get the warning dialog box, but then nothing happens. It does not create a pom.xml file. I see no error in the error console.
type: AnswerComment
score: 0

http://stackoverflow.com/a/58776522
upvote count: 2
has body: There is no longer a direct task that will decompile Minecraft with Forge for Minecraft 1.14. You can cause the sources to be generated by running the eclipse task. First, make sure the eclipse plugin is applied in build.gradle: apply plugin: 'eclipse' Next, run the eclipse task and let it run: ./gradlew eclipse Now the Minecraft sources should be in an output.jar located at: Linux: ~/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/&lt;MC VERSION&gt;-&lt;TIMESTAMP&gt;/joined/patch/output.jar Windows: C:\Users\&lt;USER&gt;\.gradle\caches\forge_gradle\minecraft_user_repo\mcp\&lt;MC VERSION&gt;-&lt;TIMESTAMP&gt;\joined\patch\output.jar
downvote count: 0
answers question: http://stackoverflow.com/q/24025097
type: Answer
score: 2

http://stackoverflow.com/a/24081425
accepted answer of: http://stackoverflow.com/q/24081386
score: 4
answers question: http://stackoverflow.com/q/24081386
has body: Control-N and start typing the class name works for me. Control-Shift-N does the same trick, but for file names. Selecting in the source window will open the class in the left explorer pane. Much easier.
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/23975112
has comment: http://stackoverflow.com/comment/36939913
linked to: http://stackoverflow.com/q/2458495
favorite count: 0
accepted answer: http://stackoverflow.com/a/23975335
has comment: http://stackoverflow.com/comment/36940195
tagged with: bit
downvote count: 1
has answer: http://stackoverflow.com/a/23975335
type: AnsweredQuestion
upvote count: 0
tagged with: java
score: -1
type: Question
has body: I'm assigned with a task to pass a byte containing all ones ( 11111111 ) from an Android device to a remote Bluetooth device. The remote device is being coded in C. Since we don't have unsigned representation in Java, I wanted to know if it's possible to send this specific byte. I've searched through different posts (i.e. this), but haven't yet found a good solution. To be more clear: the remote Bluetooth device wants to see a byte with 8 bits, all have been set to ONE (as a part of its protocol).
has comment: http://stackoverflow.com/comment/36939667
has comment: http://stackoverflow.com/comment/36939892
has title: Possibility of working with unsigned Byte in Android
tagged with: bluetooth
tagged with: byte
tagged with: android
answer count: 1

http://stackoverflow.com/comment/102472506
type: AnswerComment
comment on: http://stackoverflow.com/a/58003593
type: Comment
has text: I don't have any code like this anymore to test your solution, I'd have to dig very deep in "the archives". It look good though. Thanks for your help after al these years :)
score: 1

http://stackoverflow.com/comment/37168350
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24097251
has text: please read **Collections#reverse** method

http://stackoverflow.com/comment/36955231
type: Comment
score: 2
has text: `scanner.close()` will close the standard `System.in` stream as well. close it in the end only.
comment on: http://stackoverflow.com/q/23983190
type: QuestionComment

http://stackoverflow.com/comment/37058351
type: QuestionComment
comment on: http://stackoverflow.com/q/24038156
has text: This is the same question I am asking, as far dependencies is consider I think its rite. Exception "java.lang.NoClassDefFoundError:" in eclipse is solved by adding .jar to classpath. So how it is managed through Maven.
score: 0
type: Comment

http://stackoverflow.com/comment/36928641
comment on: http://stackoverflow.com/a/23968488
type: Comment
has text: OK I fixed some errors, but it sends null when using `onDestroy()`, and send json with "client" "close" string when calling it from another place, not from `onDestroy()`
score: 0
type: AnswerComment

http://stackoverflow.com/q/24030470
type: Question
has comment: http://stackoverflow.com/comment/37046987
has body: I need to use JUnit in Eclipse (Eclipse IDE for C/C++ Developers; Version: Kepler Service Release 1; Build id: 20130919-0819) environment on Ubuntu 10.04 OS for a core Java project adopting TDD technique. I have Eclipse installed in Ubuntu 10.04 machine, but JUnit is not there. I tried to install with the following 2 methods: Launch Eclipse > "Help" > "Check for Updates". But there are no JUnit plug-in tool test of anything related to JUnit at all. (Source : http://www.javaboardtest.com/gettingstarted.htm) In a different approach which says start eclipse with root user, I could not find write command to run eclipse from terminal. I am not sure from what source/how the eclipse is installed (Source : http://codespin.blogspot.in/2008/01/enabling-junit-testing-in-eclipse-for.html). When I try to run Eclipse in the terminal I get the following error: $ sudo eclipse sudo: eclipse: command not found $ eclipse The program 'eclipse' is currently not installed. You can install it by typing: sudo apt-get install eclipse-platform And I don't have javac installed and want to use Eclipse alone for JUnit. pls guide me to get through this (may be with some useful link). thanks..
has comment: http://stackoverflow.com/comment/37052348
has comment: http://stackoverflow.com/comment/37044053
tagged with: ubuntu
tagged with: tdd
score: 0
has comment: http://stackoverflow.com/comment/37044953
has comment: http://stackoverflow.com/comment/37049440
tagged with: junit
has comment: http://stackoverflow.com/comment/37043720
has comment: http://stackoverflow.com/comment/37045634
has comment: http://stackoverflow.com/comment/37049322
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/37043826
has comment: http://stackoverflow.com/comment/37045270
tagged with: java
has comment: http://stackoverflow.com/comment/37043712
has comment: http://stackoverflow.com/comment/37043727
has comment: http://stackoverflow.com/comment/37043887
tagged with: eclipse
has title: install JUnit eclipse ubuntu 10.04
has comment: http://stackoverflow.com/comment/37052015

http://stackoverflow.com/a/24066525
type: Answer
has comment: http://stackoverflow.com/comment/37111619
score: 0
answers question: http://stackoverflow.com/q/24066487
has body: This is because findViewById can return a null value if the input id isn't found in the xml layout file. Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle). Returns The view if found or null otherwise. I suggest you to check if you attach the right layout file, and if there is inside of it the correct id. Also check for rootview not being null (you can check this using a if(rootview == null))

http://stackoverflow.com/a/24089886
score: 0
type: Answer
has body: You have to add the line Main-Class: MyPackage.MyClass to the MANIFEST.MF file inside the META-INF folder of your jar file. And change the package and class name to your names of course. See also http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html for details.
answers question: http://stackoverflow.com/q/24089838

http://stackoverflow.com/q/23941683
has comment: http://stackoverflow.com/comment/36877684
has title: How to improve ugly catch block using exception instanceof
has comment: http://stackoverflow.com/comment/36877686
has answer: http://stackoverflow.com/a/23941883
upvote count: 3
has comment: http://stackoverflow.com/comment/36878056
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/36877678
type: UnansweredQuestion
has body: Please pay attention: caller throws parentexception only!! Say that aexception, and bexception inherit from parentexception. In method af, it throws aexception, bexception and parentexception. void af() throws aexception, bexception, parentexception {} The method caller calls af and throw parentexception only. void caller() throws parentexception Here we lost the information of subclasses of parentexception. The method rootCaller calls the method caller and rootcaller can only catch parentexception thrown by caller and using the following exception process catch block: void rootCaller() { try { caller(); } catch(parentexception e) { if(e instanceof aexception) { ...... } else if(e instanceof bexception) { ...... } else if(e instanceof parentexception) { ...... } else { ...... } } This is so ugly and very easy to forget some subclass of parentexception if the subclasses are too many. Is there anyway to improve such code? Current answer can not give me any idea: 1, rootCaller cannnot use multi-catch to simplify the process cause caller only throw parentexception. 2, because caller only throw parentexception, there is not any other exception check if the af is changed latter to throws more than aexception and bexception, say cexception.
has comment: http://stackoverflow.com/comment/36877760
has comment: http://stackoverflow.com/comment/36877919
score: 1
favorite count: 0
tagged with: instanceof
type: Question
tagged with: exception
tagged with: inherited
downvote count: 2

http://stackoverflow.com/comment/36955321
type: Comment
type: QuestionComment
has text: Your `while` loop is devoid of functionality.
comment on: http://stackoverflow.com/q/23983230
score: 0

http://stackoverflow.com/comment/37110094
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24066023
has text: Yeah Maybe it does. But I might have played with the formatting/settings and now cannot find the option to have it so it replaces it.
score: 0

http://stackoverflow.com/comment/36921384
comment on: http://stackoverflow.com/a/23964689
type: AnswerComment
score: 0
type: Comment
has text: Does the y value represent the accumulator value?

http://stackoverflow.com/a/24087776
has body: There could be many statements in this that might result in NullPointer. As the comments suggest its difficult to identify without the trace. However the most probable place would be // Getting JSON Array node contacts = jsonStr.getJSONArray(TAG_CONTACTS); // looping through All Contacts for (int i = 0; i &lt; contacts.length(); i++) { ... } There might not be a TAG-CONTACTS json array and the contacts object might be null.. and inside the loop you are trying to get length. If the object is null the for-loop could result in NPE.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24084145

http://stackoverflow.com/q/24028581
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37041359
type: Question
has comment: http://stackoverflow.com/comment/37040865
has answer: http://stackoverflow.com/a/24029104
score: 0
has comment: http://stackoverflow.com/comment/37041219
answer count: 1
has title: HttpResponse response = client.execute(httpGet), the code after httpresponse doesn't run
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/37040731
favorite count: 0
has body: I've try to get data from my web /http://localhost/android_connection/getHttpGet.php which follow the code from this site,http://www.thaicreate.com/mobile/android-httpget-httppost.html. The result of "/http://localhost/android_connection/getHttpGet.php" just after following this line : Server Date/Time : 2014-06-04 04:28:49 I'm using Xampp for my localhost. In android programming the code after >> HttpResponse response = client.execute(httpGet) doesn't run by catching log.e. Log.e("error1.1","Before try"); and Log.e("error1.2","Before HttpResponse"); only appear on my LogCat. I don't know how to fix plz help me, by the way i'm a beginner in programming of using webserver via android application. public class MainActivity extends Activity { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Permission StrictMode if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } final TextView result = (TextView) findViewById(R.id.result); final Button btnGet = (Button) findViewById(R.id.btnGet); btnGet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String url = "http://localhost/android_connection/getHttpGet.php"; String resultServer = getHttpGet(url); result.setText(resultServer); } }); } public String getHttpGet(String url) { StringBuilder str = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); Log.e("error1.1","Before try"); try { Log.e("error1.2", "Before HttpResponse"); HttpResponse response = client.execute(httpGet); Log.e("error1.3", "End of HttpResponse"); StatusLine statusline = response.getStatusLine(); int statusCode = statusline.getStatusCode(); if (statusCode == 200) { // Status OK HttpEntity entity = res…
has comment: http://stackoverflow.com/comment/37041335
type: UnansweredQuestion
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/37041027

http://stackoverflow.com/comment/37073035
comment on: http://stackoverflow.com/a/24038609
type: AnswerComment
score: 0
type: Comment
has text: @Benny Then just use the raw `Class<T>`. See my update

http://stackoverflow.com/q/24038842
type: UnansweredQuestion
tagged with: hamcrest
linked to: http://stackoverflow.com/q/5985610
has answer: http://stackoverflow.com/a/24063420
type: Question
tagged with: testing
tagged with: junit4
tagged with: java
has title: Assert that Collection contains 2 Objects with same property using matchers
has body: I have the following scenario, where I want to test someFunction(): Collection&lt;MyObject&gt; objects = someFunction(someInput); assertThat(objects , contains(hasProperty("property", is(propertyIWantToTest)))); This works fine if Collection&lt;MyObject&gt; objects should have just 1 MyObject object according to someInput which is passed to someFunction(). However, there are some cases for someInput that the Collection&lt;MyObject&gt; objects should have 2 or more MyObject object containg the same propertyIWantToTest object. Is there a way to use Hamcrest matchers to test that? Here's something closer to what I'm willing to achieve: assertThat(objects , contains(exactlyTwoTimes(hasProperty("property", is(propertyIWantToTest)))));
score: 0
duplicate of: http://stackoverflow.com/q/5985610
answer count: 1
tagged with: junit

http://stackoverflow.com/q/24033829
tagged with: java
has body: I'm following this blog post about using Lists and Maps as Constructors. Why does following list fail to coerce to object? class Test { static class TestObject { private int a = 1; protected int b = 2; public int c = 3; int d = 4; String s = "s"; } static main(args) { def obj = [1, 2, 3, 4, 's'] as TestObject } } I get this exception: Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[1, 2, 3, 4, s]' with class 'java.util.ArrayList' to class 'in.ksharma.Test$TestObject' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: in.ksharma.Test$TestObject(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String) org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '[1, 2, 3, 4, s]' with class 'java.util.ArrayList' to class 'in.ksharma.Test$TestObject' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: in.ksharma.Test$TestObject(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String) at in.ksharma.Test.main(Test.groovy:22)
type: Question
answer count: 2
has title: How to coerce Groovy list into object?
score: 4
tagged with: groovy
has answer: http://stackoverflow.com/a/24051207
favorite count: 0
possible better answer: http://stackoverflow.com/a/24051207
has answer: http://stackoverflow.com/a/24033884
accepted answer: http://stackoverflow.com/a/24033884
upvote count: 4
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/23914211

http://stackoverflow.com/comment/36914279
score: 0
type: Comment
has text: @NickMedovich As you should, he beat me to it :).
comment on: http://stackoverflow.com/a/23961019
type: AnswerComment

http://stackoverflow.com/q/23964967
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36946212
type: Question
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36946121
tagged with: japplet
has title: ActionListener only responding once
tagged with: timer
answer count: 0
has body: I have created a basic Roulette wheel in Java, and I have a JButton with an ActionListener that spins the wheel. Once I have pressed the button once, it works as intended. The problem is: Once I press the JButton a second time, it no longer works. I will post my entire code, for anyone who wants to see exactly what I mean. Bonus Points: Bonus points to whoever can help me with the following things: Buttons don't appear until after you have either clicked them, or put the window in the background and brought it back up. For some reason, the spin ALWAYS lands on red. I have a method called randomSpin() which produces an int that is either 21 or 22, and that method DOES work, but for some reason when it's used in the spin method , it always spins 21 times. WheelBuilder import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import java.lang.*; public class WheelBuilder extends JApplet{ public int total = 1000, score, Tbet = 100, last; public JLabel winning; public JButton spin, Abet, Sbet; RouletteWheel wheel = new RouletteWheel(); Graphics page; public Color color; public void init() { resize(540,600); spin = new JButton("SPIN!"); spin.addActionListener(new spinListener()); Container cp = getContentPane(); cp.setVisible(true); cp.setBackground((Color.GREEN).darker().darker()); Abet = new JButton("+BET+"); Abet.addActionListener(new aListener()); Sbet = new JButton("-BET-"); Sbet.addActionListener(new sListener()); cp.add(Sbet); cp.add(spin); cp.add(Abet); cp.setLayout(new FlowLayout(270, 5, 525)); } public void paint(Graphics page) { page.setColor((Color.GREEN).darker().darker()); page.fillRect(0, 0, 1000, 1000); setBackground((Color.GREEN).darker().darker()); wheel.paintWheel(page, wheel.getStatus()); page.setColor(Color.BLACK); page.drawString("TOTAL: "+total, 400, 50); page.drawString("Current Bet: "+Tbet, 400, 25); page.drawString("Last Spin:", 50, 25); page.setCo…
type: UnansweredQuestion
upvote count: 1
tagged with: swing
tagged with: actionlistener

http://stackoverflow.com/a/24019589
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24019504
has comment: http://stackoverflow.com/comment/37023958
type: Answer
answers question: http://stackoverflow.com/q/24019504
score: 1
upvote count: 1
has body: Can you iterate through it? for (int i=0;i&lt;=255;i++) { String destination = "74.125.24." + i; InetAddress address = InetAddress.getByName(destination); if (address == null) // Or any exception. continue; String resolvedHost = address.getHostName(); System.out.println("Translated " + destination + " to host name " + resolvedHost); }
has comment: http://stackoverflow.com/comment/37023154
type: AcceptedAnswer

http://stackoverflow.com/comment/37125567
type: QuestionComment
comment on: http://stackoverflow.com/q/24074615
has text: Please clean your project
score: 0
type: Comment

http://stackoverflow.com/comment/37049483
type: QuestionComment
has text: I am not sure that understand your point. In general I have array of org.apache.http.message.BasicHeader that I am going to set to my restful client. My goals is to verify whether array contains correct values before client will be called with junit test. The idea was to implement this using hamcrest as it is really readable. But unfortunatly this approach does not work in my case. I am new in hamcrest, and it's possible that I've made some mistakes in my assert. Will be good if you recomended much more suite library for such things .
type: Comment
comment on: http://stackoverflow.com/q/24032092
score: 0

http://stackoverflow.com/comment/37359028
type: Comment
has text: even if i have a ssh key without passphrase (not sure how that can be possible - i always are asked for a passphrase), i need to add the key anyway to a agent. Is there a benefit i do not see without a passprase? The NPE causes on the `maven-release-plugin` in version `2.0-beta-9` i will try to upgrade the plugin.
comment on: http://stackoverflow.com/a/24171379
type: AnswerComment
score: 0

http://stackoverflow.com/a/23978037
answers question: http://stackoverflow.com/q/23975205
type: Answer
has comment: http://stackoverflow.com/comment/36972844
has comment: http://stackoverflow.com/comment/36962623
score: 20
has body: LocalDate handles the proleptic gregorian calendar only. From its javadoc: The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable. In contrast, the old java.util.GregorianCalendar class (which is indirectly also used in toString()-output of java.util.Date) uses a configurable gregorian cut-off defaulting to 1582-10-15 as separation date between julian and gregorian calendar rules. So LocalDate is not useable for any kind of historical dates. But bear in mind that even java.util.GregorianCalendar often fails even when configured with correct region-dependent cut-off date. For example UK started the year on March 25th before 1752. And there are many more historical deviations in many countries. Outside of Europe even the julian calendar is not useable before introduction of gregorian calendar (or best useable only from a colonialist perspective). UPDATE due to questions in comment: To explain the value -14830974000000 let's consider following code and its output: SimpleDateFormat format = new SimpleDateFormat("MMddyyyy", Locale.US); format.setTimeZone(TimeZone.getTimeZone("America/New_York")); Date d = format.parse("01011500"); long t1500 = d.getTime(); long tCutOver = format.parse("10151582").getTime(); System.out.println(t1500); // -14830974000000 System.out.println(tCutOver); // default gregorian cut off day in "epoch millis" System.out.println((tCutOver - t1500) / 1000); // output: 2611699200 = 30228 * 86400 It should be noted that the value -12219292800000L mentioned in your earlier comment is different by 5 hours from tCutOver due to timezone offset difference between America/New_York …
downvote count: 0
has comment: http://stackoverflow.com/comment/36972708
upvote count: 20

http://stackoverflow.com/a/23965771
has comment: http://stackoverflow.com/comment/36923519
has body: In the NotEnoughMoney method, "if (this.paymentSum == 0)" should be closed before "if (this.paymentSum &lt; this.price)", but instead, the former encompasses the latter. When I fixed this, it worked
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23965585
type: Answer
answers question: http://stackoverflow.com/q/23965585
score: 1
upvote count: 1

http://stackoverflow.com/comment/37012167
has text: No problem, it can be confusing if one isn't used to seeing the "this()" constructor call :)
comment on: http://stackoverflow.com/a/24013614
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24019896
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24019845
downvote count: 0
has body: You can used array-based access as follows: &lt;c:out value="${colors[0]}" /&gt;

http://stackoverflow.com/comment/37240456
type: Comment
has text: sorry, it doesnt, i answered too quickly
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24063655

http://stackoverflow.com/comment/36912033
type: Comment
comment on: http://stackoverflow.com/a/23959928
has text: yes, seems problem was this + using JRE1.6 , changed it to 1.7 and It worked, thanks all, wish could accept all answers. i just update the code when im done fixing it all
type: AnswerComment
score: 0

http://stackoverflow.com/q/24022219
has body: I am working in a cluster Quartz/Spring Batch environment and I need to invoke a number of shell scripts at various time of the day. The administrator do not want us to maintain the scripts on all the Spring Batch machines and they do not want o use a shared filing system. I was thinking about storing the shell scripts in the database, but I have not been able to figure out how to replace ProcessBuilder(commandFile) the commandFile with a byte stream. Any suggestions?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24022311
tagged with: processbuilder
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37028506
has comment: http://stackoverflow.com/comment/37029500
type: Question
has title: Invoking a Command from Database String

http://stackoverflow.com/comment/36960546
comment on: http://stackoverflow.com/q/23985859
has text: i resolved, i change the connector-java-5.0.8 to 3.1.14 ! thanks for your answer!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24092843
tagged with: swing
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24092953
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37160136
possible better answer: http://stackoverflow.com/a/24092900
has comment: http://stackoverflow.com/comment/37160179
has comment: http://stackoverflow.com/comment/37160116
has answer: http://stackoverflow.com/a/24092953
has body: I am attempting to take certain words from a text file and display them in a JComboBox. I am trying to use the SplitString() method, but it doesn't seem to be working. Currently the text file is like this. Course Code - Course description - Examiner - Moderator I am trying to split it so the JComboBox will only show: Course Code - Course description This is the code I am using (please excuse the mess and lack of best practice, I am new to this and trying to learn). package messingwithswing; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.border.EmptyBorder; public class ReportGUI extends JFrame{ //Fields private JButton viewAllReports = new JButton("View All Program Details"); private JButton viewPrograms = new JButton("View Programs and Majors Associated with this course"); private JButton viewTaughtCourses = new JButton("View Courses this Examiner Teaches"); private JLabel courseLabel = new JLabel("Select a Course: "); private JLabel examinerLabel = new JLabel("Select an Examiner: "); private JPanel panel = new JPanel(new GridLayout(6,2,4,4)); private ArrayList&lt;String&gt; nameList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; courseList = new ArrayList&lt;String&gt;(); public ReportGUI(){ reportInterface(); allReportsBtn(); examinnerFileRead(); // courseFileRead(); comboBoxes(); } private void examinnerFileRead(){ try{ Scanner scan = new Scanner(new File("Course.txt")); while(scan.hasNextLine()){ String getname = scan.nextLine(); String[] names = getname.split("-"); courseList.add(scan.nextLine()); String name = names[0]; String course = names[1]; } scan.close(); } catch (FileNotFoundException e){ e.printStackTrace(); } } // private void courseFileRead(){ // try{ // Scanner scan = new Scanner(new File("Course.txt")); // // while(scan.hasNextLine()){ // courseList.add(scan.nextLine()); // } // scan.close(); // } // catch (FileNotFoundException e){ // e.printStackTrace()…
score: 0
has answer: http://stackoverflow.com/a/24092900
has comment: http://stackoverflow.com/comment/37160140
has title: Split String read from text file, passed into ArrayList, then displayed in JComboBox - Java Swing
has comment: http://stackoverflow.com/comment/37160131

http://stackoverflow.com/a/24039387
has body: There is no reason why the compose method has to come from the Function interface. For your case the Function interface is not appropriate as Function has a return value (rather than void) and it’s compose method is intended to feed the result of one function into the next. Just make your own compose method: @FunctionalInterface public interface A { void doIt (); default A compose(A next) { return () -&gt; { doIt(); next.doIt(); }; } } Then you can do as intended: Stream&lt;A&gt; as=…; A composed = as.reduce (() -&gt; {}, A::compose); Note that since your interface has the same semantic as Runnable you could even make it a sub-interface of Runnable to allow mixing of Runnables and As: @FunctionalInterface public interface A extends Runnable { default void doIt() { run(); } default A compose(Runnable next) { return () -&gt; { doIt(); next.run(); }; } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37060396
type: Answer
has comment: http://stackoverflow.com/comment/37077854
upvote count: 7
accepted answer of: http://stackoverflow.com/q/24038947
has comment: http://stackoverflow.com/comment/37060319
answers question: http://stackoverflow.com/q/24038947
score: 7

http://stackoverflow.com/q/23992191
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: annotations
type: Question
tagged with: jackson
upvote count: 1
has body: Trying to map a JSON to a Java Class with the help of Spring. I have a JSON Object which consists of flag as a key, and depending on its value of true or false, I need to fill the java classes which has a parent-child relationship amongst them. class Parent { String name; String alias; } class Child extends Parent { ArrayList&lt;Node&gt; nodes; } If the value of flag is true then the JSON will contain nodes. So it should map the nodes to a variable declared in a child class. if the value of flag is false then the JSON should fill the parent class. Also I have tried the following solution given on many websites :- @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT, property = "flag") @JsonSubTypes({ @JsonSubTypes.Type(value=Child.class, name="true"), }) But while returning a JSON from my Rest Service it returns the name of the class in JSON.
favorite count: 0
has comment: http://stackoverflow.com/comment/36976873
has comment: http://stackoverflow.com/comment/36974320
tagged with: spring
has title: Mapping a JSON to Parent - Child Java Object

http://stackoverflow.com/q/24052333
type: Question
score: 0
answer count: 1
tagged with: facebook-rest-api
has comment: http://stackoverflow.com/comment/37084894
has comment: http://stackoverflow.com/comment/37084699
has answer: http://stackoverflow.com/a/24052524
linked to: http://stackoverflow.com/q/19332821
has title: Authenticate REST API services in java
has comment: http://stackoverflow.com/comment/37085185
has comment: http://stackoverflow.com/comment/37086413
has comment: http://stackoverflow.com/comment/37085667
has body: I have created a restful service using jersey in java.The API tested with HTTP client as well. its working fine.I need to secure my API with username and password. anyone can help me out to do this.. Thanks in advance.
tagged with: jira-rest-api
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/19332821
has comment: http://stackoverflow.com/comment/37086230
tagged with: java
tagged with: authentication

http://stackoverflow.com/a/47597681
upvote count: 1
answers question: http://stackoverflow.com/q/24029027
score: 1
has body: The documentation seems to be incomplete about the Containing (IsContaining, Contains) key word. https://dzone.com/refcardz/core-spring-data extends the documentation as follows: CONTAINING: Containing, IsContaining, Contains (String or collection types only) So you are able to use the Containing key word as a replacement for member of. For example: // select e from MyEntity e where ?1 member of e.entities findByEntitiesContaining(TypeOfMember member);
downvote count: 0
type: Answer

http://stackoverflow.com/q/24006647
has comment: http://stackoverflow.com/comment/36999432
favorite count: 0
has comment: http://stackoverflow.com/comment/36999690
has title: when implementing a binary search in Java, is using ArrayList.sublist considered 'in place'?
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36999501
possible better answer: http://stackoverflow.com/a/24006940
has comment: http://stackoverflow.com/comment/36999454
has comment: http://stackoverflow.com/comment/36999535
has answer: http://stackoverflow.com/a/24006966
type: AnsweredQuestion
has body: The question is pretty much as stated in the title. I'm in an algorithms course and the professor and I disagree regarding whether or not operations performed on an ArrayList sublist (a sublist generated by ArrayList.sublist) can be considered 'in place'. To my read of the Java API: Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned list is empty.) The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa. The returned list supports all of the optional list operations. you are still manipulating the 'master' ArrayList directly. To his view, you are copying references from the 'master' array into a new sub-array which means employing ArrayList.subList is not considered 'in place'. Obviously, for the purposes of the course what he says goes (that is, if I want to pass :-/) but I would like to know either way for my own growth as a programmer. Code is below - and thank you! public static int findK (int findME, int mVal, ArrayList&lt;Integer&gt; arr) { // pre stage return variable int returnVal = -1; // make a subarray consisting of indexes 0 - ((m-2)+(m-1)). // this because the relationship between the m, p, and q // is p&gt;q&gt;m - therfore the max value of q is m-1 and the // max value of p is m-2. int newArrSize = (mVal-2) + (mVal-1); ArrayList&lt;Integer&gt; subArr = new ArrayList&lt;Integer&gt;(arr.subList(0, newArrSize)); // make the list smaller by looking at only the last [mVal] // elements. this because we know what we're looking for // has to be in the second section of the array, and that // section can't possibly be larger than mVal int fromIndex = subArr.size() - mVal; subArr = new ArrayList&lt;Integer&gt; (subArr.subList(fromIndex, subArr.size())); // at this point we can do a simple binary search, which on an // a sorted array of size mVal is lg(m) while (subArr.size() &gt…
accepted answer: http://stackoverflow.com/a/24006966
upvote count: 1
has comment: http://stackoverflow.com/comment/36999918
type: Question
has comment: http://stackoverflow.com/comment/36999583
has comment: http://stackoverflow.com/comment/36999732
has comment: http://stackoverflow.com/comment/36999528
has answer: http://stackoverflow.com/a/24006943
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36999667
linked to: http://stackoverflow.com/q/16644811
tagged with: binary-search
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/24006940
tagged with: sublist

http://stackoverflow.com/comment/37107459
type: AnswerComment
type: Comment
has text: Thanks for your reply, but I don’t think can solve my issue. config browser only can help me know which action I configured. But can’t help me know whether was used in my system. What I want is : Is any tool can help scan all reachable link from index.html, it’s similar to what google dose. When I know which link I already used. E.g. test1.html, test2.html…. I also can use this tool to search my action class, if I found test3 which not existing in my use link list (test1,test2). I can trade this action is unused and delete this method.
comment on: http://stackoverflow.com/a/24056857
score: 0

http://stackoverflow.com/comment/36914234
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23960212
has text: Values are correctly printing @blurfus. Please help me..

http://stackoverflow.com/a/24080968
accepted answer of: http://stackoverflow.com/q/24080387
score: 0
answers question: http://stackoverflow.com/q/24080387
type: AcceptedAnswer
has body: public int [] method (int a) { int [] newarray = new int[count]; for (int i = 1; i &lt;= a; i++) { if (a % i == 0) { for (int m = 0; m &lt; count; m++) { if (newarray[m] == 0) { newarray[m] = a/i; break; } } break;//Depending on your wanted solution } } return newarray; } I've assumed that whenever an array-index contains a 0 it's uninitialized, and is considered empty. In your original code, the second for-loop would overwrite the first index in the array every time. The if-statement I've added ensures that it only adds a number in an available slot. I've also added a second break; Since you have two for-loops you need two breaks to completely get out of the loops. I didn't understand from your question whether or not this was something you wished for. Therefore, you have to decide whether or not to keep it in. Edit: Let's say this your array newarray when count == 10 0 0 0 0 0 0 0 0 0 0 This is what happens in you second for-loop: for (int m = 0; m &lt; count; m++) { newarray[m] = a/i; break; } First time in the loop is when m == 0 and so the lines that are executed are newarray[0] = a/i; break; Then, because of the break; the program will exit the loop. What value a/i varies, but in this example, let's say a/i is 8. Therefore, newarray now looks like this: 8 0 0 0 0 0 0 0 0 0 Next time your program enters the second for-loop the exact same thing will happen. If a/i at that time is, let's say, 3, then we'll get newarray[0] = 3; break; and your array will now look like this 3 0 0 0 0 0 0 0 0 0 As you can see, everytime your code runs, the first index will get overwritten. The if-statement I put in makes sure that it doesn't overwrite unless the array-slot equals 0(since that means it's empty). With the extra if-statement for (int m = 0; m &lt; count; m++) { if (newarray[m] == 0) { newarray[m] = a/i; break; } } the first time around m == 0 newarray[0] is not equal to 0. (from last time: newarray[0] is 3) therefore the code continues to m == 1 newarray[1] is equal to…
type: Answer
has comment: http://stackoverflow.com/comment/37137505

http://stackoverflow.com/comment/36977018
comment on: http://stackoverflow.com/q/23994037
score: 0
type: Comment
type: QuestionComment
has text: i ran this prog and got a normal output like textfield at top then buttons under that and then table under that

http://stackoverflow.com/comment/36939697
type: QuestionComment
comment on: http://stackoverflow.com/q/23975093
has text: Have you tried to debug yor program? Which value is null iin line 35 of class Scoreboard?
score: 0
type: Comment

http://stackoverflow.com/comment/67537779
type: Comment
score: 5
type: AnswerComment
comment on: http://stackoverflow.com/a/24078590
has text: This doesn't work. You can't reuse the same instance of FXMLLoader to reload different, or even the same document. Youwill get all sort of errors, like duplicate fx:ids, root is already set, and so on. It is not meant to be used that way.

http://stackoverflow.com/q/24051070
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37082376
tagged with: java
tagged with: mysql
type: Question
has title: Lock mysql database, when insert data more than one user at one time
has comment: http://stackoverflow.com/comment/37082895
has comment: http://stackoverflow.com/comment/37084887
score: 0
tagged with: id-generation
has body: I'm creating an application using Java RMI. In my case, more than 10 users are adding data to the database. My application has a class GenerateID and it's on server side. For every user's id generation process is going through this class. It has a method named generateID() I need to know, if more than one users are inserting data to the database at same time, What will be happening? Thanks in Advance!
answer count: 0

http://stackoverflow.com/comment/36974626
type: QuestionComment
type: Comment
has text: Welcome, to SO. Please tag the question (actually there is no question) with a programming language. Also, it would be helpful to indicate which line gives the error
comment on: http://stackoverflow.com/q/23993691
score: 0

http://stackoverflow.com/comment/37142991
type: AnswerComment
comment on: http://stackoverflow.com/a/24083921
score: 0
type: Comment
has text: Thanks! This is what I'm looking for, I believe!

http://stackoverflow.com/a/23960260
downvote count: 0
answers question: http://stackoverflow.com/q/23960060
has body: In the base class: protected Collection&lt;Foo&gt; collectionUnderTest; @Test public void shouldDoThis() { // uses collectionUnderTest } @Test public void shouldDoThat() { // uses collectionUnderTest } In the subclass, specific to the ACollection implementation: @Before public void prepare() { this.collectionUnderTest = new ACollection&lt;&gt;(); }
score: 5
has comment: http://stackoverflow.com/comment/106180053
has comment: http://stackoverflow.com/comment/36912664
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/118632445
has comment: http://stackoverflow.com/comment/36912526
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/23960060

http://stackoverflow.com/comment/37100575
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24060970
has text: [`Uri.encode()`](http://developer.android.com/reference/android/net/Uri.html#encode%28java.lang.String%29) is probably suited here.

hex
tags question: http://stackoverflow.com/q/24051152
tag name: hex
tags question: http://stackoverflow.com/q/24003631
tags question: http://stackoverflow.com/q/24104063
type: Tag

http://stackoverflow.com/comment/37010884
has text: @JonSkeet Hash collisions should *rarely* occur (see http://en.wikipedia.org/wiki/Collision_attack). For what Phate is trying to do he should be fine, although he may want to use a cryptographic hash
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24012825

foreground
type: Tag
tags question: http://stackoverflow.com/q/24048273
tag name: foreground

http://stackoverflow.com/q/24065975
type: Question
tagged with: spring
tagged with: spring-mvc
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24069294
answer count: 1
has comment: http://stackoverflow.com/comment/37116078
tagged with: spring-aop
type: AnsweredQuestion
has title: Spring AOP:Cannot resolve method to a unique method
has body: Below is the aspect java code: public class ParamAspect { public void beforeMethodExecution(String name){ System.out.println("Name: " + name); } public void beforeMethodExecution(Employee employee){ System.out.println("Employee Name: " + employee.getName()); } } Below is the context.xml file: &lt;aop:config&gt; &lt;aop:pointcut id="empName" expression="execution(void com.model.Employee.setName(String)) and args(name1)"/&gt; &lt;aop:pointcut id="empl" expression="execution(void com.model.Employee.setEmployee(com.model.Employee)) and args(empl)"/&gt; &lt;aop:aspect ref="aspect"&gt; &lt;aop:before pointcut-ref="empName" method="beforeMethodExecution" arg-names="name1"/&gt; &lt;aop:before pointcut-ref="empl" method="beforeMethodExecution" arg-names="empl"/&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; The error I got while executing this is: Caused by: java.lang.IllegalArgumentException: Cannot resolve method 'beforeMethodExecution' to a unique method. Attempted to resolve to overloaded method with the least number of parameters, but there were 2 candidates. at org.springframework.beans.BeanUtils.findMethodWithMinimalParameters(BeanUtils.java:290) at org.springframework.beans.BeanUtils.findMethodWithMinimalParameters(BeanUtils.java:231) at org.springframework.beans.BeanUtils.resolveSignature(BeanUtils.java:332) at org.springframework.aop.config.MethodLocatingFactoryBean.setBeanFactory(MethodLocatingFactoryBean.java:72) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1475) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1443) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) ... 38 more But again, if I change the method name of the aspect from `public void beforeMethodExecution(Employee employee){` To `public vo…
has answer: http://stackoverflow.com/a/24069294

http://stackoverflow.com/a/24030871
score: 0
has body: You can do this: String result; int start = yourString.indexOf("--asset"); if (start != -1) { int end = yourString.indexOf("--", start); if (end != -1) result = yourString.substring(start, end).trim(); }
type: Answer
answers question: http://stackoverflow.com/q/24030489

http://stackoverflow.com/q/24087285
tagged with: arraylist
answer count: 3
accepted answer: http://stackoverflow.com/a/24087363
has title: List is not printing out one of the variables
score: 1
has answer: http://stackoverflow.com/a/24087355
favorite count: 0
type: AnsweredQuestion
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/37149361
upvote count: 1
has answer: http://stackoverflow.com/a/24087363
type: Question
possible better answer: http://stackoverflow.com/a/24087365
has body: The code below stores the radius and value in its list. But when I go to print the values, it only prints the radius not the other variable value. I don't understand why its not printing it out. Here is my code: public class AddingBoth { private double radius; private double value; private List&lt;AddingBoth&gt; list = new ArrayList&lt;AddingBoth&gt;(); public AddingBoth(double radius, double value){ this.radius = radius; this.value = value; list.add(this); } public List&lt;AddingBoth&gt; getList(){ return list; } public double getRadius(){ return radius; } public double getValue(){ return value; } public void print(){ Iterator&lt;AddingBoth&gt; iter = list.iterator(); while(iter.hasNext()){ System.out.println(iter.next().getRadius()+" "); } System.out.println("This is the value; "); while(iter.hasNext()){ System.out.println("Value: "+iter.next().getValue()); } } } And this is where I am calling my class: AddingBoth ab = null; for(int i =0; i&lt; 256; i++){ int y=0; while(y&lt;256){ //image.getPixel(i, y); String x = image.getLocationAsString(i, y); String n = image.getValueAsString(i, y); //System.out.println(x); String delim = ", value="; String [] tokens = n.split(delim); double num = Double.parseDouble(tokens[1]); //if(image.getR() &lt; 1.43){ String [] t = x.split("r="); String[] b = t[1].split(" mm/c"); //System.out.print("Meet b: "+b[0]); double radius = Double.parseDouble(b[0]); String [] theta = x.split("theta= "); String [] token2 = theta[1].split(Character.toString(IJ.degreeSymbol)); float thetaNum = Float.parseFloat(token2[0]); //System.out.print(" This is the theta value: "+thetaNum+" "); ab = new AddingBoth(radius, num); ab.print(); y++; } }
has answer: http://stackoverflow.com/a/24087365
downvote count: 0

http://stackoverflow.com/q/24101565
answer count: 1
tagged with: packaging
score: 0
has comment: http://stackoverflow.com/comment/37177575
type: UnansweredQuestion
has title: How to use referenced libraries in exported JAR
has answer: http://stackoverflow.com/a/24102761
type: Question
has comment: http://stackoverflow.com/comment/37177557
tagged with: java
has body: I am using Gradle, and I need to know how to make sure that users of my Java program have the Gson library installed for use. Is there a way to do so? (I would like to avoid bundling it with my program, but if that's what it has to come to, then ok).
tagged with: gradle

http://stackoverflow.com/comment/37097202
has text: BorderLayout, GridLayout and GridBagLayout
comment on: http://stackoverflow.com/q/24059215
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24088238
tagged with: android
tagged with: animation
has answer: http://stackoverflow.com/a/24088456
has title: How do I return an image after it has been called?
upvote count: 1
possible better answer: http://stackoverflow.com/a/24088297
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24088297
accepted answer: http://stackoverflow.com/a/24088456
score: 1
tagged with: java
tagged with: image
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has body: Here's my code so far. So when I click the image, it moves as expected. Cool. But when I click the image again, it does not move back to the original location. Can someone help? FYI, variable "depends" is at a global scope. Thanks! depends = false; image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (depends){ TranslateAnimation noob = new TranslateAnimation(0, 0, 0, +90); noob.setDuration(1000); noob.setFillAfter(true); image.startAnimation(noob); } else{ TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 0, -90); depends = true; translateAnimation.setDuration(1000); translateAnimation.setFillAfter(true); image.startAnimation(translateAnimation); } } });

http://stackoverflow.com/comment/37095286
score: 0
type: AnswerComment
has text: @PrabhakarManthena No Sir, As mentioned above you have to remove other binding in order to make it work. You can visit the link in answer for more details.
type: Comment
comment on: http://stackoverflow.com/a/24057838

http://stackoverflow.com/q/24026918
tagged with: bytebuffer
favorite count: 0
has body: I am trying to make off-heap memory buffer. I want very big size(like 10GB) buffer. I heard that jvm heap sometimes freeze because full GC. So, I try to make buffer with java.nio.ByteBuffer. But, I met great difficulties! java.nio.ByteBuffer.allocateDirect(int size) function only support integer. but I want bigger size. what can I do? what should I do? please help me stack overflow gurus. my development environment is macbook pro, i7 2.4ghz, 16gb ddr3, 250ssd, osx 10.9, eclipse kepler x64. I try something for solve problem: ByteBuffer buffer = ByteBuffer.allocateDirect(1024*1024*2000); ByteBuffer buffer1 = ByteBuffer.allocateDirect(1024*1024*2000); ByteBuffer buffer2 = ByteBuffer.allocateDirect(1024*1024*2000); ByteBuffer buffer3 = ByteBuffer.allocateDirect(1024*1024*2000); but this is not works. only allocate memory 1024*1024*2000 again please help me.
type: AnsweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24026948
accepted answer: http://stackoverflow.com/a/24026948
type: Question
score: 3
upvote count: 5
tagged with: java
tagged with: nio
has title: JAVA NIO Bytebuffer.allocateDirect() size limit over the int
answer count: 1

http://stackoverflow.com/comment/37028836
type: AnswerComment
score: 0
has text: Thank you very much =), you solution worked, however i found it easier to just echo an `JSONObject`. you have been very helpfull
type: Comment
comment on: http://stackoverflow.com/a/24022218

http://stackoverflow.com/comment/37151666
has text: Typo, it should be a string representing your URL.
type: AnswerComment
comment on: http://stackoverflow.com/a/24085603
score: 0
type: Comment

http://stackoverflow.com/comment/37088454
type: Comment
type: QuestionComment
has text: @BalusC Thank you very much for telling me about the age of the code I am using.I will try to find new resources.I'm a bit lose about where to do the operation.Well, now I have the sum of one row and the total.I do the calc inside the servlet side, and asign the values to the bean.But I want to in jsp add more rows with one button and calculate one total for every row.I can do it with one, but I dont know how to add more.
comment on: http://stackoverflow.com/q/23989299
score: 0

http://stackoverflow.com/q/23947860
downvote count: 4
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23950383
has comment: http://stackoverflow.com/comment/36889725
has comment: http://stackoverflow.com/comment/36890097
has comment: http://stackoverflow.com/comment/36890518
favorite count: 0
has comment: http://stackoverflow.com/comment/36889649
type: UnansweredQuestion
has body: I have a select query on five columns,one of which may or may not contain a value and as hibernate's native sql query always returns an object which is then required to convert using toString(),null pointer exception is encountered. How can i avoid this situation? Here are the code snippets, sql="SELECT * FROM (SELECT t.*,ROWNUM r FROM("+sqlQuery+") t) WHERE r BETWEEN " + intStartIndex + " AND " + intEndIndex; Query query=session.createSQLQuery(sql); ArrayList&lt;Object[]&gt; listResult= query.list(); return listResult; for(int j=0;j&lt;arrColumnMetaData.size();j++){ // where arrColumnMetaData stores the list returned int k-0; Object obj[]=(Object[])arrColumnMetaData.get(j); childBeanObj.setNumCaptureCode(obj[k++].toString()); childBeanObj.setTxtFileName(obj[k++].toString()); childBeanObj.setTxtFileStatus(obj[k++].toString()); childBeanObj.setTxtDocumentCode(obj[k++].toString()); } i am doing something like this.. kindly tell if this is the right approach or suggest if u have a better one.
score: -3
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36889511
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36889738
has comment: http://stackoverflow.com/comment/36889487
has title: How to handle null pointer exception using hibernate native sql query?
has comment: http://stackoverflow.com/comment/36889529

http://stackoverflow.com/q/24022285
has comment: http://stackoverflow.com/comment/37058033
type: Question
has comment: http://stackoverflow.com/comment/37045641
has comment: http://stackoverflow.com/comment/38107353
tagged with: class
score: 0
has title: NoClassDefFoundError loading a twain applet
tagged with: twain
tagged with: applet
has comment: http://stackoverflow.com/comment/37061649
has comment: http://stackoverflow.com/comment/37060914
has body: I downloaded this Java app: http://rsb.info.nih.gov/ij/plugins/twain-scan.html I did not attempt to compile, just downloaded the zip file and extracted into a "plugins" directory as instructed and then created this HTML: I get a NoClassDefFoundError with ij/plugin/PlugIn in the dialog box. I've seen "plugin" and "ij" jar files in other Java apps, but putting them in the plugins folder and referencing them in the "archive" parameter does not seem to help. I plead relative ignorance of Java, so it may be something obvious, but I've poked around with this a while with no luck figuring out what I'm doing wrong. Any help would be greatly appreciated.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37158978
answer count: 0
tagged with: java
tagged with: noclassdeffounderror
has comment: http://stackoverflow.com/comment/37060159

http://stackoverflow.com/a/24025013
downvote count: 0
answers question: http://stackoverflow.com/q/24024888
has body: A final variable cannot be bound to another instance, so this is not valid: final String s = "123"; s = "234"; // doesn't work! A final class cannot be extended final class A { } class B extends A { // does not work! } And both of this is not to be confused with immutable classes (like String). Instances of immutable classes won't change their state. (There is no direct language support for immutable classes, but in practice most of the time all attributes of immutable classes are declared final.)
type: Answer
score: 4
upvote count: 4

http://stackoverflow.com/q/23996609
has answer: http://stackoverflow.com/a/23996713
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23996753
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/23996724
has answer: http://stackoverflow.com/a/23996875
linked to: http://stackoverflow.com/q/22718744
has title: Java split by alphabeta char creates an empty value in array
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/23996701
possible better answer: http://stackoverflow.com/a/23996875
has body: I want to split my string on every occurrence of an alpha-beta character. for example: "s1l1e13" to an array of: ["s1","l1","e13"] when trying to use this simple split by regex i get some weird results: testStr = "s1l1e13" Arrays.toString(testStr.split("(?=[a-z])")) gives me the array of: ["","s1","l1","e13"] how can i create the split without the empty array element? I tried a couple more things: testStr = "s1" Arrays.toString(testStr.split("(?=[a-z])")) does return the currect array: ["s1"] but when trying to use substring testStr = "s1l1e13" Arrays.toString(testStr.substring(1).split("(?=[a-z])") i get in return ["1","l1","e13"] what am i missing?
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36981939
answer count: 5
accepted answer: http://stackoverflow.com/a/23996701
tagged with: regex

http://stackoverflow.com/comment/37036806
score: 0
has text: I'm curious as to how you've determined that `ByteBuffer` is too slow. Have you done performance tests? If so, what?
type: QuestionComment
comment on: http://stackoverflow.com/q/24026494
type: Comment

http://stackoverflow.com/comment/37173663
type: QuestionComment
score: 0
has text: @AbhishekBansal I tried using a list of 1000. An unsorted list takes 0.005885 secs vs 0.005504 secs sorted, making the sorted list slight faster. However, subsequent runs after that are all behaving as expected with a difference of one significant figure. So, you are correct. However, why does the 1st iteration show a sorted list to be faster?
type: Comment
comment on: http://stackoverflow.com/q/24098833

http://stackoverflow.com/comment/37081551
type: QuestionComment
comment on: http://stackoverflow.com/q/24050482
score: 0
has text: try inserting some debug statements
type: Comment

http://stackoverflow.com/a/27944837
downvote count: 0
has body: Just went through this. You can write any file/binary data/output stream using the following code: byte[] bytes = Files.readAllBytes(Paths.get(filePath)); HttpServletResponse raw = res.raw(); raw.getOutputStream().write(bytes); raw.getOutputStream().flush(); raw.getOutputStream().close(); return res.raw();
type: Answer
has comment: http://stackoverflow.com/comment/67535423
answers question: http://stackoverflow.com/q/24099147
has comment: http://stackoverflow.com/comment/87894769
has comment: http://stackoverflow.com/comment/99360719
score: 15
upvote count: 15

http://stackoverflow.com/comment/37076205
comment on: http://stackoverflow.com/a/24047594
score: 0
type: AnswerComment
has text: This should be a comment rather than an answer.
type: Comment

http://stackoverflow.com/comment/37019946
type: QuestionComment
type: Comment
has text: @Vijay Sorry looks like a proxy problem.
score: 0
comment on: http://stackoverflow.com/q/24017685

http://stackoverflow.com/comment/36971325
type: Comment
comment on: http://stackoverflow.com/a/23989759
score: 0
type: AnswerComment
has text: @Alopex: Thanks, fixed the typo. Can you please provide more details about the IllegalArgumentException? for what input does it happen?

http://stackoverflow.com/q/24098652
answer count: 3
has answer: http://stackoverflow.com/a/24098766
has title: Finding occurrences of element before and after the element in Array
has body: I am writing a algorithm: In this algorithm, if an array contains the element 3, the element 3 cannot be between two 1 elements, like this: int array={5, 2, 10, '3', 15, '1', 2, 2} //the ' symbols are just for highlighting the elements in question. The above array contains the element 3, and note that before 3 there is no element 1. But after element 3 there is one element 1, and in this case it should return True. It should return true because the element 3 is not "surrounded" by two elements 1. int array={'3',2,18, >'1' ,0,# 3 #,-11, '1'&lt; ,'3'} //',&lt;,# symbols are just highlighting caracteres. In this array after first element of 3 there is two elements 1, surrounding an element 3, so it should return False. I have tried following code: public class Third { public static void main(String[] args) { int[] array = {1, 2, 4, 3, 1}; //should return false, '3' contained in '1' elements. for(int i=0; i&lt;array.length; i++) { if(array[i]==3) { for(int j=0;j&lt;array[i];j++) { if(array[j]==1) { System.out.println("I foud One before "+array[j]); }else { break; } System.out.println("yes i found the array:"+array[i]); } for(int z=0;z&gt;array[i];z++) { if(array[z]==1) { System.out.println("I found after 3 is :"+array[z]); } break; } } } } } I am not getting exact result from my above code which i want.
has comment: http://stackoverflow.com/comment/37170790
has comment: http://stackoverflow.com/comment/37171489
accepted answer: http://stackoverflow.com/a/24099324
has comment: http://stackoverflow.com/comment/37170828
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37171404
has answer: http://stackoverflow.com/a/24098727
tagged with: java
downvote count: 5
possible better answer: http://stackoverflow.com/a/24098727
has answer: http://stackoverflow.com/a/24099324
tagged with: arrays
score: -4
has comment: http://stackoverflow.com/comment/37170806
favorite count: 0
has comment: http://stackoverflow.com/comment/37170840

http://stackoverflow.com/a/23988995
answers question: http://stackoverflow.com/q/23988837
type: Answer
has body: try this RoundingMode roundingMode = ...; ... BigDecimal bd3 = bd1.divide(bd2, 2, roundingMode);
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36966013
accepted answer of: http://stackoverflow.com/q/23988837

http://stackoverflow.com/comment/37180469
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24102901
type: Comment
has text: No. A JTable is designed to show row/column data. If you have never used a JTable before then read the Swing tutorial on `How to Use Tables` for basic information. You can find a link to the tutorial by reading the JTable API.

http://stackoverflow.com/q/24007711
has answer: http://stackoverflow.com/a/24007904
has comment: http://stackoverflow.com/comment/37001305
tagged with: awt
has comment: http://stackoverflow.com/comment/37001601
has comment: http://stackoverflow.com/comment/37001255
has comment: http://stackoverflow.com/comment/37001221
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37001294
accepted answer: http://stackoverflow.com/a/24007904
tagged with: swing
has comment: http://stackoverflow.com/comment/37001280
has body: I am new in programming and I am looking for a way to add functions on columns of table in java just like MS Excel.
type: AnsweredQuestion
tagged with: java
downvote count: 2
has title: How to add functions on columns of table in Java?
linked to: http://stackoverflow.com/q/14283192
type: Question
has comment: http://stackoverflow.com/comment/37001275
has comment: http://stackoverflow.com/comment/37001326
has comment: http://stackoverflow.com/comment/37001381
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/37001250
tagged with: spreadsheet

http://stackoverflow.com/comment/47261098
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24068959
score: 0
has text: have you solved the issue. I need this. please share

http://stackoverflow.com/comment/36878123
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23941811
score: 0
has text: @hooknc Yes, and you need eyes to see the two question marks in the post but you won't see them when you are over-zealous to down vote.

http://stackoverflow.com/q/23962504
score: -4
has comment: http://stackoverflow.com/comment/36953109
type: Question
answer count: 1
tagged with: string
favorite count: 0
type: UnansweredQuestion
has body: Please tell me that What actually happens in memory area if String st1= "java"; String st2= St1+ "world"; and if Write String st1= new String("java"); then where object will be created and where this "java" will be stored. will it create two object or will it create two memory space ?
downvote count: 4
upvote count: 0
has title: what happens if I write String s1= "java"; String s2= s1+ "world";?
has answer: http://stackoverflow.com/a/23962667
tagged with: java

http://stackoverflow.com/a/24053211
answers question: http://stackoverflow.com/q/24053111
type: Answer
has body: Change your submit button to be a normal button. Listen for the click on this button and within that handler call $('form').submit(); The way you are doing at present will result in recursive submits.
has comment: http://stackoverflow.com/comment/37086326
has comment: http://stackoverflow.com/comment/37086283
score: 0
has comment: http://stackoverflow.com/comment/37086398
has comment: http://stackoverflow.com/comment/37086331

http://stackoverflow.com/comment/36923598
type: QuestionComment
has text: I'm not too sure if this is possible, as (I think) that would mean that you would specify that you're returning an *instance* of a class, rather than a *type*... And I'm not sure that is legal
type: Comment
comment on: http://stackoverflow.com/q/23965922
score: 0

http://stackoverflow.com/a/30539736
type: Answer
has body: I would suggest looking at the sample Java project for getting records from ServiceNow's SOAP API at http://wiki.servicenow.com/index.php?title=Java_Apache_Axis2_Web_Services_Client_Examples#gsc.tab=0 as a reference and then comparing this with your implementation. Also if you need a demo servicenow instance to test against you can sign up for a dev instance at https://developer.servicenow.com/app.do#!/program/developer. Hope that helps, Bryan
score: 0
answers question: http://stackoverflow.com/q/24038981

http://stackoverflow.com/comment/60157206
type: QuestionComment
type: Comment
has text: Possible duplicate of [Iterating through a Collection, avoiding ConcurrentModificationException when removing in loop](http://stackoverflow.com/questions/223918/iterating-through-a-collection-avoiding-concurrentmodificationexception-when-re)
score: 1
comment on: http://stackoverflow.com/q/24085674

http://stackoverflow.com/comment/36923409
type: QuestionComment
has text: I'm not sure if that pointer type is associated with syn-sets, or only words/word indices. I'll look into it
score: 0
comment on: http://stackoverflow.com/q/23965781
type: Comment

http://stackoverflow.com/comment/37126215
comment on: http://stackoverflow.com/a/24074872
type: Comment
type: AnswerComment
has text: That's not the problem. The problem is simply that type doesn't match the type of the variable he's trying to assign it to.
score: 0

http://stackoverflow.com/q/23996097
has answer: http://stackoverflow.com/a/23996827
answer count: 4
linked to: http://stackoverflow.com/q/4645020
upvote count: 2
has answer: http://stackoverflow.com/a/23996423
has answer: http://stackoverflow.com/a/23996930
score: -3
has comment: http://stackoverflow.com/comment/36980096
type: Question
tagged with: matching
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/36979485
has comment: http://stackoverflow.com/comment/36980073
has comment: http://stackoverflow.com/comment/36979582
has body: I am new to java Can anyone help me with the code to tell how much 2 text files match with each other? Suppose i have two Files 'a.txt' and 'b.txt' then i need to know the percentage of match. thanks
has comment: http://stackoverflow.com/comment/36979372
favorite count: 0
linked to: http://stackoverflow.com/q/955110
has answer: http://stackoverflow.com/a/23996254
has comment: http://stackoverflow.com/comment/36980213
type: UnansweredQuestion
has title: Matching two Files in java
linked to: http://stackoverflow.com/q/304268

semaphore
type: Tag
tag name: semaphore
tags question: http://stackoverflow.com/q/24087573

http://stackoverflow.com/a/24026732
type: Answer
upvote count: 1
has body: As @Unihedron says: public static void main(String []args){ int[] x = new int[]{1,2,3,4,5}; int[] z = new int[]{11,22,33,44,55}; for(int i=0; i&lt;x.length; i++){ System.out.print(z[i] + " " + x[i] + " "); } System.out.println(); } Note: As @lpratlong suggests, the above code only works if x.length == z.length. Please treat the code as an example only!
score: 1
has comment: http://stackoverflow.com/comment/37038060
downvote count: 0
answers question: http://stackoverflow.com/q/24026654

http://stackoverflow.com/a/56770873
answers question: http://stackoverflow.com/q/24004959
score: -2
has body: You can made transformer to transform your Pojo( Pojo object from file) to your Entity By making the following code : public class Intializer { public static LGInfo initializeEntity() throws Exception { Constructor&lt;LGInfo&gt; constr1 = LGInfo.class.getConstructor(); LGInfo info = constr1.newInstance(); return info; } } And in your item Processor public class LgItemProcessor&lt;LgBulkLine, LGInfo&gt; implements ItemProcessor&lt;LgBulkLine, LGInfo&gt; { private static final Log log = LogFactory.getLog(LgItemProcessor.class); @SuppressWarnings("unchecked") @Override public LGInfo process(LgBulkLine item) throws Exception { log.info(item); return (LGInfo) Intializer.initializeEntity(); } }
downvote count: 2
type: Answer
upvote count: 0

http://stackoverflow.com/comment/37085674
type: QuestionComment
score: 1
has text: It probably did, but the very act of clicking the menu item probably hide the selection, which is the default behaviour.
comment on: http://stackoverflow.com/q/24052862
type: Comment

http://stackoverflow.com/q/24101142
has comment: http://stackoverflow.com/comment/37175958
type: Question
has comment: http://stackoverflow.com/comment/37176221
answer count: 1
score: 15
accepted answer: http://stackoverflow.com/a/24110306
has comment: http://stackoverflow.com/comment/37175793
tagged with: java
has title: Java fatal error SIGSEGV with no added native code
has comment: http://stackoverflow.com/comment/37182102
upvote count: 15
tagged with: jvm-crash
tagged with: jvm-hotspot
tagged with: segmentation-fault
has body: I am getting an error message from the Java compiler that I don't understand. I've tested my code on OSX 10.6, 10.9, and Ubuntu 14.04, with both Java 6 and 7. When I run with the Eclipse debugger or from the interpreter (using -Xint option), everything runs fine. Otherwise, I get the following messages: Java 1.6: Invalid memory access of location 0x8 rip=0x1024e9660 Java 1.7: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x000000010f7a8262, pid=20344, tid=18179 # # JRE version: Java(TM) SE Runtime Environment (7.0_60-b19) (build 1.7.0_60-b19) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.60-b09 mixed mode bsd-amd64 compressed oops) # Problematic frame: # V [libjvm.dylib+0x3a8262] PhaseIdealLoop::idom_no_update(Node*) const+0x12 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # There's more error output for Java 7 (that is saved to a file) but unfortunately I can't fit it in the character limit of this post. Sometimes I need to run my code a couple of times for the error to come up, but it appears more often than not. My test case involves cacheing some computations in logarithmic scale. Specifically, given log(X),log(Y),..., I have a small class that computes log(X+Y+...). And then I cache the result in a HashMap. Strangely, changing some loop indices seems to make the problem go away. In particular, if I replace for (int z = 1; z &lt; x+1; z++) { double logSummand = Math.log(z + x + y); toReturn.addLogSummand(logSummand); } with for (int z = 0; z &lt; x; z++) { double logSummand = Math.log(1 + z + x + y); toReturn.addLogSummand(logSummand); } then I don't get the error message and the program runs fine. My minimal example is below: import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.…
has comment: http://stackoverflow.com/comment/37175837
has answer: http://stackoverflow.com/a/24110306
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37179750
has comment: http://stackoverflow.com/comment/37175858
favorite count: 0
has comment: http://stackoverflow.com/comment/37177484

http://stackoverflow.com/a/24007505
has body: // You will need these imports import com.microsoft.windowsazure.services.blob.client.CloudBlobClient; import com.microsoft.windowsazure.services.blob.client.CloudBlobContainer; import com.microsoft.windowsazure.services.blob.client.CloudBlockBlob; import com.microsoft.windowsazure.services.core.storage.CloudStorageAccount; // Initialize Account CloudStorageAccount account = CloudStorageAccount.parse([ACCOUNT_STRING]); // Create the blob client CloudBlobClient blobClient = account.createCloudBlobClient(); // Retrieve reference to a previously created container CloudBlobContainer container = blobClient.getContainerReference("mycontainer"); // Create or overwrite the "myimage.jpg" blob with contents from a local // file CloudBlockBlob blob = container.getBlockBlobReference("myimage.jpg"); File source = new File("c:\\myimages\\myimage.jpg"); blob.upload(new FileInputStream(source), source.length()); Source : http://blogs.msdn.com/b/windowsazurestorage/archive/2012/03/05/windows-azure-storage-client-for-java-overview.aspx
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24007086

http://stackoverflow.com/q/24034960
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/37052046
has title: DataException when trying to persist Entity
tagged with: entity
score: 0
has comment: http://stackoverflow.com/comment/37052070
accepted answer: http://stackoverflow.com/a/24036120
has comment: http://stackoverflow.com/comment/37051918
type: AnsweredQuestion
has body: I am trying to persist an Entity: @Entity @Table(name = "note") public class Note extends AbstractEntity { @Column private String content; @Column private DateTime date; @ManyToOne @JoinColumn(nullable=false) private Interviewer author; @ManyToOne @JoinColumn(nullable=false) private Interviewer interviewer; //getters &amp; setters } with following code: Note noteToPersist = new Note(); noteToPersist.setAuthor(interviewerDao.findInterviewerByLdapId("ldap_id")); noteToPersist.setInterviewer(interviewerDao.findInterviewerByLdapId(request.getLdap())); noteToPersist.setContent(note.getContent()); noteToPersist.setDate(new DateTime()); notesToSave.add(noteDao.create(noteToPersist)); However what I'm getting is: javax.persistence.PersistenceException: org.hibernate.exception.DataException: data exception: string data, right truncation; table: NOTE column: DATE at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:859) at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:241) at com.sun.proxy.$Proxy40.persist(Unknown Source) at com.xxx.xxx.dao.AbstractEntityDao.create(AbstractEntityDao.java:19) at com.xxx.xxx.dao.AbstractEntityDao$$FastClassByCGLIB$$ddf0ee17.invoke(&lt;generated&gt;) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698) at org.springframework…
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24036120
type: Question
has comment: http://stackoverflow.com/comment/37052268

http://stackoverflow.com/comment/36886069
type: QuestionComment
has text: In C, I can have several sockets and call `select` on all of them. `select` will return when one or more has data. How can I accomplish the same idea in Java, but with arbitrary objects?
comment on: http://stackoverflow.com/q/23945920
score: 0
type: Comment

http://stackoverflow.com/a/24047398
answers question: http://stackoverflow.com/q/24047338
has comment: http://stackoverflow.com/comment/37130572
has comment: http://stackoverflow.com/comment/37076701
has comment: http://stackoverflow.com/comment/37176297
has comment: http://stackoverflow.com/comment/37079539
has comment: http://stackoverflow.com/comment/37175567
has comment: http://stackoverflow.com/comment/37175594
has comment: http://stackoverflow.com/comment/37175591
downvote count: 0
has comment: http://stackoverflow.com/comment/37143910
has comment: http://stackoverflow.com/comment/37175559
has comment: http://stackoverflow.com/comment/37078700
has comment: http://stackoverflow.com/comment/37077460
has comment: http://stackoverflow.com/comment/37088298
has body: To use JSON I would recommend Google's JSON library. Very easy to use and quite powerful. https://code.google.com/p/google-gson/ And for my last project I've been using a pretty handy class to send JSON data through HTTP requests... You can check the code for it @ my Github for it here Just copy that class to your project and it's done you can use that JSONParser class using the makeHttpRequest method. EDIT: Here is a example on how to use the JSONParser class. Edit: here is what you can do. In your button you add: android:onClick="getJSON" and Them inside your Main Activity: public void getJSON(View view) { // DO whatever you want with your onCLick. // If your method call to the JSON is in another class you can do the call from here // Example myOtherClass.getJSON(); }
type: Answer
has comment: http://stackoverflow.com/comment/37076841
has comment: http://stackoverflow.com/comment/37189237
has comment: http://stackoverflow.com/comment/37077090
score: 1
has comment: http://stackoverflow.com/comment/37078976
has comment: http://stackoverflow.com/comment/37077750
has comment: http://stackoverflow.com/comment/37076541
has comment: http://stackoverflow.com/comment/37087637
upvote count: 1

http://stackoverflow.com/comment/37172104
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24099350
score: 0
has text: ah...solution found in the duplicated question :)

http://stackoverflow.com/a/23966259
type: Answer
accepted answer of: http://stackoverflow.com/q/23966235
answers question: http://stackoverflow.com/q/23966235
score: 2
has body: Have you tried getting the text, then calling toUpperCase() on it: label3.setText(label3.getText().toUpperCase());
type: AcceptedAnswer
downvote count: 0
upvote count: 2

native
tags question: http://stackoverflow.com/q/23982687
tag name: native
type: Tag
tags question: http://stackoverflow.com/q/23975047
tags question: http://stackoverflow.com/q/24074326

http://stackoverflow.com/comment/36925758
score: 0
comment on: http://stackoverflow.com/a/23964140
type: AnswerComment
type: Comment
has text: This is basically thesame code as in the OP's question. And it won't work if the chrome driver is indide the jar.

arraylist
tags question: http://stackoverflow.com/q/24042780
tags question: http://stackoverflow.com/q/24041875
tags question: http://stackoverflow.com/q/24001640
tags question: http://stackoverflow.com/q/24080702
tags question: http://stackoverflow.com/q/24013553
tags question: http://stackoverflow.com/q/23966265
tags question: http://stackoverflow.com/q/24026343
tags question: http://stackoverflow.com/q/24101799
tags question: http://stackoverflow.com/q/24018715
tags question: http://stackoverflow.com/q/23966597
tags question: http://stackoverflow.com/q/23999575
tags question: http://stackoverflow.com/q/23983339
tags question: http://stackoverflow.com/q/23971960
tags question: http://stackoverflow.com/q/24004860
tags question: http://stackoverflow.com/q/23949978
tags question: http://stackoverflow.com/q/24025274
tags question: http://stackoverflow.com/q/23975200
tags question: http://stackoverflow.com/q/24090431
tags question: http://stackoverflow.com/q/24016334
tags question: http://stackoverflow.com/q/23980488
tags question: http://stackoverflow.com/q/23974854
tags question: http://stackoverflow.com/q/24056275
tags question: http://stackoverflow.com/q/24046075
tags question: http://stackoverflow.com/q/23989854
tags question: http://stackoverflow.com/q/24010987
tags question: http://stackoverflow.com/q/24077342
tags question: http://stackoverflow.com/q/23981008
tags question: http://stackoverflow.com/q/23963189
tags question: http://stackoverflow.com/q/23976648
tags question: http://stackoverflow.com/q/24046255
tags question: http://stackoverflow.com/q/24072071
tags question: http://stackoverflow.com/q/24081717
tags question: http://stackoverflow.com/q/24094596
tags question: http://stackoverflow.com/q/24087440
tags question: http://stackoverflow.com/q/24021101
tags question: http://stackoverflow.com/q/23944610
tags question: http://stackoverflow.com/q/24037705
tags question: http://stackoverflow.com/q/24018364
tags question: http://stackoverflow.com/q/24102507
tags question: http://stackoverflow.com/q/23950849
tags question: http://stackoverflow.com/q/24006297
tags question: http://stackoverflow.com/q/24023843
tags question: http://stackoverflow.com/q/23976012
tags question: http://stackoverflow.com/q/24045753
tags question: http://stackoverflow.com/q/24099456
tags question: http://stackoverflow.com/q/24030884
tags question: http://stackoverflow.com/q/24015544
tags question: http://stackoverflow.com/q/24035311
tags question: http://stackoverflow.com/q/23975527
tags question: http://stackoverflow.com/q/24006647
tags question: http://stackoverflow.com/q/24057175
tags question: http://stackoverflow.com/q/23990274
tags question: http://stackoverflow.com/q/24026946
tags question: http://stackoverflow.com/q/24073617
tags question: http://stackoverflow.com/q/24052684
tags question: http://stackoverflow.com/q/24069575
tags question: http://stackoverflow.com/q/24085257
tags question: http://stackoverflow.com/q/24036602
tags question: http://stackoverflow.com/q/24001747
tags question: http://stackoverflow.com/q/24087285
tags question: http://stackoverflow.com/q/24006127
tags question: http://stackoverflow.com/q/24034767
tags question: http://stackoverflow.com/q/23952142
tags question: http://stackoverflow.com/q/23943898
tags question: http://stackoverflow.com/q/24071194
tags question: http://stackoverflow.com/q/24038968
tags question: http://stackoverflow.com/q/24028238
tags question: http://stackoverflow.com/q/24020223
tags question: http://stackoverflow.com/q/23994922
tags question: http://stackoverflow.com/q/23943546
tags question: http://stackoverflow.com/q/23993169
type: Tag
tags question: http://stackoverflow.com/q/24008272
tags question: http://stackoverflow.com/q/24077045
tags question: http://stackoverflow.com/q/24055685
tags question: http://stackoverflow.com/q/24103569
tag name: arraylist
tags question: http://stackoverflow.com/q/23971871
tags question: http://stackoverflow.com/q/24027827
tags question: http://stackoverflow.com/q/23991119

http://stackoverflow.com/comment/37152189
has text: which version of elasticsearch are you using?
comment on: http://stackoverflow.com/q/24080771
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37004207
has text: Use [combinations of layout managers](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
comment on: http://stackoverflow.com/q/24009159
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36982610
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23996735
type: QuestionComment
has text: @Schadenfreude As I mention above it will not work: the comparator is on keys only and is invoked any time you add an element. So you can hardly make it use values and as soon as the second map changes in any way, if you use it in the comparator, the sorting of the first map will not update. If you really need keys along side of values, you would need a list of pairs. But really _do explain_ properly what your sorting should look like on examples and you are likely to get a solution (for a list of pairs or for a sorted map that uses something else than int as keys)

http://stackoverflow.com/a/24098083
has body: I managed to solve the problem by overriding the getCellEditorValue() method in the cell editor class as such: @Override public Object getCellEditorValue() { Object v = super.getCellEditorValue(); BigDecimal n = new BigDecimal(v.toString()).setScale(4, BigDecimal.ROUND_HALF_UP); return n.toString(); }
accepted answer of: http://stackoverflow.com/q/24061770
answers question: http://stackoverflow.com/q/24061770
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24085904
has body: You could try something like : public void add_note(String note) throws FileNotFoundException, IOException, InvalidFormatException { try { ...content... } catch(FileNotFoundException fnfEx) { throw new FileNotFoundException("File was not found"); } catch(IOException ioEx) { throw new FileNotFoundException("I/O exception"); } catch(InvalidFormatException invEx) { throw new FileNotFoundException("Invalid format errror"); } } Where you put the message you want in the new exceptions and you print the exception message in the JOptionPane.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24085835
answers question: http://stackoverflow.com/q/24085835
score: 1

http://stackoverflow.com/q/24091393
tagged with: busybox
has answer: http://stackoverflow.com/a/24091416
upvote count: 0
has body: I am making an android application that aims to run a .jar file that's a java7 based console application. Could someone direct me on a way I can run this file with a shell command within my application's code?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37157557
tagged with: shell
favorite count: 0
has answer: http://stackoverflow.com/a/24092210
type: Question
has answer: http://stackoverflow.com/a/24091438
tagged with: android
has title: Run ".jar" through shell
score: -1
tagged with: root
tagged with: java
answer count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/37157377
accepted answer: http://stackoverflow.com/a/24092210
possible better answer: http://stackoverflow.com/a/24091416

http://stackoverflow.com/q/24053944
tagged with: rfid
answer count: 1
favorite count: 0
has body: I am trying a program with many phidget rfid readers. This test code works fine and I can load up all the readers and have it worked. Vector phidgetList = manager.getPhidgets(); Enumeration phidgetListEnum = phidgetList.elements(); int count=phidgets.size(); while(phidgetListEnum.hasMoreElements()) { Phidget phidgetElement = (Phidget) phidgetListEnum .nextElement(); if (!phidgets.containsKey(phidgetElement.getSerialNumber())) { RFIDTracking rfi = (RFIDTracking) ct.getTracking("rfid") .clone(); rfi.setName("rfid clone " + count++); rfi.detect(); rfi.setCode(phidgetElement.getSerialNumber()); phidgets.put(phidgetElement.getSerialNumber(), rfi); Thread t = new Thread(rfi); t.start(); } } The problem is when I tried to detect the new readers attached or detached from the system. I used this code Manager manager; manager = new Manager(); try { manager.addAttachListener(new AttachListener() { public void attached(AttachEvent ae) { try { System.out.println("attached" + ((RFIDPhidget)ae.getSource()).getSerialNumber()); } catch (PhidgetException ex) { } } }); manager.open(); } catch (PhidgetException exception) { System.err.println(exception.getErrorNumber()+ exception.getDescription()); } // Allow the Phidgets time to attach Thread.sleep(1000); This code could not detect any reader attachment. I found there is no waitForAttachment(time) in the manager. May I know how to solve this. Thank you in advanced
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/24091939
accepted answer: http://stackoverflow.com/a/24091939
type: Question
has title: RFID Phidget Manager attached event
downvote count: 0

http://stackoverflow.com/a/23966949
accepted answer of: http://stackoverflow.com/q/23966862
type: Answer
has body: This is quite common. You have to ensure that the object itself isn't null. In your check if(x.next==null) the evaluation of x.next throws a NullPointerException because x itself is Null. E.g. In the isEmpty method you have to check if(first==null)
answers question: http://stackoverflow.com/q/23966862
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24052000
tagged with: android-button
has title: How can I quickly close activity and refresh Contact listview onClick() Android?
has body: I'm developing application for changing contact image. When I click on the save button for change image I don't know how to do that OR how to refresh the list view of contact. Here is my code of MainActivity.class and Detail.class. MainActivity.class @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // The contacts from the contacts content provider is stored in this // cursor mMatrixCursor = new MatrixCursor(new String[] { "_id", "name", "photo", "details" }); // Adapter to set data in the listview mAdapter = new SimpleCursorAdapter(getBaseContext(), R.layout.lv_layout, null, new String[] { "name", "photo", "details" }, new int[] { R.id.tv_name, R.id.iv_photo, R.id.tv_details }, 0); // Getting reference to listview ListView lstContacts = (ListView) findViewById(R.id.lst_contacts); // Setting the adapter to listview lstContacts.setAdapter(mAdapter); // Creating an AsyncTask object to retrieve and load listview with // contacts ListViewContactsLoader listViewContactsLoader = new ListViewContactsLoader(); // Starting the AsyncTask process to retrieve and load listview with // contacts listViewContactsLoader.execute(); lstContacts.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Constants.position = position; Constants.id = Constants.ids_list.get(position); ByteArrayOutputStream stream = new ByteArrayOutputStream(); // bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); Intent intent = new Intent(MainActivity.this, detail.class); intent.putExtra("bmp", byteArray); // for image startActivity(intent); } }); } /** An AsyncTask class to retrieve and load listview with contacts */ private class ListViewContactsLoader extends AsyncTask&lt;Void, Void, Cursor&gt; { @Override protected Cursor doInBackground(Void... params) { Uri contactsUri = Contac…
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
tagged with: performance
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24052048

http://stackoverflow.com/a/24066794
downvote count: 0
has body: Looks like you can get this detail from the getFailedMessages method of MailSendException.
upvote count: 2
answers question: http://stackoverflow.com/q/24062853
type: Answer
score: 2

http://stackoverflow.com/a/23946192
type: Answer
has body: As others have mentioned, you shouldn't create one large, 1 gigabyte two-dimensional array, because a single block of contiguous memory would need to be allocated to accomodate it. However, you can create an array of arrays with exactly the dimensions you require. This is because each subarray will be independently initialized on the heap. Instead of this: float[][] A = new float[NUM_SEQ_TOTAL_P1][NUM_SEQ_TOTAL_P2]; Do this: float[][] A = new float[NUM_SEQ_TOTAL_P1][]; for (int i = 0; i &lt; NUM_SEQ_TOTAL_P1; i++) { A[i] = new float[NUM_SEQ_TOTAL_P2]; }
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36886999
answers question: http://stackoverflow.com/q/23943122
downvote count: 0

http://stackoverflow.com/a/23954679
answers question: http://stackoverflow.com/q/23951118
has comment: http://stackoverflow.com/comment/36914808
has comment: http://stackoverflow.com/comment/36914867
type: Answer
downvote count: 1
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23951118
has body: Creating a DefaultStyledDocument in a separate thread from constructing the GUI seems to be the fastest way to create a huge text area. A DefaultStyledDocument is thread safe. Here's the code I used to test the DefaultStyledDocument. I created text with spaces so that the Swing code to line wrap had a chance to work. package com.ggl.testing; import java.util.Random; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultStyledDocument; public class HugeTextArea implements Runnable { private DefaultStyledDocument document; private JFrame frame; private JTextArea textArea; public HugeTextArea() { this.document = new DefaultStyledDocument(); Runnable runnable = new Runnable() { @Override public void run() { buildLongString(400000); } }; new Thread(runnable).start(); } @Override public void run() { frame = new JFrame(); frame.setTitle("Huge Text"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); textArea = new JTextArea(document); textArea.setLineWrap(true); frame.add(new JScrollPane(textArea)); frame.setSize(400, 350); frame.setLocationRelativeTo(null); frame.setVisible(true); } private void buildLongString(int length) { Random random = new Random(); String[] chars = { "s", "t", "a", "y", " " }; for (int i = 0; i &lt; length; i++) { try { document.insertString(document.getLength(), chars[random.nextInt(chars.length)], null); } catch (BadLocationException e) { e.printStackTrace(); } } } public static void main(String[] args) { SwingUtilities.invokeLater(new HugeTextArea()); } }
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36914939
has comment: http://stackoverflow.com/comment/36914790

soft-delete
tags question: http://stackoverflow.com/q/24038072
tags question: http://stackoverflow.com/q/24053542
type: Tag
tag name: soft-delete

http://stackoverflow.com/q/24013553
favorite count: 0
accepted answer: http://stackoverflow.com/a/24017238
has comment: http://stackoverflow.com/comment/37012221
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37013132
tagged with: rectangles
has comment: http://stackoverflow.com/comment/37016670
tagged with: java
tagged with: jpanel
score: -1
has comment: http://stackoverflow.com/comment/37013239
has title: removing a rectangle from a jpanel using arraylist
type: Question
has comment: http://stackoverflow.com/comment/37012996
downvote count: 2
linked to: http://stackoverflow.com/q/24013819
has comment: http://stackoverflow.com/comment/37012881
tagged with: arraylist
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37011998
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/37012310
has body: 'package javaapplication12; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import java.util.ArrayList; import java.util.Iterator; import javax.swing.*; /** Bouncing Ball (Animation) via custom thread */ public class JavaApplication12 extends JFrame implements KeyListener{ // Define named-constants private static final int CANVAS_WIDTH = 640; private static final int CANVAS_HEIGHT = 480; private static final int UPDATE_INTERVAL = 30; // milliseconds int xx = 200; int yy = 400; Shape a1; Shape a2; Rectangle2D a3; Rectangle2D a12; Rectangle2D a4; Rectangle2D a5; Rectangle2D a6; Rectangle2D a7; Rectangle2D a8; Rectangle2D a9; Rectangle2D a10; Rectangle2D a11; Rectangle2D a13; Rectangle2D a14; Rectangle2D a15; Rectangle2D a16; Rectangle2D a17; Rectangle2D a18; Rectangle2D a19; Rectangle2D a20; Rectangle2D a21; Rectangle2D a22; Rectangle2D a23; Rectangle2D a25; ArrayList&lt;Rectangle2D&gt; s = new ArrayList&lt;Rectangle2D&gt;(); Color c2 = Color.RED; private DrawCanvas canvas; // the drawing canvas (extends JPanel) // Attributes of moving object private int x = 375; // top-left (x, y) private int y = 355; private int size = 20; // width and height private int xSpeed = 3; // moving speed in x and y directions private int ySpeed = 5; // displacement per step in x and y /** Constructor to setup the GUI components */ public JavaApplication12() { canvas = new DrawCanvas(); canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT)); this.setContentPane(canvas); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.pack(); this.setTitle("Bouncing Ball"); this.setVisible(true); addKeyListener(this); fun(); // Create a new thread to run update at regular interval Thread updateThread = new Thread() { @Override public void run() { while (true) { update(); // update the (x, y) position repaint(); // Refresh the JFrame. Called back paint…
has answer: http://stackoverflow.com/a/24017238

http://stackoverflow.com/a/24075232
has comment: http://stackoverflow.com/comment/37126981
answers question: http://stackoverflow.com/q/24074358
score: 0
type: Answer
has body: makeyour MapLoader as singleton class : private static MapLoader ml; public static MapLoader create () { if (ml==null) { ml=new MapLoader (); } return (ml); } create one new class where you create one instance of MapLoader : class OneInstance { public static returnOneInstance() { MapLoader mapLoader = MapLoader.create(); }; Now, extend OneInstance class in your ABC and XYZ class, then it should solve your purpose..
has comment: http://stackoverflow.com/comment/37127004

http://stackoverflow.com/comment/40391922
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23990317
type: QuestionComment
has text: *"Basically, I want it to be like those computer games you download from the internet and start playing."* The best way to deploy a Java desktop application is using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info). And as to your now deleted question.. *"it should jump over the do/while loop, exit loop, exit programLoop(), and thus, exit main and end the program."* The EDT will still be running..

http://stackoverflow.com/comment/37088791
type: QuestionComment
comment on: http://stackoverflow.com/q/24054517
score: 0
has text: I am using hibernate.hbm2ddl.auto=update so tables are created automatically. I think the SessionFactory will create a new table before I get to do the alter table query.
type: Comment

http://stackoverflow.com/a/24072131
upvote count: 1
has comment: http://stackoverflow.com/comment/37123124
score: 1
has comment: http://stackoverflow.com/comment/37123094
has comment: http://stackoverflow.com/comment/37123726
has body: You're primary identifier is the account number, from this you need to be able to ascertain the account details. This would lead me to use some kind of Map. I would then create an Account class which held all the information in a simple, easy to use class, which provided appropriate setters and getters. This would then lean me to the fact that I wouldn't actually need the Map, because all the information I need was in the Account class, so instead, I would simply create a ListCellRenderer for the combo box that would be capable of taking the account number from an instance of the Account class and display it appropriately... This would mean I'd only need a List or a ComboBoxModel to hold the account details Take a closer look at How to Use Combo Boxes for more details
answers question: http://stackoverflow.com/q/24072071
downvote count: 0
has comment: http://stackoverflow.com/comment/37123749
type: Answer

http://stackoverflow.com/a/37446287
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24057666
type: Answer
upvote count: 1
has body: Try the below dependencies org.eclipse.persistence javax.persistence 2.1.0 compile org.datanucleus datanucleus-core 3.2.15 runtime org.datanucleus datanucleus-api-jpa 3.1.3 compile javax.jdo jdo-api 3.1 compile org.datanucleus datanucleus-jodatime 3.2.1 compile For gradle, // persistence // App Engine and DataNucleus compatibility: // https://code.google.com/p/datanucleus-appengine/wiki/Compatibility compile 'org.eclipse.persistence:javax.persistence:2.1.0' runtime 'org.datanucleus:datanucleus-core:3.2.15' compile 'org.datanucleus:datanucleus-api-jpa:3.1.3' compile 'javax.jdo:jdo-api:3.1' compile 'org.datanucleus:datanucleus-jodatime:3.2.1'

http://stackoverflow.com/comment/36989096
type: AnswerComment
score: 0
type: Comment
has text: No, I really want to figure out for the future
comment on: http://stackoverflow.com/a/23949417

http://stackoverflow.com/comment/37077611
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24048202
has text: Well no but the author seemed very confident :) Anyway it's easy to do the closing operation with matlab (imclose) but I need to do it with java ! Any ideas?
type: Comment

http://stackoverflow.com/a/24100415
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37174215
type: AcceptedAnswer
downvote count: 0
has body: I added a call to updateTime() in the start button OnClickListenter and have had no problems with the count continuing after hitting stop. Even after waiting 10+ seconds, hitting start again just starts continues where it left off. I did notice that the value would increase twice in quick succession if I hit start within 1 second of hitting stop. This is because hitting start calls updateTime() and the previously posted runnable's delay has not finished, so when it does, it also increments the time. A better bet would be to use an AsyncTask: package com.example.timernew; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { Handler h=new Handler(); TextView t; Button start, stop,reset; volatile boolean running; UpdateTimeTask mUpdateTimeTask; int counter = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); t = (TextView) findViewById(R.id.TextArea); start = (Button) findViewById(R.id.start_button); stop=(Button) findViewById(R.id.stop_button); running=false; start.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ if (null == mUpdateTimeTask) { mUpdateTimeTask = new UpdateTimeTask(); mUpdateTimeTask.execute(); } } }); stop.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ if(null != mUpdateTimeTask) { mUpdateTimeTask.cancel(true); mUpdateTimeTask = null; } } }); } public class UpdateTimeTask extends AsyncTask&lt;Void, Void, Void&gt; { protected Void doInBackground(Void... params) { while (true) { try { Thread.sleep(1000); } catch (InterruptedException ie) { Log.e("timer app", "a problem occurred while sleeping or the task was cancelled", ie); return null; } counter…
type: Answer
has comment: http://stackoverflow.com/comment/37176256
has comment: http://stackoverflow.com/comment/37174689
accepted answer of: http://stackoverflow.com/q/24099987
answers question: http://stackoverflow.com/q/24099987

http://stackoverflow.com/q/24085675
has answer: http://stackoverflow.com/a/24086338
score: 0
tagged with: java
has body: I have a List&lt;Presenter&gt; presenterList; With public class Presenter(){ String name; String imageRef; // Filename to be downloaded Bitmap image; (etc...) } I'm working with AsyncTask &amp; once the image has downloaded, I wish to go through the list and set Image value to the newly download image. so far i have Presenter pres = PresenterList.get(Position); pres.Image = new (Bitmap) downloadedImageFromImageRef; however i fear that this will not relate to the Image value of the presenter within the list. How do i refer, or even assign to the specific Presenter attribute within the list? From working with C (many years ago), i belive somthing like a pointer to the value in which to assign .Image would work Thank you in advace
has title: How to: Make addition to class property within list
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37146563
tagged with: class
has comment: http://stackoverflow.com/comment/37147153
has comment: http://stackoverflow.com/comment/37146671
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24086393
has comment: http://stackoverflow.com/comment/37146826
tagged with: list

http://stackoverflow.com/q/23975758
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: methods
has body: This code is asserting that a created class' method which returns a certain value returns the right number. I have to insert my own code where [???] is currently. class A { int m() { return 1; } } public class Exercise { public static void main(String [] arg) { A a = [???]; assert a.m() == 2; } } How do I change the return value of the m method of the class A so it returns 2, not 1?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23975777
upvote count: 1
answer count: 1
favorite count: 0
has title: Changing the return value of a method

http://stackoverflow.com/comment/37086912
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24053144
score: 0
has text: @sarath what is logged in the browser console

http://stackoverflow.com/q/23965410
has answer: http://stackoverflow.com/a/23965770
has body: I have the following Java program that grabs a date-time String and have tested in multiple regular expression test sites to check if they do indeed work, which they do. private static final Pattern MATCH_DATE_TIME = Pattern.compile("([\\d+/ GMT:]+)"); The unescaped version of the expression ([\d/ :GMT]+) and the websites I tested the above on. regexerV1 regexpal With the following data Time : 05/28/2014 14:16:21 GMT duration: 50 minutes Both of the above websites with the unescaped versions correctly match the intended data below 05/28/2014 14:16:21 GMT //the matched data 05/28/2014 14:16:21 GMT //$1 extracted data although both the above sites successfully match and extract the data my program does not. Here is the code for my program (minimum code example) private static final Pattern MATCH_DATE_TIME = Pattern.compile("([\\d+/ GMT:]+)"); public static void main(String[] args) { try { String data = JOptionPane.showInputDialog(null, "Please Enter The Match ID", "Grab Match Details", JOptionPane.PLAIN_MESSAGE); Matcher m = MATCH_DATE_TIME.matcher(data); System.out.println(m.matches()); String dateTime = m.group(0); System.out.println(dateTime); } catch (IllegalStateException ise) { ise.printStackTrace(); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23965490
tagged with: regex
has comment: http://stackoverflow.com/comment/36924343
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23966171
has title: Regular Expression not matching data but Regular Expression confirmed working
has comment: http://stackoverflow.com/comment/36923162
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36922592

http://stackoverflow.com/comment/36918012
comment on: http://stackoverflow.com/q/23962433
score: 0
type: Comment
type: QuestionComment
has text: @ChristianGollhardt : see my updated question... I can make boxes using button, however for me the concern is writing time and name over button... how can i do that?

http://stackoverflow.com/comment/36951762
has text: No StringBuffer is every created because the compiler is allowed to optimze `"a" + "b" + "c"` to `"abc"` while it compiles. Rephrase the OP question to read `String a = "a"; String b = "b"; String c = "c"; String temp = a + b + c;` and you would be more correct, but then you would be forgetting the internal `char[]` inside the `StringBuffer`
comment on: http://stackoverflow.com/q/23981287
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24065434
has comment: http://stackoverflow.com/comment/37109208
linked to: http://stackoverflow.com/q/9423188
has comment: http://stackoverflow.com/comment/37109236
has comment: http://stackoverflow.com/comment/37109264
type: Question
upvote count: 2
answer count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37109121
has comment: http://stackoverflow.com/comment/37110239
has comment: http://stackoverflow.com/comment/37110620
has comment: http://stackoverflow.com/comment/37109187
has comment: http://stackoverflow.com/comment/37109261
has comment: http://stackoverflow.com/comment/37109067
has title: Why are String, Integer and other wrapper classes considered good keys in HashMap?
has comment: http://stackoverflow.com/comment/37109292
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37109186
has body: Why String, Integer and other wrapper classes are considered good keys ? I found below answers - String, Integer and other wrapper classes are natural candidates of HashMap key, and String is most frequently used key as well because String is immutable and final,and overrides equals and hashcode() method. Other wrapper class also shares similar property. Immutabiility is required, in order to prevent changes on fields used to calculate hashCode() because if key object return different hashCode during insertion and retrieval than it won't be possible to get object from HashMap. Immutability is best as it offers other advantages as well like thread-safety, If you can keep your hashCode same by only making certain fields final, then you go for that as well. Since equals() and hashCode() method is used during retrieval of value object from HashMap, its important that key object correctly override these methods and follow contact. If unequal object return different hashcode than chances of collision will be less which subsequently improve performance of HashMap.
has comment: http://stackoverflow.com/comment/37110405
score: 2
has answer: http://stackoverflow.com/a/24065782
downvote count: 0
has answer: http://stackoverflow.com/a/24065452
tagged with: java

http://stackoverflow.com/q/24104094
has comment: http://stackoverflow.com/comment/37182069
accepted answer: http://stackoverflow.com/a/24104221
has comment: http://stackoverflow.com/comment/37182161
possible better answer: http://stackoverflow.com/a/24104253
upvote count: 6
has answer: http://stackoverflow.com/a/24104253
type: AnsweredQuestion
has body: I am creating a function with a generic type and that generic type is an abstract type which I need to instantiate. This code will explain it more clearly: public <T extends AbstractRow> foo(){//no I did not actually name the function foo ArrayList<T> arr=new ArrayList<T>(); arr.add(new T(...)); //cant instantiate objects of abstract class } Basically I want to enforce "T extends AbstractRow but is not Abstract itself". I realize you can't instantiate abstract classes, so I'd like a suggestion on a workaround or some other method that would allow me to mimic the behavior of creating an object of a generic type.
tagged with: java
has title: instantiate object of abstract class with generic type
score: 6
type: Question
has answer: http://stackoverflow.com/a/24104221
has comment: http://stackoverflow.com/comment/37182773
tagged with: abstract-class
answer count: 2
downvote count: 0
tagged with: generics
has comment: http://stackoverflow.com/comment/37182088
favorite count: 0
has comment: http://stackoverflow.com/comment/37182588

http://stackoverflow.com/comment/37000827
score: 0
type: AnswerComment
has text: Made a slight update to ensure the zip files are created within the `Books` directory...
type: Comment
comment on: http://stackoverflow.com/a/24007383

http://stackoverflow.com/q/23978768
tagged with: memory
has comment: http://stackoverflow.com/comment/36947017
upvote count: 0
has comment: http://stackoverflow.com/comment/36946967
tagged with: minecraft
has body: I'm trying to code multiplayer tile-base java game.(Just for fun) World map created using Perlin Noise. So I'm interested, how can I create really large map? For example to generate 8000x8000 map with Perlin noise requires about 4096Mb of RAM. Map represented as [8000][8000] array, but after generating I store it in database, but I want to create map about 25000x25000 tiles in it. Can I divide map generating process into smaller parts? The problem is that I should use a Perlin noise for the whole map, otherwise map will looks like just couple of chunks, or if you know something about dynamic map generation, please tell me. I am shocked how it works in Minecraft (I mean new generated chunks somehow connected with prevous). Here is my code: public static float[][] generateWhiteNoise(int width, int height) { Random random = new Random(); //Seed to 0 for testing float[][] noise = new float[width][height]; for (int i = 0; i &lt; width; i++) { for (int j = 0; j &lt; height; j++) { noise[i][j] = (float)random.nextDouble() % 1; } } return noise; } static float Interpolate(float x0, float x1, float alpha) { return x0 * (1 - alpha) + alpha * x1; } static float[][] generateSmoothNoise(float[][] baseNoise, int octave) { int width = baseNoise.length; int height = baseNoise[0].length; float[][] smoothNoise = new float[width][height]; int samplePeriod = 1 &lt;&lt; octave; // calculates 2 ^ k float sampleFrequency = 1.0f / samplePeriod; for (int i = 0; i &lt; width; i++) { //calculate the horizontal sampling indices int sample_i0 = (i / samplePeriod) * samplePeriod; int sample_i1 = (sample_i0 + samplePeriod) % width; //wrap around float horizontal_blend = (i - sample_i0) * sampleFrequency; for (int j = 0; j &lt; height; j++) { //calculate the vertical sampling indices int sample_j0 = (j / samplePeriod) * samplePeriod; int sample_j1 = (sample_j0 + samplePeriod) % height; //wrap around float vertical_blend = (j - sample_j0) * sampleFrequency; //blend the top two corners float top = I…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36947059
linked to: http://stackoverflow.com/q/7746743
score: -1
has comment: http://stackoverflow.com/comment/36946719
answer count: 2
has title: Huge Java array for tile base game
downvote count: 1
has answer: http://stackoverflow.com/a/23979266
tagged with: tile
tagged with: java
has answer: http://stackoverflow.com/a/23979456
type: UnansweredQuestion

http://stackoverflow.com/comment/37121639
comment on: http://stackoverflow.com/a/24063882
type: Comment
has text: I've edited my response to work for Java. It would be good to tag your questions with java, as there are subtle (and not so subtle) differences between Play versions.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37166011
type: AnswerComment
score: 0
type: Comment
has text: Would that affect my CRUD operations?
comment on: http://stackoverflow.com/a/24095697

http://stackoverflow.com/comment/37030510
comment on: http://stackoverflow.com/q/24023098
has text: @njzk2 - that made a HUGE difference, and I can see in the log that it's running concurrently with the main load processes
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24026429
type: Answer
has comment: http://stackoverflow.com/comment/37037251
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37039843
upvote count: 2
has body: You need to create a Comparator it can be anonymous or a class and in your Student do a get method for your mark so you can use it inside the comparator to compare the marks for sorting example: ArrayList&lt;Student&gt; allStudents = new ArrayList(); allStudents.add(new Student("A", 80, 94)); allStudents.add(new Student("B", 98, 91)); allStudents.add(new Student("F", 70, 84)); allStudents.add(new Student("C", 98, 92)); allStudents.add(new Student("H", 99, 93)); Collections.sort(allStudents, new Comparator&lt;Student&gt;() { public int compare(Student s, Student s2) { return s.getMark() - s2.getMark(); } });
has comment: http://stackoverflow.com/comment/37037311
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24026343
has comment: http://stackoverflow.com/comment/37037529
answers question: http://stackoverflow.com/q/24026343
has comment: http://stackoverflow.com/comment/37036550

http://stackoverflow.com/a/55521569
type: Answer
has comment: http://stackoverflow.com/comment/103200700
has body: I am using IntelliJ in Mac, running Spring boot application was giving the same issue. Whenever I run the app in Terminal and use CTRL + Z, the terminal will strop running the app. But when I run the app again in the same terminal, will give error saying the port 8080 was in use. I just tried the option to close the Terminal session ( right click -> select -> Close Session). This will close the terminal, and when I clicked the terminal option again and ran the app, it ran smoothly.
score: 0
answers question: http://stackoverflow.com/q/24010282

http://stackoverflow.com/q/23980690
score: 0
has body: If there aren't pointers exposed to implement in java does Nullpointer exception need to be changed to Nullreference exception?
answer count: 1
accepted answer: http://stackoverflow.com/a/23980715
favorite count: 0
tagged with: nullreferenceexception
tagged with: nullpointerexception
type: AnsweredQuestion
has title: Are there pointers in java? if not why do we get Nullpointer exception?
tagged with: java
linked to: http://stackoverflow.com/q/101072
upvote count: 1
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/101072
tagged with: null
has answer: http://stackoverflow.com/a/23980715

http://stackoverflow.com/a/23983453
has comment: http://stackoverflow.com/comment/36956823
has comment: http://stackoverflow.com/comment/36956184
has comment: http://stackoverflow.com/comment/36955843
has comment: http://stackoverflow.com/comment/36957101
has comment: http://stackoverflow.com/comment/36956423
has comment: http://stackoverflow.com/comment/36955983
has comment: http://stackoverflow.com/comment/36957042
downvote count: 1
has comment: http://stackoverflow.com/comment/36956918
has comment: http://stackoverflow.com/comment/36957004
has comment: http://stackoverflow.com/comment/36956196
has comment: http://stackoverflow.com/comment/36956111
has body: see basically, you need to remove an object information from arraylist if the list contains information whose id is same as removeid. so before removing , you need to do a check for the information id in the list so go for iterating list and find information in each iteration and check its id equlas to removeid if equals then do list.remove(information) for (Information information: database) { // check for ID is same as remove id // if equals remove that entire object from list if (information.ID.equals(removeID)) { // remove object with ID same as removeid database.remove(information); } }
answers question: http://stackoverflow.com/q/23983339
has comment: http://stackoverflow.com/comment/36956513
type: Answer
has comment: http://stackoverflow.com/comment/36956898
upvote count: 0
has comment: http://stackoverflow.com/comment/36956045
has comment: http://stackoverflow.com/comment/36955938
has comment: http://stackoverflow.com/comment/36956455
has comment: http://stackoverflow.com/comment/36956398
has comment: http://stackoverflow.com/comment/36956695
has comment: http://stackoverflow.com/comment/36956625
score: -1
has comment: http://stackoverflow.com/comment/36956305

http://stackoverflow.com/q/24069341
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24086306
has body: In this question: Convert RGB to CMYK, I got a way to convert RGB int array to CMYK byte array. Now I hope to convert ARGB int array to CMYKA byte array directly instead of working with the resulting CMYK array and adding the extra alpha channel afterwards. Is it possible? I tried to use 4 bands offset to create the raster like this: WritableRaster raster = Raster.createPackedRaster(db, imageWidth, imageHeight, imageWidth, new int[]{0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}, null); But I got an error: Numbers of source Raster bands and source color space components do not match. I understand this comes from the fact the source color space only has 3 components. I am just wondering if it's possible to create some kind of 4 components color space or something to work around this. This is the current version I am working with: public static byte[] RGB2CMYK(ICC_ColorSpace cmykColorSpace, int[] rgb, int imageWidth, int imageHeight, boolean hasAlpha) { DataBuffer db = new DataBufferInt(rgb, rgb.length); WritableRaster raster = Raster.createPackedRaster(db, imageWidth, imageHeight, imageWidth, new int[]{0x00ff0000, 0x0000ff00, 0x000000ff}, null); ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorConvertOp cco = new ColorConvertOp(sRGB, cmykColorSpace, null); WritableRaster cmykRaster = cco.filter(raster, null); byte[] cmyk = (byte[])cmykRaster.getDataElements(0, 0, imageWidth, imageHeight, null); if(!hasAlpha) return cmyk; byte[] cmyka = new byte[rgb.length*5]; for(int i = 0, j = 0, k = 0; i &lt; rgb.length; i++) { cmyka[k++] = cmyk[j++]; cmyka[k++] = cmyk[j++]; cmyka[k++] = cmyk[j++]; cmyka[k++] = cmyk[j++]; cmyka[k++] = (byte)(rgb[i]&gt;&gt;24 &amp; 0xff); } return cmyka; }
score: 0
tagged with: rgba
answer count: 1
has answer: http://stackoverflow.com/a/24086306
has title: ARGB int array to CMYKA byte array convertion
tagged with: cmyk
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23999442

http://stackoverflow.com/comment/36935871
comment on: http://stackoverflow.com/q/23973147
has text: @etherous stateful bean works fine. my question is why this should happen?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/23979569
answers question: http://stackoverflow.com/q/23979510
has body: Use list view and custom adapter to populate the list view... Listview should extend to the bottom but limit it just above the Type a name edit text and button. Custom list view should contain linear layout horizontal in that include checkbox, Textview and Button For type a name and Add use linear layout horizontal
has comment: http://stackoverflow.com/comment/36949065
type: Answer
has comment: http://stackoverflow.com/comment/36949076
score: 0

http://stackoverflow.com/a/24091737
has body: Have you put "super"? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player); }
has comment: http://stackoverflow.com/comment/37164833
answers question: http://stackoverflow.com/q/24091582
score: 0
type: Answer

http://stackoverflow.com/q/23943410
type: UnansweredQuestion
tagged with: maven
duplicate of: http://stackoverflow.com/q/12828416
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36881349
has comment: http://stackoverflow.com/comment/36881304
has body: I have maven project with main and test subfolders under folder src. However, when I build maven jar, I dont see test files in jar file (I do see files that were there in src/main; I dont see test files from src/test) [xx@localhost target]$ jar tvf cbm.jar | grep *Test* [xx@localhost target]$ Here is my pom.xml org.apache.maven.plugins maven-assembly-plugin org.apache.maven.plugins maven-assembly-plugin 2.4 jar-with-dependencies Main afloat false make-assembly package single EDIT @azurefrog: I am having issues in production and need to run the test cases on production machine.
has answer: http://stackoverflow.com/a/23944206
score: 0
answer count: 2
has title: Missing test files in maven jar
has comment: http://stackoverflow.com/comment/36882071
linked to: http://stackoverflow.com/q/12828416
has answer: http://stackoverflow.com/a/23944162

http://stackoverflow.com/q/23998937
type: Question
downvote count: 0
answer count: 1
has body: I'm trying to integrate the Facebook Friendpicker Sample into the Parse.com quickstart code. This would create an app that logs in through Facebook, is connected to Parse.com and allows you to pick friends (all part of a greater plan, ofcourse). After selecting facebook friends you can click "done", at which point the app would store the selected friends into the application. When clicking "done" it crashes instead (but only after clicking "done", the selection screen itself works fine). Could you help me understand what is going wrong (why the following line causes a problem)? The line that is causing the problem is: GamePlannerFriendPickerApplication application = (GamePlannerFriendPickerApplication) getApplication(); The LogCat: 06-02 15:25:02.176: W/dalvikvm(274): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 06-02 15:25:02.285: E/AndroidRuntime(274): FATAL EXCEPTION: main 06-02 15:25:02.285: E/AndroidRuntime(274): java.lang.ClassCastException: com.parse.integratingfacebooktutorial.IntegratingFacebookTutorialApplication 06-02 15:25:02.285: E/AndroidRuntime(274): at com.parse.integratingfacebooktutorial.GamePlannerPickFriendsActivity$2.onDoneButtonClicked(GamePlannerPickFriendsActivity.java:66) 06-02 15:25:02.285: E/AndroidRuntime(274): at com.facebook.widget.PickerFragment$6.onClick(PickerFragment.java:650) 06-02 15:25:02.285: E/AndroidRuntime(274): at android.view.View.performClick(View.java:2408) 06-02 15:25:02.285: E/AndroidRuntime(274): at android.view.View$PerformClick.run(View.java:8816) 06-02 15:25:02.285: E/AndroidRuntime(274): at android.os.Handler.handleCallback(Handler.java:587) 06-02 15:25:02.285: E/AndroidRuntime(274): at android.os.Handler.dispatchMessage(Handler.java:92) 06-02 15:25:02.285: E/AndroidRuntime(274): at android.os.Looper.loop(Looper.java:123) 06-02 15:25:02.285: E/AndroidRuntime(274): at android.app.ActivityThread.main(ActivityThread.java:4627) 06-02 15:25:02.285: E/AndroidRuntime(274): at java.lang.reflect.Met…
favorite count: 0
accepted answer: http://stackoverflow.com/a/23999350
tagged with: android
tagged with: sample
tagged with: facebook
has comment: http://stackoverflow.com/comment/37826572
upvote count: 1
type: AnsweredQuestion
has title: Android: Stuck on ClassCastException using getApplication(), trying to integrate Facebook Friendpicker sample
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23999350
tagged with: eclipse

http://stackoverflow.com/a/24029236
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24029164
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37041853
has body: Your target of 10000 or more simultaneous requests is going to end up a function of your whole stack more than just a function of Tomcat. If you write a Servlet to do nothing more than always return 200, does that get you 10000 simultaneous requests? Have you tested it? Maybe this guy has an answer for you: how to handle 2000+ requests/sec on tomcat?

http://stackoverflow.com/q/24037365
score: 0
has answer: http://stackoverflow.com/a/24045926
possible better answer: http://stackoverflow.com/a/24038822
has title: Rendering Barnsley Fern fractal without the probabilities
has answer: http://stackoverflow.com/a/24038822
has body: I was making a program that renders a mutation of the Barnsley Fern fractal. My program works flawlessly and generates exactly the output which I want it to generate. I went further into reading about the Iterated Function Systems and read that these fractals can be renders without the use of probabilities and performing all the four Affine Transformations in each iteration. I know that this will increase the computation time but I want to know how can we remove the probabilities out of picture? For example the probability for the four functions that draw my fern are 2%, 84%, 7% and 7% respectively. Here is the question again in bold for those who say, "I cannot find the question in the post." : How do we use all the four functions in every iteration instead of choosing one of the four, based on probability? Here is the relevant code: AffineTransformation.java public class AffineTransformation { private double[][] transformation=new double[2][2]; private double[][] translation=new double[2][1]; public AffineTransformation(double a,double b,double c,double d,double e,double f) { transformation[0][0] = a; transformation[0][1] = b; transformation[1][0] = c; transformation[1][1] = d; translation[0][0] = e; translation[1][0] = f; } public Point transform(Point point) { double x = point.getX(); double y = point.getY(); double u = 0.0; double v = 0.0; u = transformation[0][0]*x + transformation[0][1]*y; v = transformation[1][0]*x + transformation[1][1]*y; u = u + translation[0][0]; v = v + translation[1][0]; return new Point(u,v); } } The rendering loop AffineTransformation f1 = new AffineTransformation(0,0,0,0.25,0,-0.4); AffineTransformation f2 = new AffineTransformation(0.95,0.005,-0.005,0.93,-0.002,0.5); AffineTransformation f3 = new AffineTransformation(0.035,-0.2,0.16,0.04,-0.09,0.02); AffineTransformation f4 = new AffineTransformation(-0.04,0.2,0.16,0.04,0.083,0.12); Point point = new Point(0.5,0.0); int N=Width*Height; for(int i=0;i&lt; N*25;i++) { Point newpoint =…
has comment: http://stackoverflow.com/comment/37056489
has comment: http://stackoverflow.com/comment/37057568
accepted answer: http://stackoverflow.com/a/24045926
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37056588
tagged with: algorithm
tagged with: java
type: Question
answer count: 2
tagged with: fractals

http://stackoverflow.com/comment/37159666
has text: It looks like both methods satisfy the requirement. A linear running time is faster than a quadratic, so the first one is best (from a running time perspective).
score: 2
comment on: http://stackoverflow.com/q/24092576
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23943387
has title: How to use an injective random number from a seed
has comment: http://stackoverflow.com/comment/36881172
has comment: http://stackoverflow.com/comment/36881311
linked to: http://stackoverflow.com/q/7279895
downvote count: 5
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23943559
accepted answer: http://stackoverflow.com/a/23943559
type: AnsweredQuestion
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/36881682
has comment: http://stackoverflow.com/comment/36881107
has body: I would like to have a combination between a Perfect Hash Function and a random number generator. It would be used to map an integer between 1 and 5000 to an integer between 1 and 5000 and it must be injective (no two inputs can have the same output and vice versa). For example: INPUT OUTPUT 1 1542 2 73 3 4600 1000 201 2 73 1 1542 Thanks in advance. EDIT: I first tried to use several of the hashing functions from wikipedia, but they all have problems.
tagged with: java
has comment: http://stackoverflow.com/comment/36881210
type: Question
tagged with: c#

http://stackoverflow.com/comment/36960174
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23983437
type: AnswerComment
has text: Thank you for your reply, i have heard of some apps that allow you to clear cache on browser, apps, etc. I am guessing that those use the Apache IOUtils? If so where could i find the Apache IOUtils function(Im new to android developing).

http://stackoverflow.com/q/24054053
answer count: 1
has comment: http://stackoverflow.com/comment/37087778
tagged with: android-activity
has comment: http://stackoverflow.com/comment/37087839
type: UnansweredQuestion
tagged with: android-lifecycle
tagged with: android-fragments
tagged with: java
has body: On the click of a button, I want onPause to be called. On clicking back/after a time interval, I want onResume to be called. I find that system alerts, dialogs etc. do not call onPause and onResume on show and cancel. I need to do this to verify a functional test. If i show a transparent activity, it's lifecycle methods would be called which would contradict what I am trying to test. I only want to verify onPause and onResume on my current activity. Is this possible?
linked to: http://stackoverflow.com/q/17579941
type: Question
has answer: http://stackoverflow.com/a/24055676
has comment: http://stackoverflow.com/comment/37087740
has comment: http://stackoverflow.com/comment/37087974
score: 0
has title: How can I trigger onPause and onResume?
tagged with: android

cookies
tags question: http://stackoverflow.com/q/24068989
tags question: http://stackoverflow.com/q/24090925
tags question: http://stackoverflow.com/q/23977304
type: Tag
tags question: http://stackoverflow.com/q/24014720
tags question: http://stackoverflow.com/q/23998597
tags question: http://stackoverflow.com/q/23995341
tag name: cookies
tags question: http://stackoverflow.com/q/24027899
tags question: http://stackoverflow.com/q/24017645
tags question: http://stackoverflow.com/q/24029988
tags question: http://stackoverflow.com/q/24063585

http://stackoverflow.com/comment/37113927
type: Comment
comment on: http://stackoverflow.com/a/24037939
type: AnswerComment
has text: Minimalistic example: the double would range from `0` to `1` with steps of `0.1` and you would apply it to generate a number from `0` to `4` by multiplying with 4. You would have to map 10 possible outcomes (0.1, 0.2 etc.) to 4 integers. That is of course not possible. Now imagine what happens if you have to map it to `0` to `40` :)
score: 0

http://stackoverflow.com/q/24021352
tagged with: java
has comment: http://stackoverflow.com/comment/37026863
type: Question
has answer: http://stackoverflow.com/a/24022852
has answer: http://stackoverflow.com/a/24021528
answer count: 3
has answer: http://stackoverflow.com/a/24021436
has comment: http://stackoverflow.com/comment/37026881
has comment: http://stackoverflow.com/comment/37026579
accepted answer: http://stackoverflow.com/a/24022852
downvote count: 0
has title: Is it possible to access the console if you have already redirected standard out?
has body: Context: I have a simple program with a bunch of System.out.println() calls depending on command line arguments I either send standard out to console or to file I also have a very basic Debug class with a Debug.print() call I use to print debug info to console when my program has problems Problem: I never want the Debug.print() call to be sent to a file, it's just temporary info for me. Of course when I redirect standard out to file, Debug info is sent there as well Attempted Solutions: I tried to use java.io.Console with System.console().writer().println() but it returns a NullPointerException when standard out is redirected as specified in the javadocs. The other way I tried was to 'save' the console in a variable before redirecting standard out. This works fine if I do it in the class that does the redirecting, but in the Debug class, I can't be sure that someone hasn't already redirected standard out by the time I set my console variable... Question: Is there any simple way of writing to the java console no matter what standard out is doing?
favorite count: 0
tagged with: console
possible better answer: http://stackoverflow.com/a/24021528
upvote count: 2
tagged with: http-redirect
has comment: http://stackoverflow.com/comment/37027254
type: AnsweredQuestion
score: 2
tagged with: redirectstandardoutput
has comment: http://stackoverflow.com/comment/37027202

http://stackoverflow.com/comment/36918041
score: 0
comment on: http://stackoverflow.com/q/23962955
type: Comment
has text: It is a maven project and absurd I have two packages . I import package2 inside a class of package1
type: QuestionComment

http://stackoverflow.com/comment/37119476
type: QuestionComment
comment on: http://stackoverflow.com/q/24070655
has text: Now I tried again implementing it with this: String path = "android:recources//" + getPackageName() +"/" +R.raw.splash; vid.setVideoURI(Uri.parse(path)); and I get a CANT PLAY error again :(
score: 0
type: Comment

http://stackoverflow.com/q/24027693
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24051133
has comment: http://stackoverflow.com/comment/37038771
has comment: http://stackoverflow.com/comment/37038778
tagged with: java
tagged with: mysql
has title: Prepared statement insert into MySQL from Java
downvote count: 1
has answer: http://stackoverflow.com/a/24027716
type: Question
has body: Ok, I know this has been beaten to death in other posts but I have tried to no avail to get this INSERT command to work. I am using MySQL 5.6 with a JDBC connector. I am reading in String variables from a GUI and trying to use them in the INSERT. I have tried using ", `, ' and every combination out there to do this and nothing. This is a pretty straight forward application so what am I missing. Yes the variables do have values in them, I checked. try { String sql = "INSERT INTO customer(firstname, lastname, address, city, state, zip, phone, email)VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; PreparedStatement preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, custFirst); preparedStatement.setString(2, custLast); preparedStatement.setString(3, custAddress); preparedStatement.setString(4, custCity); preparedStatement.setString(5, custState); preparedStatement.setString(6, custZip); preparedStatement.setString(7, custPhone); preparedStatement.setString(8, custEmail); preparedStatement.executeUpdate(); } catch(Exception err) { System.err.println("Error: " + err.getMessage()); }
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/37082359
score: -1
favorite count: 0

http://stackoverflow.com/comment/36943895
comment on: http://stackoverflow.com/a/23976796
has text: @UriCS - still wont reuse the definitions from eclipse, but there's a junit "extension" that handles container startup/shutdown and deployment - arquillian - http://arquillian.org/features/ . has support for tomcat 7 embedded - http://arquillian.org/modules/arquillian-tomcat-embedded-7-container-adapter/. anything beyond that and you'd need to write an eclipse-aware extension for arquillian
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37043003
comment on: http://stackoverflow.com/q/24030010
score: 0
has text: It seems an odd value, perhaps it's 41,794 days since some epoch (like January 1, 1900)? Does the value change during a day, and does it progress linearly over time? At what rate?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37115605
score: 0
comment on: http://stackoverflow.com/q/24068805
type: Comment
type: QuestionComment
has text: Those are all there, just markdown is screwing it up for whatever reason I can't make it work. It's creating a war.

http://stackoverflow.com/q/24046075
tagged with: android
has body: I am new to android, and I have to create an app that plots data. One set of data is about 7000 data point, and I've been using AChartEngine. I am using an ArrayList to hold the data. ArrayList&lt;Double&gt; forehead = new ArrayList&lt;Double&gt;(); private XYMultipleSeriesDataset getforeDataset() { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); XYSeries firstSeries = new XYSeries("Forehead"); for (int i = 0; i &lt; forehead.size(); i++) firstSeries.add(i, forehead.get(i)); dataset.addSeries(firstSeries); return dataset; this is where I add data into the ArrayList, a sample string that would be read in is: "02888 0 096 098 080" private void getIntegerArray(ArrayList&lt;String&gt; stringArray) { for (String s:stringArray){ String[] str = s.split("\t"); forehead.add(Double.parseDouble(str[3])); } } private XYMultipleSeriesRenderer getforeRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.setMargins(new int[] { 0, 0, 0, 0 }); XYSeriesRenderer r = new XYSeriesRenderer(); r.setColor(Color.BLUE); r.setPointStyle(PointStyle.POINT); r.setFillPoints(false); renderer.addSeriesRenderer(r); return renderer; } plotting mChartView2 = ChartFactory.getLineChartView(getActivity(), getforeDataset(), getforeRenderer()); layout2.addView(mChartView2); Here is my application and no data is displayed, how can I display the 'forehead' ArrayList? https://i.sstatic.net/Rjp0d.jpg
tagged with: achartengine
tagged with: plot
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37073188
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24053125
has comment: http://stackoverflow.com/comment/37075995
accepted answer: http://stackoverflow.com/a/24053125
has comment: http://stackoverflow.com/comment/37073301
has title: AChartEngine Plotting, ArrayList indexing
tagged with: arraylist
score: 0
answer count: 1

http://stackoverflow.com/a/23970470
has body: You do not need to use the classic singleton approach when extending the Application class. Instead, if you have your manifest setup right you can just: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //notice the change CricScoreApplication app = (CricScoreApplication)getApplication(); app.setMatchListState(MatchListState.LOADING); startService(new Intent(this, MatchUpdateService.class)); this.receiver = new MatchesReceiver(); this.filter = new IntentFilter(GenericProperties.INTENT_ML_UPDATE); this.matchAdapter = new MatchAdapter(this); this.oldState = MatchListState.LOADING; RunningInfo.clearSession(getApplicationContext()); } For this to work, you need to point this class as the one to be used over the base Application class. This is done in the manifest: &lt;application ... android:name="com.example.cricketscores.CricScoreApplication" &gt; P.S: If you really want to use the getInstance() method, it should look like this: public static CricScoreApplication getInstance(Context ctx){ return (CricScoreApplication)(ctx.getApplication()); }
has comment: http://stackoverflow.com/comment/36931823
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23970199
has comment: http://stackoverflow.com/comment/36931750
has comment: http://stackoverflow.com/comment/36931920
accepted answer of: http://stackoverflow.com/q/23970199
type: Answer
has comment: http://stackoverflow.com/comment/36931870
has comment: http://stackoverflow.com/comment/36931736
has comment: http://stackoverflow.com/comment/36931987
score: 2
has comment: http://stackoverflow.com/comment/36931841
downvote count: 0

http://stackoverflow.com/q/24101988
has comment: http://stackoverflow.com/comment/37178189
duplicate of: http://stackoverflow.com/q/1552301
has comment: http://stackoverflow.com/comment/37178214
type: Question
has title: About String object and pass-by-value in Java
answer count: 2
has answer: http://stackoverflow.com/a/24102008
has body: I khow that java is pass-by-value, and when i pass a object into method and change it,it will change when i out method. But i can't do it with String object. This is example: public class text { public void change(String a) { a = "ha"; } public static void main(String[] args) { text a = new text(); String b = "hi"; a.change(b); System.out.println(b); } }
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37178223
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24102000
linked to: http://stackoverflow.com/q/1552301

http://stackoverflow.com/comment/37125672
type: AnswerComment
comment on: http://stackoverflow.com/a/24072813
type: Comment
has text: @Niand What does your outuput look like when you omit the final `$project`? It would seem a field is either misnamed or does not exist in a document somewhere.
score: 1

http://stackoverflow.com/a/24072272
has body: You should change your code to this Scanner inputvar = new Scanner (System.in); String input; System.out.println("Enter yes or no"); input = inputvar.nextLine(); if (input.equals(yes)) { System.out.println("You said yes!"); } else if (input.equals(no)){ System.out.println("You said no"); } Hope this helps and best of luck.
answers question: http://stackoverflow.com/q/24070938
score: 0
type: Answer

http://stackoverflow.com/comment/37046654
type: QuestionComment
comment on: http://stackoverflow.com/q/23960306
score: 0
type: Comment
has text: Regardless of my Errors: How can someone create a SSL Connection between Websphere Application Server and Java Client?

http://stackoverflow.com/comment/37088002
type: QuestionComment
comment on: http://stackoverflow.com/q/24054218
type: Comment
has text: Please show us error logs or exceptions. This is just an information you have provided us.
score: 0

http://stackoverflow.com/q/23969553
tagged with: swt
has comment: http://stackoverflow.com/comment/36930688
has comment: http://stackoverflow.com/comment/36929873
type: Question
has comment: http://stackoverflow.com/comment/36931152
tagged with: label
has body: Hi I'm trying to figure out how to use my own design buttons in my application. In the beginning I tried to create a button and to use setImage() method to cover the button with my own design image. no matter what I tried I never succeeded to cover the hole button, the border of the old button always blinked from behind, or when I resized the shell my button image became too small to cover the old button. I tryied to color the background of the old button, but it turns out that setBackground() method doesn't work on buttons. I have figured out that even though setBackground() doesn't work on button, it doe's work on lables. So now I'm to turn a label to a clickable object by adding some kind of listener to him, but I can’t find a listener that can generate a click event for labels (MouseListener is only sensitive for double click) I will be glad to get some help with figuring out a better way do achive my goal, or a appropriate listener. Im adding a link to the photo of the button. this photo show how the button looks when I strech the shell to maximum. my goal is to make the grey parts disappear. https://i.sstatic.net/1VgmT.jpg thanks.
tagged with: button
linked to: http://stackoverflow.com/q/23729981
tagged with: listener
has comment: http://stackoverflow.com/comment/36933460
has title: SWT - a lot of attempts to create my own design button
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/23729981
answer count: 0
has comment: http://stackoverflow.com/comment/36930010
score: 0
tagged with: java

http://stackoverflow.com/comment/37091316
type: Comment
type: QuestionComment
has text: there is no limit on server listening , put your code so that we can help you .
comment on: http://stackoverflow.com/q/24055947
score: 0

http://stackoverflow.com/q/23957705
accepted answer: http://stackoverflow.com/a/23958083
tagged with: datepicker
possible better answer: http://stackoverflow.com/a/23964027
has title: GWT DateBox - Disable specific date
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has body: I want to disable a specific date in my date box. I tried it with this code, but the specified date (current day) does not get disabled. final DateBox dateBox = new DateBox(); dateBox.getDatePicker().addShowRangeHandler(new ShowRangeHandler&lt;Date&gt;() { @Override public void onShowRange(final ShowRangeEvent&lt;Date&gt; event) { List&lt;Date&gt; disabledDates = new ArrayList&lt;Date&gt;(); disabledDates.add(new Date()); dateBox.getDatePicker().setTransientEnabledOnDates(false, disabledDates); } }); Is there an other way to do this? Edit: Following the example of apanizo, the day 29.5 looks greyed out, but is clickable nevertheless.
has comment: http://stackoverflow.com/comment/36919413
type: Question
has answer: http://stackoverflow.com/a/23958083
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23964027

http://stackoverflow.com/comment/36969659
comment on: http://stackoverflow.com/q/23983590
has text: I'm sorry, I updated my question and posted the code I'm using and the complete output I get. However these are just two errors off the many that may occure. But I can't reconstruct them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36998181
score: 0
has text: It is bit tricky - one way would be to check a boolean `shouldRun` each time and setting that boolean to false after 5 secs. It needs to be volatile or an AtomicBoolean. But that is not exactly the same as cancelling the task. Keeping track of the future to cancel it is more complicated as it will probably require some locking.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24005755

http://stackoverflow.com/comment/37016795
has text: Read the javadoc for `Object`; all is explained
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24016100
score: 0

http://stackoverflow.com/a/24102804
accepted answer of: http://stackoverflow.com/q/24102792
upvote count: 2
answers question: http://stackoverflow.com/q/24102792
has body: instantiate two instances is simple giving memory to two Objects. In c it is equivalent to malloc example Object obj1; Object obj2; obj1 = new Object(); //instantiating object1 obj2 = new Object(); //instantiating object2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/24090645
score: 1
accepted answer of: http://stackoverflow.com/q/24090561
has comment: http://stackoverflow.com/comment/37156195
answers question: http://stackoverflow.com/q/24090561
has body: You have two loops in Deck() - the i loop goes over face values and the j loop goes over suites. However, you always assign to card[i], effectively overwriting it four times, one for each suite. Instead, you should take i into account, and assign the value to card[i * 4 + j]: public Deck() { for(int i = 0; i &lt; 13; i++) { for(int j = 0; j &lt; 4; j++) { index = (i * 4) + j; if(i &lt; 9) card[index] = new Card(Integer.toString(2+i), j); else if(i == 9) card[index] = new Card("J", j); else if(i == 10) card[index] = new Card("Q", j); else if(i == 11) card[index] = new Card("K", j); else card[index] = new Card("A", j); } } }
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36953202
type: QuestionComment
comment on: http://stackoverflow.com/q/23980983
has text: @gikarasojokinene You must include the folder with your class file to the classpath.
score: 0
type: Comment

http://stackoverflow.com/a/23977037
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23976995
type: Answer
answers question: http://stackoverflow.com/q/23976995
has body: The first thing you have to do is to find relationships between indices. Let's say you have the square matrix of length size (size = 5 in the example): 0 1 2 3 4 0 x x 1 x x 2 x 3 x x 4 x x What you can notice is that in the diagonal from (0,0) to (4,4), indices are the same (in the code this means row == col). Also, you can notice that in the diagonal from (0,4) to (4,0) indices always sum up to 4, which is size - 1 (in the code this is row + col == size - 1). So in the code, you will loop through rows and then through columns (nested loop). On each iteration you have to check if the conditions mentioned above are met. The logical OR (||) operator is used to avoid using two if statements. Code: public static void printCross(int size, char display) { for (int row = 0; row &lt; size; row++) { for (int col = 0; col &lt; size; col++) { if (row == col || row + col == size - 1) { System.out.print(display); } else { System.out.print(" "); } } System.out.println(); } } Output: (size = 5, display = 'x') x x x x x x x x x
score: 7
upvote count: 7

http://stackoverflow.com/a/24073704
has body: This brilliant answer to RegEx to split camelCase or TitleCase (advanced) should work nicely. Below is an excerpt from that answer: final String pattern = "(?&lt;!(^|[A-Z]))(?=[A-Z])|(?&lt;!^)(?=[A-Z][a-z])"; for (String w : "TDMaturityReinvestOnNotSelected".split(pattern)) { System.out.println(w); } And the ouput to show it running: Edit: You'll need to reassemble the split words with spaces, but that should be trivial to work out.
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24073573
upvote count: 3

http://stackoverflow.com/q/24034404
tagged with: spring
has title: Spring-mvc org.xml.sax.SAXParseException
has comment: http://stackoverflow.com/comment/37051875
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/24035397
has comment: http://stackoverflow.com/comment/37051286
has body: Using Maven and Spring and Hibernate and Jetty i just copied the web.xml and the servlet-xml from a working project to a new project i have only changed the DAO and Services to make them Generic and i got this exception [INFO] No Transaction manager found - if your webapp requires one, please configure one. [INFO] Initializing Spring FrameworkServlet 'spring' Jun 04, 2014 12:34:02 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'spring': initialization started Jun 04, 2014 12:34:02 PM org.springframework.context.support.AbstractApplicationContext prepareRefre sh INFO: Refreshing WebApplicationContext for namespace 'spring-servlet': startup date [Wed Jun 04 12:3 4:02 AST 2014]; root of context hierarchy Jun 04, 2014 12:34:03 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefin itions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-servlet.xml] Jun 04, 2014 12:34:24 PM org.springframework.util.xml.SimpleSaxErrorHandler warning WARNING: Ignored XML validation warning org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/mvc/spring-mvc.xsd; l ineNumber: 12; columnNumber: 151; schema_reference.4: Failed to read schema document 'http://www.spr ingframework.org/schema/tool/spring-tool-4.0.xsd', because 1) could not find the document; 2) the do cument could not be read; 3) the root element of the document is not <xsd:schema>. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.j ava:99) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:433) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandl er.java:4162) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDH andler.java:41…
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24035397
has comment: http://stackoverflow.com/comment/37051068
upvote count: 1
tagged with: maven

playframework-2.3
tags question: http://stackoverflow.com/q/24007076
tags question: http://stackoverflow.com/q/24066792
type: Tag
tag name: playframework-2.3

http://stackoverflow.com/comment/36975029
has text: @user2357112 You're absolutely right, this won't do for my case. Adding keys happens in various times, there is no defined "build" stage.
type: Comment
comment on: http://stackoverflow.com/a/23990703
score: 0
type: AnswerComment

http://stackoverflow.com/a/24078815
type: Answer
answers question: http://stackoverflow.com/q/24077342
has body: I have changed you class adding one more constructor to initialize fields and just renamed RecipeListViewParcer to RecipeListViewParcel :) package com.tsjd.HotMeals; import java.util.ArrayList; import android.os.Parcel; import android.os.Parcelable; public class RecipeListViewParcel implements Parcelable{ private ArrayList&lt;String&gt; titles; private ArrayList&lt;String&gt; descriptions; private ArrayList&lt;String&gt; images; public RecipeListViewParcel(ArrayList&lt;String&gt; titles, ArrayList&lt;String&gt; descriptions, ArrayList&lt;String&gt; images) { this.titles = titles; this.descriptions = descriptions; this.images = images; } // Convenient constructor to read from Parcel private RecipeListViewParcel(Parcel in) { titles = in.readArrayList(String.class.getClassLoader()); //Need help here descriptions = in.readArrayList(String.class.getClassLoader()); //Need help here images = in.readArrayList(String.class.getClassLoader()); //Need help here } public int describeContents() { return 0; } // This method does actual job to write into the Parcel and called internally // You need to override this method for each child class @Override public void writeToParcel(Parcel out, int flags) { out.writeList(titles); //Need help here out.writeList(descriptions); //Need help here out.writeList(images); //Need help here } public static final Parcelable.Creator&lt;RecipeListViewParcel&gt; CREATOR = new Parcelable.Creator&lt;RecipeListViewParcel&gt;() { public RecipeListViewParcel createFromParcel(Parcel in) { return new RecipeListViewParcel(in); } public RecipeListViewParcel[] newArray(int size) { return new RecipeListViewParcel[size]; } }; }
score: 0

http://stackoverflow.com/q/23967393
has title: cucumber-guice - using the injector
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/12404434
tagged with: guice
answer count: 1
score: 0
tagged with: cucumber-jvm
has body: I am new to cucumber-jvm (and am returning to Java from a cucumber, Ruby background of a couple of years) Using cucumber-guice I have successfully bound my dependencies and loaded my properties in a CucumberModule, and as such the @Inject annotation is triggering as expected. So onto my question, in the provided GuiceFactory I can see the following code: public &lt;T&gt; T More ...getInstance(Class&lt;T&gt; clazz) { return injector.getInstance(clazz); } So I should be able to to do a XXXX.getInstance(myService.class); But what is xxxx? As far as I can tell GuiceFactory is loaded by cucumber-guice on running the tests but I have no idea what then holds the reference to it. Or am I looking at this the completely wrong way.
has answer: http://stackoverflow.com/a/23979636
accepted answer: http://stackoverflow.com/a/23979636
has comment: http://stackoverflow.com/comment/36925955
type: AnsweredQuestion

http://stackoverflow.com/comment/37096347
score: 0
has text: This is a common newbie question, and the answer is that it's not possible, in Java or in most other languages (a few can do it). But what you want to do almost certainly can be done using arrays or Maps, so study up a bit.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24058850

http://stackoverflow.com/a/27487123
upvote count: 2
answers question: http://stackoverflow.com/q/23976804
type: Answer
score: 2
downvote count: 0
has body: I know this is an old question, but I came up with a new solution. Short, and with no complicated conditionals. public boolean twoTwo(int[] nums) { int position = -2; boolean result = true; for (int i = 0; i &lt; nums.length; i++) { if (nums[i] == 2) { result = position == i - 1; position = i; } } return result; }

http://stackoverflow.com/a/24010611
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37006777
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24010468
has comment: http://stackoverflow.com/comment/37007731
has body: The actual filter used by the webapplication will not be the one created by spring in your current configuration. You have to use a DelegatingFilterProxy to use the bean created by spring. Changing your filter in the web.xml file as follows might do the trick: CorsFilter org.springframework.web.filter.DelegatingFilterProxy
score: 3
answers question: http://stackoverflow.com/q/24010468
upvote count: 3

http://stackoverflow.com/q/24102895
tagged with: jtable
has answer: http://stackoverflow.com/a/24102901
has title: Importing text into JTable - Rows aren't separating, they are just creating a single very long row. - Java Swing
answer count: 1
has body: I have created a JTable which is populated by various arraylists. The issue I am having is that the data (all of it) is only going into the top row. Am I supposed to call some sort of row delimiter or something? The code is below: import java.awt.*; import javax.swing.*; import java.io.*; import javax.swing.border.EmptyBorder; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; public class AllDataGUI extends JFrame{ private JButton saveCloseBtn = new JButton("Save Changes and Close"); private JButton closeButton = new JButton("Exit Without Saving"); private JFrame frame=new JFrame("Viewing All Program Details"); private final FileIOManagement fileManage = new FileIOManagement(); private ArrayList&lt;String&gt; nameList = new ArrayList(); private ArrayList&lt;String&gt; courseList = new ArrayList(); private ArrayList&lt;String&gt; semesterList = new ArrayList(); private ArrayList&lt;String&gt; moderatorList = new ArrayList(); private ArrayList&lt;String&gt; majorList = new ArrayList(); private ArrayList&lt;String&gt; programList = new ArrayList(); private JTable textArea = new JTable(); public ArrayList&lt;String&gt; getNameList(){ return this.nameList; } public ArrayList&lt;String&gt; getCourseList(){ return this.courseList; } public ArrayList&lt;String&gt; getSemesterList(){ return this.semesterList; } public ArrayList&lt;String&gt; getModeratorList(){ return this.moderatorList; } public ArrayList&lt;String&gt; getProgramList(){ return this.programList; } public ArrayList&lt;String&gt; getMajorList(){ return this.majorList; } public void setNameList(ArrayList&lt;String&gt; nameList){ this.nameList = nameList; } public void setCourseList(ArrayList&lt;String&gt; courseList){ this.courseList = courseList; } public void setSemesterList(ArrayList&lt;String&gt; semesterList){ this.semesterList = semesterList; } public void setModeratorList(ArrayList&lt;String&gt; moderatorList){ this.moderatorList = moderatorList; } publi…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24102901
score: 0
tagged with: swing
type: Question
tagged with: java

http://stackoverflow.com/q/23973561
has body: Can I somehow prepend a minus sign to a numeric String and convert it into an int? In example: If I have 2 Strings : String x="-"; String y="2"; how can i get them converted to an Int which value is -2?
tagged with: integer
has comment: http://stackoverflow.com/comment/36937767
accepted answer: http://stackoverflow.com/a/23981127
possible better answer: http://stackoverflow.com/a/23973591
tagged with: java
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36936398
has answer: http://stackoverflow.com/a/23973591
has comment: http://stackoverflow.com/comment/36938009
has comment: http://stackoverflow.com/comment/36936544
has comment: http://stackoverflow.com/comment/36938066
has comment: http://stackoverflow.com/comment/36936444
has comment: http://stackoverflow.com/comment/36936432
has comment: http://stackoverflow.com/comment/36936584
has comment: http://stackoverflow.com/comment/36936575
has comment: http://stackoverflow.com/comment/36937856
has comment: http://stackoverflow.com/comment/36936569
has comment: http://stackoverflow.com/comment/36938063
has comment: http://stackoverflow.com/comment/36936477
has comment: http://stackoverflow.com/comment/36936414
has title: Java - Construct a signed numeric String and convert it to an integer
tagged with: sign
has comment: http://stackoverflow.com/comment/36937512
has comment: http://stackoverflow.com/comment/36937985
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36936491
has answer: http://stackoverflow.com/a/23981127
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36936534
has comment: http://stackoverflow.com/comment/36936471
type: Question
has comment: http://stackoverflow.com/comment/36936427
has comment: http://stackoverflow.com/comment/36936446
has comment: http://stackoverflow.com/comment/36936964
has comment: http://stackoverflow.com/comment/36936916
has comment: http://stackoverflow.com/comment/36936700
score: -2

http://stackoverflow.com/comment/36894293
comment on: http://stackoverflow.com/a/23950267
score: 0
type: AnswerComment
type: Comment
has text: @paddy I have added the explanation. Hope now it is ok for you

http://stackoverflow.com/comment/37159015
type: QuestionComment
comment on: http://stackoverflow.com/q/24092257
has text: My idea is to simulate a kind of random choice and after that I will make further verifications
type: Comment
score: 0

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/24064260
tags question: http://stackoverflow.com/q/24042224

http://stackoverflow.com/a/31422603
type: Answer
score: 6
has body: XWPFDocument (docx) has different kind of sub-elements like XWPFParagraphs, XWPFTables, XWPFNumbering etc. Once you create XWPFDocument object via: document = new XWPFDocument(inputStream); You can iterate through all of Paragraphs: document.getParagraphsIterator(); When you iterator through Paragraphs, For each Paragraph you will get multiple XWPFRuns which are multiple text blocks with same styling, some times same styling text blocks will be split into multiple XWPFRuns in which case you should look into this question to avoid splitting of your Runs, doing so will help identify your placeHolders without merging multiple Runs within same Paragraph. At this point you should expect that your placeHolder will not be split in multiple runs if that's the case then you can go ahead and Iterate over 'XWPFRun's for each paragraph and look for text matching your placeHolder, something like this will help: XWPFParagraph para = (XWPFParagraph) xwpfParagraphElement; for (XWPFRun run : para.getRuns()) { if (run.getText(0) != null) { String text = run.getText(0); Matcher expressionMatcher = expression.matcher(text); if (expressionMatcher.find() &amp;&amp; expressionMatcher.groupCount() &gt; 0) { System.out.println("Expression Found..."); } } } Where expressionMatcher is Matcher based on a RegularExpression for particular PlaceHolder. Try having regex that matches something optional before your PlaceHolder and after as well e.g \([]*)(PlaceHolderGroup)([]*)^, trust me it works best. Once you find the right XWPFRun extract text of your interest in it and create a replacement text which should be easy enough, then you should replace new text with previous text in this particular run by: run.setText(text, 0); If you were to replace this whole XWPFRun with a completely a new XWPFRun or perhaps insert a new Paragraph/Table after the Paragraph owning this run, you would probably run into a few problems, like A. ConcurrentModificationException which means you cannot modify this List(of…
has comment: http://stackoverflow.com/comment/50821775
has comment: http://stackoverflow.com/comment/104531458
downvote count: 0
answers question: http://stackoverflow.com/q/24085366
upvote count: 6

http://stackoverflow.com/comment/37012572
comment on: http://stackoverflow.com/q/24009149
has text: `That multithreading also looks suspicious, though.`as immibis said. The second thread will consume one core totally or otherwise have a great impact on speed. You could just copy to buffer where you set `doStop=false` and then only start a thread to copy to the player. Or no thread and just copy/write there too.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24076509
has title: Read unsigned integers in little endian byte order from a socket
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24076938
favorite count: 0
duplicate of: http://stackoverflow.com/q/5616052
has answer: http://stackoverflow.com/a/24076742
tagged with: sockets
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5616052
has body: I am trying to connect to port 5842 on vortex.labs.overthewire.org and read in 4 unsigned integers in host byte order.The server vortex.labs.overthewire.orgis on an 32bit x86 machine (meaning, a little endian architecture) Can it be something like this in Java? Socket socket = new Socket("vortex.labs.overthewire.org", 5842 ); InputStream in = socket.getInputStream(); int c; while((c=in.read())!=-1){ System.out.println((byte)c); }
possible better answer: http://stackoverflow.com/a/24076742
tagged with: endianness
accepted answer: http://stackoverflow.com/a/24076938

http://stackoverflow.com/comment/36933548
comment on: http://stackoverflow.com/a/23970884
type: AnswerComment
has text: My app is running on Tomcat. There is not any KDC. Each of useres is in different place (different local network) in the world. My aim is to use kerebros for secured communication. But kerberos require to authenticate users and I dont need it. My app is not secured now and my supervisor told me I have to find any way to secure it by kerberos. Only check if it is difficult or not and how much we have to modify our app. So I would't like to solve servers around, but only implementation kerberos to app.
type: Comment
score: 1

http://stackoverflow.com/q/23983541
has answer: http://stackoverflow.com/a/23983637
has comment: http://stackoverflow.com/comment/36956113
type: UnansweredQuestion
type: Question
has body: So I've looked at "questions that may already have my answer" but, despite getting the same error message as those questions, I think I may have a different issue: //find greatest product generated by 5 consecutive integers below class project_euler8 { public static String numbers = "73167176531330624919225119674426574742355349194934" + "96983520312774506326239578318016984801869478851843" + "85861560789112949495459501737958331952853208805511" + "12540698747158523863050715693290963295227443043557" + "66896648950445244523161731856403098711121722383113" + "62229893423380308135336276614282806444486645238749" + "30358907296290491560440772390713810515859307960866" + "70172427121883998797908792274921901699720888093776" + "65727333001053367881220235421809751254540594752243" + "52584907711670556013604839586446706324415722155397" + "53697817977846174064955149290862569321978468622482" + "83972241375657056057490261407972968652414535100474" + "82166370484403199890008895243450658541227588666881" + "16427171479924442928230863465674813919123162824586" + "17866458359124566529476545682848912883142607690042" + "24219022671055626321111109370544217506941658960408" + "07198403850962455444362981230987879927244284909188" + "84580156166097919133875499200524063689912560717606" + "05886116467109405077541002256983155200055935729725" + "71636269561882670428252483600823257530420752963450"; public static int calculateProduct(int[] myArray) { int product = 1; for (int i = 0; i &lt; myArray.length; i++) { product *= myArray[i]; } return product; } public static void main(String[] args) { //declare biggest_product, temporary array int biggest_product = 0; int[] temp = new int[5]; //loop through each sequence of 5 integers for (int i = 0; i &lt; numbers.length() - 5; i++) { int remainder = i % 5; **temp[remainder] = Integer.parseInt(numbers[i]);** int candidate_product = calculateProduct(temp); if (candidate_product &gt; biggest_product) { biggest_product = candidate_product; } } System.out.println("…
tagged with: java
has title: compiler error: Array required, but java.lang.String found
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23983601
has comment: http://stackoverflow.com/comment/36956001
has comment: http://stackoverflow.com/comment/36956107

http://stackoverflow.com/q/23979524
has title: JOOQ forced type code generation
score: 4
tagged with: type-conversion
tagged with: postgresql
tagged with: jooq
answer count: 1
has body: I'm having some problems generating code using forced types (JOOQ 3.3, Postgres 9.3). Trying to convert sql timestamp to joda DateTime, leads me to compilation errors. My table: CREATE TABLE book ( // [...] date_published timestamp without time zone, // [...] ); and my .xml config: // [...] java.sql.Timestamp com.plannow.jooq.converters.DateTimeConverter java.sql.Timestamp .*\.date_.* .* // [...] DateTimeConverter class: public class DateTimeConverter implements Converter<Timestamp, DateTime> { @Override public DateTime from(Timestamp databaseObject) { return new DateTime(databaseObject); } @Override public Timestamp to(DateTime userObject) { return new Timestamp(userObject.getMillis()); } @Override public Class<Timestamp> fromType() { return Timestamp.class; } @Override public Class<DateTime> toType() { return DateTime.class; } } So, BOOK.DATE_PUBLISHED is being generated like this: public final org.jooq.TableField<com.plannow.jooq.db.tables.records.BookRecord, java.sql.Timestamp> DATE_PUBLISHED = createField("date_published", org.jooq.impl.SQLDataType.TIMESTAMP, this, "", new com.plannow.jooq.converters.DateTimeConverter()); which leads to compilation error: Type mismatch: cannot convert from TableField<BookRecord,DateTime> to TableField<BookRecord,Timestamp>. I know i can change type of DATE_PUBLISHED to TableField<BookRecord,DateTime> and refactor the code, but i dont want to patch the generated classes manually. Any ideas what am i doing wrong?
favorite count: 0
accepted answer: http://stackoverflow.com/a/23980198
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23980198
downvote count: 0

http://stackoverflow.com/q/23970715
has title: Java: Mixing together two double bitstrings for Genetic Algorithm crossover
accepted answer: http://stackoverflow.com/a/23971996
answer count: 1
tagged with: bitarray
tagged with: evolutionary-algorithm
type: AnsweredQuestion
tagged with: genetic-algorithm
tagged with: java
has body: I am implementing evolutionary neural network. I ran into problem when it comes to the crossover of two double values. I am evolving the weights of the links in the Neural Network. //Get the weights that I want to crossover double weightA = a.getWeight(); double weightB = b.getWeight(); //Round to 6 decimal numbers. weightA = (double)Math.round(weightA * 1000000) / 1000000; weightB = (double)Math.round(weightB * 1000000) / 1000000; //Convert the doubles to binary strings String binaryA = Long.toBinaryString(Double.doubleToRawLongBits(weightA)); String binaryB = Long.toBinaryString(Double.doubleToRawLongBits(weightB)); //Define random crossover point. int crossOverPoint = randInt(0, binaryA.length()); //Put the strings together based on the crossover point. String newBinary = binaryA.substring(0,crossOverPoint) + binaryB.substring(crossOverPoint+1,binaryB.length()); double newWeight = Double.longBitsToDouble(new BigInteger(newBinary, 2).longValue()); The problem I am encountering is that I am getting very large or very small weights after crossover which is probably the result of something about how many bits are used in each string for decimal places. How should I do this to get values after crossover that are similar to the two parents? I had a workaround for this problem that gave me decent results but I am fairly sure that is not the correct approach, which basically finds the average between the two values and adds some Gaussian noise with standard deviation based on the interval of the original two values. double interval = Math.abs(weightA-weightB); double newWeight = (weightA+weightB)*0.5 + r.nextGaussian()*interval*2;
type: Question
has answer: http://stackoverflow.com/a/23971996
score: 0

jar
tags question: http://stackoverflow.com/q/24074358
tags question: http://stackoverflow.com/q/23979048
tags question: http://stackoverflow.com/q/24077169
tags question: http://stackoverflow.com/q/24083920
tags question: http://stackoverflow.com/q/24048157
tags question: http://stackoverflow.com/q/23966937
tags question: http://stackoverflow.com/q/23960849
tags question: http://stackoverflow.com/q/23974583
tags question: http://stackoverflow.com/q/24033863
tags question: http://stackoverflow.com/q/23944387
tags question: http://stackoverflow.com/q/23942777
tags question: http://stackoverflow.com/q/24004703
type: Tag
tags question: http://stackoverflow.com/q/23975609
tags question: http://stackoverflow.com/q/23959388
tags question: http://stackoverflow.com/q/23964045
tags question: http://stackoverflow.com/q/23968500
tags question: http://stackoverflow.com/q/23958361
tags question: http://stackoverflow.com/q/24096513
tags question: http://stackoverflow.com/q/24004084
tags question: http://stackoverflow.com/q/24089961
tags question: http://stackoverflow.com/q/23995099
tags question: http://stackoverflow.com/q/23952824
tags question: http://stackoverflow.com/q/24068171
tags question: http://stackoverflow.com/q/23945407
tags question: http://stackoverflow.com/q/24065678
tags question: http://stackoverflow.com/q/24000812
tags question: http://stackoverflow.com/q/24011169
tags question: http://stackoverflow.com/q/24033804
tags question: http://stackoverflow.com/q/24085347
tags question: http://stackoverflow.com/q/24058759
tag name: jar
tags question: http://stackoverflow.com/q/24029051
tags question: http://stackoverflow.com/q/24029349
tags question: http://stackoverflow.com/q/23990607
tags question: http://stackoverflow.com/q/24061891
tags question: http://stackoverflow.com/q/24060598
tags question: http://stackoverflow.com/q/24067295
tags question: http://stackoverflow.com/q/24033212
tags question: http://stackoverflow.com/q/23962862
tags question: http://stackoverflow.com/q/23980423
tags question: http://stackoverflow.com/q/23987760
tags question: http://stackoverflow.com/q/24060272
tags question: http://stackoverflow.com/q/24044567
tags question: http://stackoverflow.com/q/24063020
tags question: http://stackoverflow.com/q/23996168
tags question: http://stackoverflow.com/q/23942014
tags question: http://stackoverflow.com/q/24069763
tags question: http://stackoverflow.com/q/23992083
tags question: http://stackoverflow.com/q/23959209
tags question: http://stackoverflow.com/q/24057531
tags question: http://stackoverflow.com/q/24045109
tags question: http://stackoverflow.com/q/24069198
tags question: http://stackoverflow.com/q/23987633
tags question: http://stackoverflow.com/q/24018149
tags question: http://stackoverflow.com/q/24099921

http://stackoverflow.com/comment/37051664
score: 0
type: Comment
type: QuestionComment
has text: @rmuller : This is just a part of code. The whole code was pretty huge. It compiles fine
comment on: http://stackoverflow.com/q/24034767

http://stackoverflow.com/comment/36886713
has text: Hi @shazin I agree and I was trying to do exactly the same but I didn't allow me to configure it like that. I was getting this error: java.lang.IllegalArgumentException: Can not set com.agrichem.server.services.security.CustomUserDetailsService field com.agrichem.server.web.security.WebSecurityConfig.customUserDetailsService to com.sun.proxy.$Proxy34
type: AnswerComment
comment on: http://stackoverflow.com/a/23945839
score: 0
type: Comment

http://stackoverflow.com/q/23976499
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23976573
has comment: http://stackoverflow.com/comment/36942669
answer count: 1
has title: Creating Reset JButton?
has comment: http://stackoverflow.com/comment/36942833
favorite count: 0
has comment: http://stackoverflow.com/comment/36942634
tagged with: reset
accepted answer: http://stackoverflow.com/a/23976573
has body: I am trying to write code for a JButton that when clicked would reset a value. In this case it is the random value of a dice that I am trying to generate over and over with a new random value each time it is clicked. I know if I create a new instance of the class it will generate a different value, so perhaps I need to generate multiple instances? I really am trying to make this a situation where you can keep clicking the button and a new number will be generated until you quit. class RollDice {//Begin RollDice Class //Initiate method rollDice public static int rollDice(int number, int nSides) { //System.out.println( "--- Welcome to the Dice Game v2! ---" ); // welcomes player Random r = new Random(); //Declare class variables int num = 0; int roll = 0; if(nSides &gt;= 3) { for(int i = 0; i &lt; number; i++) { roll = r.nextInt(nSides)+1; //System.out.println("Roll is: " + roll); num = num + roll; } } else { System.out.println("Error num needs to be from 3"); } return num; } //end method rollDice int d4 = rollDice(1, 4); int d6 = rollDice(1, 6); int d8 = rollDice(1, 8); int d10 = rollDice(1, 10); int d12 = rollDice(1, 12); int d20 = rollDice(1, 20); public RollDice () { this.d4 = d4; } public void setD4 (int D4) { this.d4 = D4; } public int getD4 () { return d4; } ////////////////// { this.d6 = d6; } public void setD6 (int D6) { this.d6 = D6; } public int getD6 () { return d6; } ////////////////// { this.d8 = d8; } public void setD8 (int D8) { this.d8 = D8; } public int getD8 () { return d8; } ////////////////// { this.d10 = d10; } public void setD10 (int D10) { this.d10 = D10; } public int getD10 () { return d10; } ////////////////// { this.d12 = d12; } public void setD12 (int D12) { this.d12 = D12; } public int getD12 () { return d12; } ////////////////// { this.d20 = d20; } public void setD20 (int D20) { this.d20 = D20; } public int getD20 () { return d20; } ////////////////// }// End RollDice Class
has comment: http://stackoverflow.com/comment/37070138
upvote count: 1
tagged with: jbutton
type: Question
type: AnsweredQuestion
score: -2

http://stackoverflow.com/q/24058968
has answer: http://stackoverflow.com/a/24059202
has answer: http://stackoverflow.com/a/24059403
accepted answer: http://stackoverflow.com/a/24059403
type: AnsweredQuestion
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/37097224
has comment: http://stackoverflow.com/comment/37097059
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37097082
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37097205
possible better answer: http://stackoverflow.com/a/24059202
tagged with: android-button
answer count: 2
has title: Delete [Reverse Backspace] Button
has comment: http://stackoverflow.com/comment/37096946
downvote count: 0
has comment: http://stackoverflow.com/comment/37097037
has comment: http://stackoverflow.com/comment/37097124
favorite count: 0
tagged with: android
has body: I have built a delete button, just like in Windows, which removes the string on the right hand side of the cursor(one by one). [Instead of the mainstream Backspace which removes the left side.] However, when the right side is null, the onClickListener should display a toast message. But the app crashes. This is what I made : package com.reverse.app; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView.BufferType; import android.widget.Toast; public class MainActivity extends Activity { public Toast t; Editable a, b, d, f, a1; String e; public int c, d1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText ed; Button dlt; dlt = (Button) findViewById(R.id.button1); ed = (EditText) findViewById(R.id.editText1); dlt.setOnClickListener(new OnClickListener() { public void onClick(View v) { a = ed.getEditableText(); b = a; c = ed.getSelectionStart(); boolean daj = b.toString().isEmpty(); if (!daj) { String a22 = b.toString().substring(0, c); int strChar = a11.length(); String strcut = a11.substring(1, strChar); e = a22.concat(strcut); ed.setText(e, BufferType.EDITABLE); b = ed.getEditableText(); ed.setSelection(c); } else { Toast.makeText(getApplicationContext(), "Cool", t.LENGTH_SHORT).show(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } Logcat : 06-05 17:03:41.394: E/AndroidRuntime(967): FATAL EXCEPTION: main 06-05 17:03:41.394: E/AndroidRuntime(967): java.lang.StringIndexOutOfBoundsException: length=0; regionStart=1; regionLength=-1 06-05 17:03:41.394: E/AndroidRuntime(967): at java.lang.String.start…

http://stackoverflow.com/a/23955732
has comment: http://stackoverflow.com/comment/36903729
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23955313
score: 1
has comment: http://stackoverflow.com/comment/36904940
downvote count: 0
has body: Rather than spend time making classes that have limited use, like a Time object which really doesn't have any use except in the context of a containing Date, focus on making Dates easier to manipulate maybe. Using the set methods on the calendar is a serious drag and it's ugly. The Date/Time stuff got blown up in Java 8 in part because of this. That said, I got kind of fed up a while ago and made a DateBuilder which uses the fluent builder design pattern to let you easily construct dates using an approach like this: Date newDate = new DateBuilder().hour(10).minute(20).build(); Eventually I added a bunch of other conveniences that are a nuisance like giving me midnight, or letting me just add time. The thing that really sucks about the way Dates work in Java is that you find yourself writing a lot of code, it's ugly, and it greatly decreases the readability of the surrounding code. Builder compartmentalizes that. The part that surprises people is how easy it is to just jump into your own class and add something like an add function, e.g.: new DateBuilder(new Date()).addDays(3).build(); I played around with the new Date stuff in 8 and it is nicer. Joda is nicer too, but the funny thing is ultimately I ended up not liking Joda that much because while it was nicer, it just brought some of the same things into the code, and it failed one of the most important tests of a library you adopt: I kept having to go back and read the docs each time I used it. Using Categories in Objective-C convinced me that it's often best to fashion the top layer of the code you will be touching yourself, in part because you are more likely to make something you will use fluidly (hence the name), but also because it's a quasi-DSL: if I were to do programming in a different domain, I might want a different DateBuilder that emphasized other things.

http://stackoverflow.com/a/24117127
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/57297083
has body: While refactoring the method from where this question came from I have managed to get isDirectory() to evaluate as true when zipEntry is the folder itself (yey!) I was refactoring while referencing the following guide: http://www.mkyong.com/java/how-to-decompress-files-from-a-zip-file/ It seems that the confusion was from creating ZipEntry within the while (unless you can see any other difference) ZipInputStream zis; ZipEntry zipEntry; try { zis = new ZipInputStream(filePart.getInputStream()); zipEntry = zis.getNextEntry(); } catch (IOException ioExc) { //do something; } while(zipEntry != null){ //if you run me I will infinitely loop! String fileName = zipEntry.getName(); System.out.println("I am the directory! " +zipEntry.isDirectory() + " " + zipEntry.getName()); }
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23992509
answers question: http://stackoverflow.com/q/23992509
type: Answer

http://stackoverflow.com/q/24103333
has title: Hibernate Error Message: IntegratorServiceImpl
score: 2
answer count: 0
downvote count: 0
tagged with: tomcat8
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37181210
upvote count: 2
has body: I am currently trying to use Hibernate ORM in one of my projects. And when I try to initiate a ServiceRegistry object i get an error message which I cannot solve, even though I've been looking at several tutorials and I seem to get the same error every time. I am running Hibernate with Tomcat and Jersey. This is the class that initiates Hibernate: import com.example.hibernate.HibernateUtil; import com.example.hibernate.entities.Users; import org.hibernate.Session; import java.util.Date; public class Spider { public Spider(){ Users user = new Users(); user.setUserid(1); user.setUsername("Quncage"); user.setEmail("quncage@example.com"); Date now = new Date(); int Time = (int) (now.getTime()/1000); user.setRegister_time(Time); user.setActive(1); user.setBanned(0); user.setVacation(0); user.setConfimed(1); user.setUltra_user(1); //Get Session Session session = HibernateUtil.getSessionFactory().getCurrentSession(); //start transaction session.beginTransaction(); //Save the Model object session.save(user); //Commit transaction session.getTransaction().commit(); System.out.println("Userid="+user.getUserid()); //terminate session factory, otherwise program won't end HibernateUtil.getSessionFactory().close(); } } This is the HibernateUtil function: import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; public class HibernateUtil { //XML based configuration private static SessionFactory sessionFactory; private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml Configuration configuration = new Configuration().configure("hibernate.cfg.xml"); System.out.println("Hibernate Configuration loaded"); /* Error seems to be triggered here */ ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); System.out.println("Hibernate service…
tagged with: mysql
tagged with: java
tagged with: hibernate
type: UnansweredQuestion

http://stackoverflow.com/comment/36900396
type: QuestionComment
type: Comment
has text: @DoctororDrive he has set the height of fragment layout to match parent so it should work in my guess and thats what i usually do
score: 0
comment on: http://stackoverflow.com/q/23953599

http://stackoverflow.com/comment/37059773
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24024857
has text: But how do you ensure that your Java app can respond to for instance a request to refresh the configuration or gracefully shut down? For unix processes you can use signals to ask the process to refresh its configuration or to gracefully shut down, but thats for unix only...

http://stackoverflow.com/comment/36943029
comment on: http://stackoverflow.com/a/23976690
type: AnswerComment
score: 0
type: Comment
has text: this is what i got [Object {id="demo", timer=100, start=0, ...}, Object {id="demo", timer=62, start=0, ...}, Object {id="demo", timer=22, start=0, ...}, Object {id="demo", timer=44, start=0, ...}, Object {id="demo", timer=55, start=0, ...}, Object {id="demo", timer=55, start=0, ...}, Object {id="demo", timer=55, start=0, ...}, Object {id="demo", timer=55, start=0, ...}, Object {id="demo", timer=55, start=0, ...}, Object {id="demo", timer=56, start=0, ...}, Object {id="demo", timer=44, start=0, ...}]

http://stackoverflow.com/comment/36906328
type: Comment
comment on: http://stackoverflow.com/q/23956876
has text: @pskink i need to use colour. Because the margins change
score: 0
type: QuestionComment

http://stackoverflow.com/q/23957674
has comment: http://stackoverflow.com/comment/36909367
upvote count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has body: I'm not sure this is the right question or set of frameworks. The list of frameworks I'm aware of being involved to some degree here are: Spring Hibernate QueryDSL I've been trying to get to grips with a web application using this stuff on the server side and had basically come to the conclusion that the server was a collection of static methods, which had state eg objects etc for only the duration of individual method calls, with basically a huge pile of reflective code generation thrown in to make things confusing easy. I've just come across the transient annotation and this has thrown my idea of what is going on out the window. Im not really sure what's relevant so I'll describe the situation I'm looking at: At login time we are querying a table in the database which has user information in it. Update This is from a class that implements UserDetailsService (a spring class) in the method that defines (loadUserByUsername(String username). This gets called in a class extends AbstractUserDetailsAuthenticationProvider which is set as the authentication provider. In practice this means it gets called as users login to our webapp. There can be more than one user logged in at any given time. This is done using a jpa repository and some querydsl predicate. UserDetails userDetails = userRepository.findOneLoaded(UserPredicates.hasUserNameEqualsIgnoreCase(username)); Then comes the bit that is confusing: Division division = divisionRepository.findDefaultDivision((User) userDetails); ((User) userDetails).setCurrentDivision(division); And that's it. The setter just sets a field which is marked as @Transient and then none of the code in this stack uses this value. It does have usages scattered throughout the project however, which would presumably fail (there aren't any tests so that could actually be the case!) if it was null. What is happening here? How long do these assignments last? And I suppose on a related note, how long are the other 'objects' lasting for? Is my mental …
tagged with: querydsl
has title: What is the lifetime of assignments to fields marked as transient within a spring/jpa application?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36908169
has comment: http://stackoverflow.com/comment/36912788
tagged with: spring
type: Question
has comment: http://stackoverflow.com/comment/37011775
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37011827

http://stackoverflow.com/a/24090331
downvote count: 0
answers question: http://stackoverflow.com/q/24090273
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37155410
accepted answer of: http://stackoverflow.com/q/24090273
type: Answer
score: 1
upvote count: 1
has body: Your query is selecting just the name (string?) from the table: String query = "SELECT distinct forfait.forfaitNom FROM Forfait forfait"; What you want to do it return everything, so try: String query "from Forfait" instead. This will return the full object/table instead of just a column from it. Update based on comment If you need to keep the query the same, and are only looking for the name, then change your for loop to the following: for(Object o : resultList) { Forfaits[i] = (String)o; i++; } You are only selecting names in your select statement, so resultList will be a list of Strings

http://stackoverflow.com/a/23950572
has body: Generally cancelling threads from outside the thread itself contains all sorts of risks that aren't obvious at first. A safer approach is to have the thread when it starts check to see whether it still needs to run.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23950492

http://stackoverflow.com/a/24078256
type: Answer
answers question: http://stackoverflow.com/q/24077436
has body: First of all, please don't use the deprecated endpoint: String STR_FACEBOOK_FQL_URL = "https://graph.facebook.com/fql?q="; is the way to go now. You're using non-existing fields for the page table (see https://developers.facebook.com/docs/reference/fql/page/). likes needs to be replaced by fan_count: String FQL_GET_QUERY= "SELECT name,fan_count,about FROM page WHERE id={page-id}";
score: 0

http://stackoverflow.com/q/24072095
has comment: http://stackoverflow.com/comment/37121231
type: Question
downvote count: 4
upvote count: 0
has body: Hey I have a simple tic tac toe game for an eclipse, but the loop won't break. The loop fills up my board with 2s. The loop is at the end method computerInput(). The loop still won't break after setting done = true in the while(!done) scope.I have to go for a little while. Thanks for the help though guys! I'll be back in a few hours. package lab15; public class WinnerCheck { public static int PL_ONE = 1; public static int PL_TWO = 2; static Console console = new Console(); static final int PAUSE = 500; public static int i = 3; public static int j = 3; public static int[][] b = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; public static void main(String[] args) { boolean done = false; while (!done) { printBoard(b); playerOneInput(); pause(PAUSE); computerInput(b); detectWinner(b); console.clear(); int result = detectWinner(b); if(result &gt; 0) done = true; } } public static void pause(int ms) { try { Thread.sleep(ms); } catch (Exception ex) { } } public static boolean placePiece(int[][] b, int r, int c, int player) { b[r][c] = player; return false; } public static boolean isWinner(int[][] b, int player) { // check for a horizontal winner for (int i = 0; i &lt; b.length; i++) { int count = 0; for (int j = 0; j &lt; b[i].length; j++) { if (b[i][j] == player || b[j][i] == player ) { count++; } } if (count == b[i].length) return true; } return false; } public static int detectWinner(int[][] b) { if (isWinner(b, PL_ONE)) { return 1; } else if (isWinner(b, PL_TWO)) { return 2; } else { return 0; } } public static void printBoard(int[][] b) { System.out.println("------"); for (int[] row : b) { for (int element : row) { System.out.print(element + " "); } System.out.println(""); } System.out.println("------"); System.out.println("winner: " + detectWinner(b)); } public static void playerOneInput() { switch (console.getKey()) { case '1': placePiece (b, 0, 0, 1); break; case '2': placePiece (b, 0, 1, 1); break; case '3': placePiece (b, 0, 2, 1); break; case '4': placePiece (b, 1, …
has comment: http://stackoverflow.com/comment/37121238
has title: Loop wont break
favorite count: 0
has answer: http://stackoverflow.com/a/24072118
has answer: http://stackoverflow.com/a/24072120
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/37121247
has answer: http://stackoverflow.com/a/24072109
answer count: 4
has answer: http://stackoverflow.com/a/24072822
tagged with: java

http://stackoverflow.com/a/24055411
upvote count: 2
has body: You have a couple choices: Make the variable outside the anonymous class an instance variable: public class AnonymousClass extends JFrame { private JLabel label; ... public AnonymousClass() { ... btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { label.setText(textField.getText()); } }); ... } You can also access the instance variable as follows: AnonymousClass.this.label.setText(textField.getText()); Use the final modifier on the local variable: public class AnonymousClass extends JFrame { ... public AnonymousClass() { final JLabel label = new JLabel("Enter a new message!"); btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { label.setText(textField.getText()); } }); ... } Be aware that using the final modifier will mean you cannot re-assign the variable at a later point in your program.
type: Answer
answers question: http://stackoverflow.com/q/24055105
score: 2
downvote count: 0

http://stackoverflow.com/comment/37052077
has text: other comments, you don't have to compare both count == 10 && count != 0, just count == 10. Also you can use entry.equals(password). And you can put the you got a "free coffe if statement" inside the first if
score: 0
comment on: http://stackoverflow.com/q/24034906
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24073285
has comment: http://stackoverflow.com/comment/37123356
type: Question
has body: My understanding is that an interface cannot be instantiated directly, unless you define an anonymous inner class implementing that interface. But much to my surprise and confusion I see some code which seems to instantiate an interface. Here is the code: public final class SqlProviders { private static boolean installed_; private static ThreadLocal&lt;SqlAggregateProvider&gt; fortaskInfo_ = new ThreadLocal&lt;TaskInfoProvider&gt;(); } public interface TaskInfoProvider { int getTaskIndex(); int getTaskCount(); long getSessionId(); long getStatementId(); long getFunctionInstanceId(); boolean isTaskInfoAvailable(); void setTaskInfoAvailable(boolean available); } Can anyone please explain this?
has comment: http://stackoverflow.com/comment/37123295
score: 0
answer count: 1
has title: Instantiating an interface in java
tagged with: interface
has answer: http://stackoverflow.com/a/24073303
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37123291
tagged with: java

http://stackoverflow.com/q/23947825
tagged with: caching
has title: Cache implementation using cache framework
answer count: 2
has answer: http://stackoverflow.com/a/40104658
has body: I want to implement the cache in java. Below is my requirement I want to cache one table on server startup.Onece cached,I will fetch the data from cache like i will give key and it will return a value associated that key but suppose if key is not present than it will call a method and from that i can put the data in cache with that key and return me that value. I googled and found google guava cache and to implement my requirement it is one option but if possile than i want to know some other Cache frameworks so that i can choose option from that. Please note that I am using JSP,Servelet JDBC means not using any spring,Hibernate or like that framework in my application. Any help would be appriciated Thanks in advance
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/36892042
has comment: http://stackoverflow.com/comment/36891242
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23949375
type: Question
has comment: http://stackoverflow.com/comment/36890220
tagged with: java

http://stackoverflow.com/comment/36983132
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23989759
type: AnswerComment
has text: Thanks anyway, I will test on another machine.

http://stackoverflow.com/comment/37179692
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24102752
type: Comment
has text: its work in the case of non generic class but not work in class with generic type .Is there other way for generic class or a way to convert generic class to non generic class.please help

http://stackoverflow.com/comment/36896325
comment on: http://stackoverflow.com/q/23951451
score: 0
type: Comment
type: QuestionComment
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) Provide ASCII art (or an image with a simple drawing) of the GUI as it should appear in smallest size and (if resizable) with extra width/height.

http://stackoverflow.com/q/24084102
tagged with: swing
type: AnsweredQuestion
tagged with: components
tagged with: java
possible better answer: http://stackoverflow.com/a/24084156
has answer: http://stackoverflow.com/a/24084533
has answer: http://stackoverflow.com/a/24084156
accepted answer: http://stackoverflow.com/a/24084533
type: Question
answer count: 2
tagged with: user-interface
tagged with: label
score: 0
has title: Swing GUI doesn't update during data processing
has body: I'm having a problem where my Swing GUI components aren't updating for me while the program is busy. I'm creating an image editor and while heavy processing is happening, I try to change a "status" label while its working to give the user an idea of whats going on. The label won't update until after the processing is finished though. How can I update the label IMMEDIATELY instead of having to wait? My labels are all on a JPanel by the way. My label isn't set until after the for loop and the following method finishes. labelStatus.setText("Converting RGB data to base 36..."); for (int i = 0; i &lt; imageColors.length; i++) { for (int j = 0; j &lt; imageColors[0].length; j++) { //writer.append(Integer.toString(Math.abs(imageColors[i][j]), 36)); b36Colors[i][j] = (Integer.toString(Math.abs(imageColors[i][j]), 36)); } } String[][] compressedColors = buildDictionary(b36Colors);//CORRECTLY COUNTS COLORS

http://stackoverflow.com/comment/37122779
type: Comment
type: AnswerComment
score: 0
has text: user2864740 managed to edit it in JUST before you posted it. :(
comment on: http://stackoverflow.com/a/24073031

http://stackoverflow.com/comment/37136093
has text: At the same location you want setLocation and repaint to be invoked - meaning in the same place where they are invoked right now.
comment on: http://stackoverflow.com/a/24080494
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/51319862
type: Comment
score: 0
has text: possible duplicate of [Replace Eclipse with Sublime Text 2/3 for java](http://stackoverflow.com/questions/18992250/replace-eclipse-with-sublime-text-2-3-for-java)
comment on: http://stackoverflow.com/q/24085290
type: QuestionComment

kryo
tags question: http://stackoverflow.com/q/23955510
type: Tag
tags question: http://stackoverflow.com/q/23962796
tag name: kryo

http://stackoverflow.com/comment/114689919
type: AnswerComment
comment on: http://stackoverflow.com/a/60389787
score: 0
type: Comment
has text: This is what I was looking into, but expected spring could have handle this primitive scenario.

http://stackoverflow.com/q/23969552
has comment: http://stackoverflow.com/comment/36931085
accepted answer: http://stackoverflow.com/a/23969718
score: -1
has answer: http://stackoverflow.com/a/23969718
has title: Reading data from multiple files and writing the data to a new file giving unexpected result?
has comment: http://stackoverflow.com/comment/36930016
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36930450
has comment: http://stackoverflow.com/comment/36931300
favorite count: 0
has comment: http://stackoverflow.com/comment/36931205
has comment: http://stackoverflow.com/comment/36936382
has body: I've split a mp3 file of 10 MB size into 10 parts of 1 MB each in mp3 format on my Android device, each file plays successfully by the player but while reading the data of all the 10 files and writing it to a single file the total size of the new file is more than 17 MB and the file doesn't play itself. Following is the code: CODE FOR FILE SPLIT : File file = new File(Environment.getExternalStorageDirectory() + "/MusicFile.mp3"); try { FileInputStream fis = new FileInputStream(file); FileOutputStream fos = null; int size = 1048576; // 1 MB of data byte buffer[] = new byte[size]; int count = 0; int i = 0; while (true) { i = fis.read(buffer, 0, size); if (i == -1) { break; } File filename = getSplitFileName("split_" + count); fos = new FileOutputStream(filename); fos.write(buffer, 0, i); ++count; } fis.close(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } catch (Exception e2) { e2.printStackTrace(); } CODE FOR FILE JOIN : File folder = new File(cacheDirSplit.getAbsolutePath()); File files[] = folder.listFiles(); BufferedReader bufReader = null; BufferedWriter bufWriter = null; if (files.length &gt; 1) { try { File fileName = getJoinedFileName("NewMusicFile"); String data; for (int i = 0; i &lt; files.length; i++) { long dataSize = 0; bufReader = new BufferedReader(new FileReader( files[i])); bufWriter = new BufferedWriter(new FileWriter( fileName, true)); while ((data = bufReader.readLine()) != null) { bufWriter.write(data); dataSize = dataSize + data.getBytes().length; } Log.i("TAG", "File : " + files[i] + "size ==&gt; " + dataSize); } bufReader.close(); bufWriter.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } What i do not understand is that while reading each file is read as 1.7MB as printed by the LOGCAT output but on the device when i check the splitted file is of 1MB only. I…
tagged with: android
has comment: http://stackoverflow.com/comment/36930675
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36930529
upvote count: 0
tagged with: java
tagged with: filewriter
has comment: http://stackoverflow.com/comment/36930969
has comment: http://stackoverflow.com/comment/36931114
type: Question

http://stackoverflow.com/a/24035461
score: 0
type: Answer
has body: public static void main(String[] args) { Wrapper w = new Wrapper(); // line 1 w.w = 20; // line 2 w=changeWrapper(w); // line 3 w.w += 30; // line 4 System.out.println(w.w); // line 5 This will give 49 w = changeWrapper(w); // line 6 System.out.println(w.w); // line 7 } changeWrapper(w); // line 3 This will not do anything to w w=changeWrapper(w); // line 3 Do changes on w
answers question: http://stackoverflow.com/q/24035068

http://stackoverflow.com/a/24037536
has comment: http://stackoverflow.com/comment/37077576
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23980540
type: Answer
score: 3
upvote count: 3
has body: This should remove your funny message. Just configure your driver. System.setProperty("webdriver.chrome.driver","&lt;&lt;your chrome path&gt;&gt;"); // To remove message "You are using an unsupported command-line flag: --ignore-certificate-errors. // Stability and security will suffer." // Add an argument 'test-type' DesiredCapabilities capabilities = DesiredCapabilities.chrome(); ChromeOptions options = new ChromeOptions(); options.addArguments("test-type"); capabilities.setCapability("chrome.binary","&lt;&lt;your chrome path&gt;&gt;"); capabilities.setCapability(ChromeOptions.CAPABILITY, options); driver = new ChromeDriver(capabilities);
accepted answer of: http://stackoverflow.com/q/23980540

http://stackoverflow.com/a/24093163
accepted answer of: http://stackoverflow.com/q/24076971
type: Answer
answers question: http://stackoverflow.com/q/24076971
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37160720
has body: That sounds very expensive. If the compiler did it that way, it would be expensive. But what actually happens is that it builds an in-memory data structure containing all of the class names on the classpath, bootclasspath and sourcepath, and uses that for all of the classname resolutions in all classes that are compiled in the javac run. So is it advisable to import also types from the same package to speed up the compilation process? Or is there a faster method for resolving an unimported type X which I was not able to find? No, and no. It will make almost no difference. And besides, this is unlikely to be a significant bottleneck if you use the compiler how it was designed to be used. It is better to do the imports in a way that gives the most readable and reliable code.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/36918632
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23963322
has text: -1 Your answer is confusing. The last statement especially: "Code, that literally gives anything is just a processor consumer, an error, and should not be used in any program period." seems like nonsense.

http://stackoverflow.com/comment/36957769
has text: You should only be calling for the input once; at the end of the loop. Then the `while` checks it.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23984391
type: Comment

http://stackoverflow.com/comment/37023880
comment on: http://stackoverflow.com/a/24019701
score: 0
type: AnswerComment
has text: view_presentation is different from view_presentations .. and yes the database is initialized.
type: Comment

http://stackoverflow.com/comment/36948813
comment on: http://stackoverflow.com/a/23979136
type: Comment
score: 0
type: AnswerComment
has text: Thank you. it's worked. But, i'm confused when trying the same for FileWriter. Hope you can help me with this too. http://stackoverflow.com/questions/23979791/change-filewriter-to-outputstreamwriter

http://stackoverflow.com/comment/37043852
has text: I am asking did you try to get the string between "--asset" and "--".Saw me your code
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24030489

http://stackoverflow.com/comment/37159312
comment on: http://stackoverflow.com/a/24066426
type: AnswerComment
type: Comment
has text: You're right. But I'm still missing something. The application launch, but it crash when I click on the "Login" button. It gives [this error](http://paste.ubuntu.com/7605022/), but I think that it is another issue (I should create another question). Is this related?
score: 0

http://stackoverflow.com/comment/37161870
score: 2
comment on: http://stackoverflow.com/q/24093644
type: QuestionComment
has text: It is better to be working out Java 101 things like using objects and their members (methods and attributes) in command line apps. rather than apps. with a GUI.
type: Comment

http://stackoverflow.com/q/24065127
has answer: http://stackoverflow.com/a/24065394
favorite count: 0
has body: i have to implement this test: package it.unica.pr2.test; import it.unica.pr2.abitazioni.*; import java.util.Collections; import java.util.List; /*import javafx.application.Application; import javafx.stage.Stage;*/ public class TestAbitazioni /*extends Application*/ { public static void main(String[] args) /*public void start(Stage primaryStage) */{ // C Immobile casa = new Casa(); List&lt;Ambiente&gt; c2 = casa; // C+ casa.add(new Bagno(10)); // 10 mq casa.add(new Cucina(20)); // 20 mq casa.add(new CameraDaLetto(25)); // 25 mq casa.add(new CameraDaLetto(15)); // 15 mq casa.add(new Corridoio(12)); // 12 mq assert casa.superficie() == 10 + 20 + 25 + 15 + 12; assert casa.bilocale() == false; // i bi locali hanno solo 1 cucina 1 bagno 1 camera da letto (no altri ambienti) // B Bagno bagno = new Bagno(13); assert bagno.toString().equals("Questo ambiente occupa 13mq"); Cucina cucina = new Cucina(26); assert cucina.toString().equals("Questo ambiente occupa 26mq"); Collections.sort(casa); // sort by dimension assert casa.get(0).getSuperficie() == 10; assert casa.get(1).getSuperficie() == 12; assert casa.get(2).getSuperficie() == 15; assert casa.get(3).getSuperficie() == 20; assert casa.get(4).getSuperficie() == 25; // A Collections.sort(casa, new StanzeByType()); // prima cucine, poi camere da letto, poi bagni, poi qualsiasi altro tipo; a parita' di tipo, dal piu' piccolo al piu' grande assert casa.get(0).getSuperficie() == 20; assert casa.get(1).getSuperficie() == 15; assert casa.get(2).getSuperficie() == 25; assert casa.get(3).getSuperficie() == 10; assert casa.get(4).getSuperficie() == 12; /* // A+ casa.mostraCasa(); * */ } /* public static void main(String[] args) { launch(args); } */ } Collections.sort(casa, new StanzeByType()) the problem is here, how i implement a class constructor here for sort the collection by type? if the italian language is a problem i'll translate the source. Thank you.
tagged with: collections
downvote count: 1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24065394
score: -1
type: Question
has comment: http://stackoverflow.com/comment/37108271
upvote count: 0
answer count: 1
tagged with: sorting
has title: Java Collections.sort(List<T> list,Comparator<? super T> c)
has comment: http://stackoverflow.com/comment/37108152

http://stackoverflow.com/q/23971494
has comment: http://stackoverflow.com/comment/36935973
tagged with: android
has body: I found some cool android libraries the other day and decided to try some. But I'm having trouble correctly importing the library. This is the URL of the library : https://github.com/dmytrodanylyk/android-process-button I first tried importing the library to eclipse (and move the files in java directory to src directory and set the project as library) and importing the sample to eclipse and set it to use the library project (Properties->Android->Libraries). But it didn't work. The layout files said it failed to instantiate [custom widget class]. The I tried importing the .jar file to libs directory (and update the java build path) but it didn't work either. It showed errors in the java files too. I then tried copying all the java and layout files to the sample project directory and it worked. But I'm guessing that's not the way to work with 3rd party libraries. I first thought it's some error with the library but all the other libraries I tried to import to my projects faced the same problem. Can someone walk me through how to correctly import a 3rd party library to my android project?
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/6760115
type: Question
accepted answer: http://stackoverflow.com/a/23971711
possible better answer: http://stackoverflow.com/a/23973106
tagged with: eclipse
has answer: http://stackoverflow.com/a/23973106
linked to: http://stackoverflow.com/q/19912393
score: 0
answer count: 2
has title: How to import 3rd party libraries
has answer: http://stackoverflow.com/a/23971711

http://stackoverflow.com/q/24028903
answer count: 2
upvote count: 1
tagged with: xtend
has answer: http://stackoverflow.com/a/24238219
accepted answer: http://stackoverflow.com/a/24238219
favorite count: 0
possible better answer: http://stackoverflow.com/a/24238856
downvote count: 0
has body: I have created an Ecore metamodel and generated an editor through EMF. To generate my output code I parse the resource set (XMI) when a diagram is created and then map these resources to my own Java classes. These Java classes are responsible for generating my output which is some javascript files based on few template files (.stg). Everything works fine but my question is where do technologies such as Xtend/Acceleo come in? Do I need any of them? I know that they are template based but since I have my own templates that are rendered through my Java classes why would I need to use Xtend for example? I am totally confused. Thank you so much
has answer: http://stackoverflow.com/a/24238856
type: AnsweredQuestion
score: 1
tagged with: java
has title: Do I need to use Xtend/Acceleo?
type: Question

http://stackoverflow.com/a/24045506
accepted answer of: http://stackoverflow.com/q/24034242
answers question: http://stackoverflow.com/q/24034242
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/131987743
type: Answer
upvote count: 2
has body: You have to be careful what logic is applied when constructing the route and what logic is applied when an exchange is routed. The confusing thing is that there are two levels of abstraction, two languages - Java and Camel DSL on top of each other. In your case, your java runtime is trying to evaluate String + SimpleBuilder when the construction java is run. I don't think there is a construct in Camel providing dynamic JAXB contexts from an exchange parameter. That would be bad for performance to start with, and you have a limited set of classes loaded on your classpath anyway. I can think of a couple of possible ways to handle this: Multiple package names in the context. Specify jaxb("org.package1:org.package2:foo.bar") - then jaxb hopefully finds the right class to unmarshal without further logic. If you by some reason want multiple (but limited amount of) contexts you can create multiple with DataFormat jaxb1 = new JaxbDataFormat("foo.bar:bar.foo"); and then use a choice in camel to use the right jaxb dataformat. If you really really want to create the context dynamically in runtime (might hurt your performance more than you want), you can easily do this in a simple java processor with a few lines of code. public class Proc implements Processor { public void process(Exchange exchange) throws Exception { String clientId = exchange.getIn().getHeader("clientid"); JAXBContext jaxb = JAXBContext.newInstance("foo.bar."+ clientId); Unmarshaller unmarshaller = jaxb.createUnmarshaller(); InputStream input = exchange.getIn(InputStream.class); exchange.getIn().setBody(unmarshaller.unmarshal(input)); } }

http://stackoverflow.com/q/24088600
has comment: http://stackoverflow.com/comment/37152158
tagged with: spring
possible better answer: http://stackoverflow.com/a/24088708
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24088695
tagged with: java
has comment: http://stackoverflow.com/comment/37152293
type: Question
has body: Hello all master minds, I have created a java spring application in eclipse with mysql db. Now I can run this application using >Run on server in eclipse,but I want to know how to deploy this application on my own laptop(windows 7). I have already configured server,by localhost://8080 I can see Apache tomcat is configured. Give me simple steps so that i can just run that software using browser via its link like http://localhost:8080/PMS PMS is my project name. Thanks in advance.
has title: How to deploy Java/Spring application on my own system in Apache tomcat server.?
tagged with: eclipse
has answer: http://stackoverflow.com/a/24088708
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37152107
tagged with: tomcat
has answer: http://stackoverflow.com/a/24148079
accepted answer: http://stackoverflow.com/a/24088695

http://stackoverflow.com/comment/37130802
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24077196
type: Comment
has text: @AbhishekBhatia: Take a look at the following: http://ideone.com/lDCHob

http://stackoverflow.com/comment/36899527
score: 0
type: Comment
type: QuestionComment
has text: Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
comment on: http://stackoverflow.com/q/23953396

http://stackoverflow.com/a/24073507
answers question: http://stackoverflow.com/q/24073352
downvote count: 0
has comment: http://stackoverflow.com/comment/37123747
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37124044
has body: You can match one or both of them with a simple pattern: (?:-([vl])(\\d+))(?:-[vl](\\d+))? The idea behind this pattern is simple: it matches and captures the initial marker -v or -l, followed by a sequence of digits, which are captured into capturing groups. Pattern p = Pattern.compile("(?:-([vl])(\\d+))(?:-[vl](\\d+))?"); for(String s : new String[] {"ford-focus-albany-ny-v12356-l12205","ford-focus-albany-ny-l12205","ford-focus-albany-ny-v12356"}) { Matcher m = p.matcher(s); if (m.find()) { if (m.group(1).equals("v")) { System.out.println("verhicle="+m.group(2)); String loc = m.group(3); if (loc != null) { System.out.println("location="+loc); } else { System.out.println("No location"); } } else { System.out.println("No vehicle"); System.out.println("location="+m.group(2)); } } } Here is a demo on ideone.
has comment: http://stackoverflow.com/comment/37123891

spdy
tag name: spdy
type: Tag
tags question: http://stackoverflow.com/q/24070240

http://stackoverflow.com/a/23957638
answers question: http://stackoverflow.com/q/23957414
score: 1
upvote count: 1
has body: An example of "compatible types": class C1 { public void m1 (List&lt;Integer&gt; l) {} } class C2 extends C1 { @Override public void m1 (List l) {} // legal, this overrides } Basically, the only way a parameter list can have "compatible" types without having the exact same types is if the parameters of the overriding method are the same as the parameters of the overridden method with all type parameters removed. The rule is explained in JLS §8.4.8.1 (SE8), which says that the signature of the overriding method must be a subsignature of the overridden one; following the references, we find that this means that "subsignature" means either it's the same signature or the type erasure of the overridden one. (P.S. Of course, you shouldn't do this. In real life, overriding methods should have the same parameter types, period.) (PPS. Note that compatibility only goes one way here. This is not legal:) class C1 { public void m1 (List l) {} } class C2 extends C1 { @Override public void m1 (List&lt;Integer&gt; l) {} // illegal }
has comment: http://stackoverflow.com/comment/36931839
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36909654
has text: Read the docs.http://developer.android.com/guide/topics/data/data-storage.html. Read internal storage options
comment on: http://stackoverflow.com/q/23958624
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24099176
tagged with: location
has body: I'm trying to get user location in the background. Everything works great on my phone (htc one m7), but from some reason it's not working on two devices I tested: Samsung galaxy s3 Sony Xperia Z1 btw: I added everything to the manifest as it should be. this is my code: **BackgroundLocationService ** import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.location.LocationClient; import com.google.android.gms.location.LocationRequest; public class BackgroundLocationService extends Service implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener { IBinder mBinder = new LocalBinder(); private LocationClient mLocationClient; private LocationRequest mLocationRequest; // Flag that indicates if a request is underway. private boolean mInProgress; private Boolean servicesAvailable = false; public class LocalBinder extends Binder { public BackgroundLocationService getServerInstance() { return BackgroundLocationService.this; } } @Override public void onCreate() { super.onCreate(); mInProgress = false; // Create the LocationRequest object mLocationRequest = LocationRequest.create(); // Use high accuracy mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); // Set the update interval to 5 seconds mLocationRequest.setInterval(0); // Set the fastest update interval to 1 second mLocationRequest.setFastestInterval(1); servicesAvailable = servicesConnected(); /* * Create a new location client, using the enclosing class to * handle callbacks. */ mLocationClient = new LocationClient(th…
has comment: http://stackoverflow.com/comment/37172308
has comment: http://stackoverflow.com/comment/37172066
has answer: http://stackoverflow.com/a/24102944
has comment: http://stackoverflow.com/comment/37172194
score: 0
tagged with: android
has title: LocationClient works only on some devices
tagged with: gps
has comment: http://stackoverflow.com/comment/37171708
accepted answer: http://stackoverflow.com/a/25724972
has comment: http://stackoverflow.com/comment/37172241
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37180004
has answer: http://stackoverflow.com/a/25724972
possible better answer: http://stackoverflow.com/a/24102944
answer count: 2

http://stackoverflow.com/a/28611662
has body: I did it this way and function perfectly. </dependencies> src/main/java **/*.properties org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6
downvote count: 2
has comment: http://stackoverflow.com/comment/71681967
upvote count: 20
type: Answer
answers question: http://stackoverflow.com/q/23987633
score: 18

http://stackoverflow.com/a/23946631
score: 5
type: AcceptedAnswer
has body: Here's a simpler way to solve this problem. Create an array called count of size 101. The indexes (0-100) represent the numbers you are counting. Traverse the input array and count the occurrences of each number. Finally, compare the counts to find the one that appears the most (tie goes to the lower number): public static int mode(int[] input) { int[] count = new int[101]; //count the occurrences for (int i=0; i &lt; input.length; i++) { count[input[i]]++; } //go backwards and find the count with the most occurrences int index = count.length-1; for (int i=count.length-2; i &gt;=0; i--) { if (count[i] &gt;= count[index]) index = i; } return index; }
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23946397
downvote count: 1
answers question: http://stackoverflow.com/q/23946397
has comment: http://stackoverflow.com/comment/80958029

http://stackoverflow.com/comment/37035680
has text: The last modification date of the folder?
comment on: http://stackoverflow.com/q/24025806
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24092953
has comment: http://stackoverflow.com/comment/37160496
has comment: http://stackoverflow.com/comment/37160297
type: Answer
has comment: http://stackoverflow.com/comment/37160198
has comment: http://stackoverflow.com/comment/37160658
score: 2
accepted answer of: http://stackoverflow.com/q/24092843
upvote count: 2
answers question: http://stackoverflow.com/q/24092843
has comment: http://stackoverflow.com/comment/37160267
has comment: http://stackoverflow.com/comment/37160249
has comment: http://stackoverflow.com/comment/37160381
has comment: http://stackoverflow.com/comment/37160238
has body: I'm speculating which tokens belong to each list but you need something like this: while(scan.hasNextLine()){ String line = scan.nextLine(); String[] tokens = line.split("-"); String code = tokens[0].trim(); String description = tokens[1].trim(); String examiner = tokens[2].trim(); String moderator = tokens[3].trim(); courseList.add(code); courseList.add(description); nameList.add(examiner); nameList.add(moderator); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37160599

http://stackoverflow.com/q/24044069
answer count: 4
favorite count: 0
tagged with: visualvm
accepted answer: http://stackoverflow.com/a/24044109
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/69110109
tagged with: java
score: 24
has title: VisualVM running JRE
tagged with: eclipse
upvote count: 24
type: Question
possible better answer: http://stackoverflow.com/a/24044137
downvote count: 0
has answer: http://stackoverflow.com/a/24044137
has answer: http://stackoverflow.com/a/69598818
has answer: http://stackoverflow.com/a/24044109
has body: I can't get VisualVM working with eclipse, i was following these instructions http://visualvm.java.net/download.html and also these http://visualvm.java.net/gettingstarted.html The problem is that it cant see JDK location which is "C:\Program Files\Java\jdk1.8.0_05", this happens when i try to run the application Here is the original content of visualvm.conf file http://pastebin.com/K9TnQb0G Unfortunately my command line is somehow broken too(or I'm the one who dont know how to do it) First I tryed to install JProbe but it wasnt working, then I tryed VisualVM and it also isn't working. How can i resolve this please? I wasted 5 hours and its driving me crazy.

http://stackoverflow.com/q/24040927
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24041122
has title: Launch Java application in background mode in Windows
type: AnsweredQuestion
has body: I need to launch a Java application in background. The Java application is a console application (a listening service), The application is launched with a instruction like this java app.jar I need to launch this application and, during the application execution, the console does not stay open. It is valid that the application opens and then closes How can I do it? Thanks
score: 1
tagged with: java
upvote count: 1
tagged with: background
accepted answer: http://stackoverflow.com/a/24041122
type: Question
tagged with: launch
tagged with: windows

http://stackoverflow.com/a/23988316
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36967675
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23988281
answers question: http://stackoverflow.com/q/23988281
has body: Try (space was missing): //div[contains(@data-bind,'text: DateofExpire')]

http://stackoverflow.com/comment/37179595
score: 0
type: QuestionComment
type: Comment
has text: Your code already does that. The user simply has to enter ^D (Linux / Mac(?)) or ^Z (Windows)
comment on: http://stackoverflow.com/q/24102593

http://stackoverflow.com/comment/37147351
score: 0
type: Comment
type: QuestionComment
has text: There's 2 lines of code after you `return` from the function, these lines will never be executed because you have already left the function. This is why you get the unreachable code message.
comment on: http://stackoverflow.com/q/24086296

http://stackoverflow.com/q/24095516
has comment: http://stackoverflow.com/comment/37164849
has comment: http://stackoverflow.com/comment/37164754
type: Question
accepted answer: http://stackoverflow.com/a/24095559
tagged with: split
possible better answer: http://stackoverflow.com/a/24095636
has comment: http://stackoverflow.com/comment/37164803
has answer: http://stackoverflow.com/a/24095926
has comment: http://stackoverflow.com/comment/37164814
has answer: http://stackoverflow.com/a/24095636
has title: Cannot get values from splitted Array String into a String
has answer: http://stackoverflow.com/a/24095559
has comment: http://stackoverflow.com/comment/37164970
score: 0
answer count: 3
tagged with: string
has body: I am trying to get the values out of String[] value; into String lastName;, but I get errors and it says java.lang.ArrayIndexOutOfBoundsException: 2 at arduinojava.OpenFile.openCsv(OpenFile.java:51) (lastName = value[2];). Here is my code, but I am not sure if it is going wrong at the split() or declaring the variables or getting the data into another variable. Also I am calling input.next(); three times for ignoring first row, because otherwise of study of Field of study would also be printed out.. The rows I am trying to share are in a .csv file: University Firstname Lastname Field of study Karlsruhe Jerone L Software Engineering Amsterdam Shahin S Software Engineering Mannheim Saman K Artificial Intelligence Furtwangen Omid K Technical Computing Esslingen Cherelle P Technical Computing Here's my code: // Declare Variable JFileChooser fileChooser = new JFileChooser(); StringBuilder sb = new StringBuilder(); // StringBuilder data = new StringBuilder(); String data = ""; int rowCounter = 0; String delimiter = ";"; String[] value; String lastName = ""; /** * Opencsv csv (comma-seperated values) reader */ public void openCsv() throws Exception { if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { // Get file File file = fileChooser.getSelectedFile(); // Create a scanner for the file Scanner input = new Scanner(file); // Ignore first row input.next(); input.next(); input.next(); // Read from input while (input.hasNext()) { // Gets whole row // data.append(rowCounter + " " + input.nextLine() + "\n"); data = input.nextLine(); // Split row data value = data.split(String.valueOf(delimiter)); lastName = value[2]; rowCounter++; System.out.println(rowCounter + " " + data + "Lastname: " + lastName); } input.close(); } else { sb.append("No file was selected"); } }
has comment: http://stackoverflow.com/comment/37164784
tagged with: regex
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36962339
has text: Thanks to those who replied. Yes, I have tried e.printStackTrace() did not work. protected static final Logger LOGGER = Logger.getLogger(myTest.class);
comment on: http://stackoverflow.com/q/23965429
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36959847
comment on: http://stackoverflow.com/a/23985560
score: 0
type: AnswerComment
has text: Ok. I tried putting it in either class, and it works in both. Thanks for the help!
type: Comment

http://stackoverflow.com/comment/36901195
has text: I cannot understand how an enum can solve my problem... I wnat the object to allways pick the int and store the data as a String that i previosly specified.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23954394

http://stackoverflow.com/comment/37103984
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24062838
has text: So what is the input? Two trees which are sub-trees of one tree?
type: QuestionComment

http://stackoverflow.com/q/24077182
has comment: http://stackoverflow.com/comment/37130388
upvote count: 0
has comment: http://stackoverflow.com/comment/37130420
answer count: 1
score: -7
favorite count: 0
has comment: http://stackoverflow.com/comment/37130366
has comment: http://stackoverflow.com/comment/37130404
has comment: http://stackoverflow.com/comment/37130422
has comment: http://stackoverflow.com/comment/37130406
has answer: http://stackoverflow.com/a/24077254
tagged with: android
has body: I create a Hashmap xxx store all Thread inside Hasmap when Thread finish , will remove it is it a good practise? Here is my code : https://gist.github.com/extralam/756484718c9e0cd57ddb
type: UnansweredQuestion
tagged with: multithreading
downvote count: 7
tagged with: java
tagged with: thread-safety
has title: Is it a good practise store Thread in the Hashmap?
type: Question

http://stackoverflow.com/q/23996399
has comment: http://stackoverflow.com/comment/36985636
answer count: 1
has body: I developed a Java Application that used Google Speech Recognition, but from few days/weeks ago it doesn't work, i'm receiving this message. java.io.IOException: Server returned HTTP response code: 403 I saw a little bit information about what is happening in this Post. After that, i registered in https://console.developers.google.com and then i'm trying to use the following URL and i'm having the same response. https://www.google.com/speech-api/v2/recognize?output=json&amp;lang=es-EN&amp;key=MY_KEY Furthermore, in the console developers i'm not seeing in any place some API that it's called speech recognition or similar :( Anybody has a solution? Thanks
tagged with: speech-recognition
type: UnansweredQuestion
tagged with: google-api
linked to: http://stackoverflow.com/q/23608863
has answer: http://stackoverflow.com/a/24018710
tagged with: java
tagged with: speech-to-text
type: Question
has title: Java Google Speech Recognition API
score: 0
tagged with: api

http://stackoverflow.com/a/24086399
downvote count: 0
answers question: http://stackoverflow.com/q/24086296
has body: There's 2 lines of code after you return from the function, these lines will never be executed because you have already left the function. This is why you get the unreachable code message. You don't want to have lines of code after a return statement: return db.update(Constants.TABLE_NAME , newValue , Constants.KEY_ID + "= ?" , new String[]{ Double.valueOf(rowId).toString() })&gt;0; //returned from function on this line db.setTransactionSuccessful(); //therefore you never get to this line db.endTransaction(); Instead you probably want to do something like this: db_result = db.update(Constants.TABLE_NAME , newValue , Constants.KEY_ID + "= ?" , new String[]{ Double.valueOf(rowId).toString() })&gt;0; if(db_result){ db.setTransactionSuccessful(); //Now you can do this conditional on the result of the update } db.endTransaction(); return db_result; By creating a variable to store the result of updating the database you can do the db related cleanup/close functions before you return from the function.
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/36925696
has text: Wouldn't it be better to do something like z.append(name).append(" The Great ")... Or some such?
comment on: http://stackoverflow.com/q/23967251
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/comment/37109397
type: QuestionComment
comment on: http://stackoverflow.com/q/24032075
has text: why do you simply parse and not link etc?
score: 0
type: Comment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/24002317
tag name: instantiation
tags question: http://stackoverflow.com/q/23960512

classpath
tags question: http://stackoverflow.com/q/24047490
tags question: http://stackoverflow.com/q/23977485
tags question: http://stackoverflow.com/q/23973131
tags question: http://stackoverflow.com/q/24045046
tags question: http://stackoverflow.com/q/24018149
tags question: http://stackoverflow.com/q/24086783
tags question: http://stackoverflow.com/q/23941414
tags question: http://stackoverflow.com/q/23952257
type: Tag
tags question: http://stackoverflow.com/q/24066726
tag name: classpath
tags question: http://stackoverflow.com/q/23944387

http://stackoverflow.com/comment/37115533
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24068688
score: 0
has text: Q: Why not just turn "Backups.zip" into a method parameter, and then call createZip (with your new parameter) from your JFileChooser handler?

http://stackoverflow.com/comment/36974180
score: 0
type: AnswerComment
has text: @jerichoi224: It's for handling the clicks on the options, see [Creating an Options Menu -> Handling click events](http://developer.android.com/guide/topics/ui/menus.html#RespondingOptionsMenu)
type: Comment
comment on: http://stackoverflow.com/a/23986814

http://stackoverflow.com/a/24293360
score: 1
has body: One of the nice things about Future is that you don't need to worry about this question. From the documentation: Memory consistency effects: Actions taken by the asynchronous computation happen-before actions following the corresponding Future.get() in another thread. So even though your task does nothing to ensure inter-thread result visibility, the Executor implementation takes care of it for you.
upvote count: 1
answers question: http://stackoverflow.com/q/24062816
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36990178
score: 0
type: QuestionComment
has text: Sorry, I cannot trust in the design of someone who uses scriptlets to solve his/her problem.
comment on: http://stackoverflow.com/q/24000459
type: Comment

http://stackoverflow.com/q/23958570
type: UnansweredQuestion
tagged with: swing
tagged with: boxlayout
tagged with: jbutton
has body: I have a custom button class that I created that extends JButton. When I add this to a JFrame, I get this: But when I place this custom button into the frame with BoxLayout, the button becomes smaller and is not desirable this way: Here is my code for the frame: Test.java import javax.swing.BoxLayout; import javax.swing.JFrame; public class Test { public static void main(String[] args) { JFrame frame = new JFrame(); //When you uncomment this, the button is sized really small //frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(),BoxLayout.PAGE_AXIS)); frame.add(new CButton("Hello")); frame.pack(); frame.setVisible(true); } } And here is the code for the custom button, CButton: CButton.java import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.Stroke; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.geom.Area; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.JToolTip; public class CButton extends JButton implements ComponentListener { protected static final int BORDER_WIDTH = 5; private static final Insets INSETS_MARGIN = new Insets(2, 5, 2, 5); private static final long serialVersionUID = 1L; protected Area m_areaDraw = null; private Area m_areaFill = null; private double m_dHeightDraw = 0d; private double m_dHeightFill = 0d; private double m_dWidthDraw = 0d; private double m_dWidthFill = 0d; private int m_nMinHeight = 0; private int m_nMinWidth = 0; private int m_nStringHeightMax = 0; private int m_nStringWidthMax = 0; private RoundRectangle2D m_rrect2dDraw = null; private RoundRectangle2D m_rrect2dFill = null; private Shape m_shape = null; public CButton(String strLabel) { setCon…
linked to: http://stackoverflow.com/q/5751311
tagged with: java
type: Question
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/21375255
has title: Custom button is shrinked when in a BoxLayout
has answer: http://stackoverflow.com/a/23958730

http://stackoverflow.com/q/24082487
downvote count: 0
has answer: http://stackoverflow.com/a/24082574
favorite count: 0
tagged with: private
tagged with: static
has title: Set private field with reflection works on static OR final, but not static final (combined)
possible better answer: http://stackoverflow.com/a/24082599
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: final
tagged with: java
has body: I've got two UnitTest projects for my Android project. One for the JUnit Test and one for the Android Unit Tests. In the JUnit Test Project I've made a class to access or set private fields, methods or constructors. (PS: For the ones that are curious of the complete code, let me know and I'll add it to the bottom of this post.) I also have UnitTests to test these private-method accessing. Right now all of these UnitTests work, accept for one: Setting the value of a final static field. This is the method I use for setting a private field: // Test method to set a private Field from a class public static void setPrivateField(Object ob, String fieldName, Object value) throws MyUnitTestException{ try { Field field = ob.getClass().getDeclaredField(fieldName); if(field != null){ field.setAccessible(true); if(Modifier.isFinal(field.getModifiers())){ Field modifierField = Field.class.getDeclaredField("modifiers"); modifierField.setAccessible(true); modifierField.setInt(field, field.getModifiers() &amp; ~Modifier.FINAL); /*int modifiers = field.getModifiers(); Field modifierField = field.getClass().getDeclaredField("modifiers"); modifiers = modifiers &amp; ~Modifier.FINAL; modifierField.setAccessible(true); modifierField.setInt(field, modifiers);*/ } // ** IllegalAccessException at the following line with final static fields: field.set(ob, value); // static fields ignore the given Object-parameter } } catch (NoSuchFieldException ex){ throw new MyUnitTestException(ex); } catch (IllegalAccessException ex){ throw new MyUnitTestException(ex); } catch (IllegalArgumentException ex){ throw new MyUnitTestException(ex); } } And this is the UnitTest: @Test public void testSetIntFields(){ MyClass myClassInstance = new MyClass(); final int value = 5; for(int nr = 1; nr &lt;= 4; nr++){ String nameOfField = "myInt" + nr; try { TestMethodsClass.setPrivateField(myClassInstance, nameOfField, value); } catch (MyUnitTestException ex) { Assert.fail("setPrivateField caused an Exception: " + ex.ge…
type: Question
accepted answer: http://stackoverflow.com/a/24082574
has answer: http://stackoverflow.com/a/24082599
answer count: 2
upvote count: 1

http://stackoverflow.com/a/23997930
type: AcceptedAnswer
type: Answer
has body: Well, now it seems like: The position of the picture is its centre, instead of left top corner. By using percentage, distance is relative to the width of the screen width. So, 0% means centre of the picture falls on the middle of the screen, 50% means the edge. Thus, if I want the picture to move from one edge, I should make width of the picture the same as width of the screen, and then set fromXDelta=100% or 100%p.
accepted answer of: http://stackoverflow.com/q/23960896
answers question: http://stackoverflow.com/q/23960896
score: 0

http://stackoverflow.com/comment/37050885
score: 0
type: Comment
has text: ` Where do you get that impression from? ` i had exported a project into a jar via eclipse, i did not see any checkbox or whatsoever that asked me for compilation, so i thought it contained source files, but now when i run a `jar tf` i see that it contains class files
comment on: http://stackoverflow.com/a/24033246
type: AnswerComment

http://stackoverflow.com/q/23981991
upvote count: 1
answer count: 1
favorite count: 0
has body: I need to iterate through a TreeMap&lt;Integer, T&gt; map from the end to beginning. How to do so? I have tried the same thing as the answer in posted topic below: new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { return o2.intValue() - o1.intValue(); } } but this is not a solution, that's just reversing the order.
has title: How to iterate over TreeMap<Integer, T> from end to beginning
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23982019
duplicate of: http://stackoverflow.com/q/9338209
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23982019
tagged with: treemap
linked to: http://stackoverflow.com/q/9338209
has comment: http://stackoverflow.com/comment/36973465

http://stackoverflow.com/comment/37026455
type: Comment
type: QuestionComment
has text: bytes=mmStream.read(buffer) does not read lines. It does just read a number of bytes. Check your variable bytes for that. So you have to make a loop to fill a buffer until a \n is read. Ort if you can use mmStream.readLine() use that.
comment on: http://stackoverflow.com/q/24019585
score: 0

http://stackoverflow.com/q/24060477
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Simple json to xml conversion
answer count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/19977979
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/37099589
has answer: http://stackoverflow.com/a/24117414
downvote count: 1
accepted answer: http://stackoverflow.com/a/24061594
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37099384
possible better answer: http://stackoverflow.com/a/24117414
has comment: http://stackoverflow.com/comment/107065367
has body: can anyone share code to convert json to xml this is the json that comes through the request {'sector':'Europe','organization':'Bazz Market Unit UK','companyCode':'UK1_2020','approvalManager':'03000069','managementLevel1':'X11','approvalLimit':'500000','access Category':'FTeam','currency':'USD','comments':'Need this access so I can do my job properly'} I need json to xml as well as vice- versa .Can any one help me out, I'd prefer code with no jar imports required. Thanks in advance
has answer: http://stackoverflow.com/a/68317906
has answer: http://stackoverflow.com/a/24061594
has comment: http://stackoverflow.com/comment/37102916
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/23949050
type: AcceptedAnswer
has body: If user enters a non-integer input, this line inputNum = input.nextInt(); will throw an exception (an InputMismatchException). The way Java handles exceptions is through a try-catch block: try { inputNum = input.nextInt(); // ... do domething with inputNum ... } catch (InputMismatchException e) { System.out.println("Invalid input!"); } Note: If you want to know more about exceptions (and you must) you can read Java tutorials.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23948959
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23948959

http://stackoverflow.com/a/24064777
score: 1
has body: At the moment, your combobox only lives as long as your application. You'll need a permanent datasource that you can write to, i.e. file, database, etc. Take a look at these links: Connecting to a database Reading and Writing from a File
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24064738
answers question: http://stackoverflow.com/q/24064738

http://stackoverflow.com/q/23985869
tagged with: sqlite
downvote count: 1
has answer: http://stackoverflow.com/a/23986686
has title: SQLiteLog error no such table:
favorite count: 0
tagged with: android
has body: So I created a database, which I did wrong because of the error below, but I'm not sure what is causing the error. I know it is in my DATABASE_CREATE variable, but I don't know what I'm formatting incorrectly. Any help would be appreciated. Here is my error 06-01 19:41:11.943: E/SQLiteLog(15521): (1) no such table: YCDB 06-01 19:41:11.948: E/SQLiteDatabase(15521): Error inserting users=john password=mavsman 06-01 19:41:11.948: E/SQLiteDatabase(15521): android.database.sqlite.SQLiteException: no such table: YCDB (code 1): , while compiling: INSERT INTO YCDB(users,password) VALUES (?,?) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1118) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:691) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1589) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1461) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at yc.android.yourchallenger.DBAdapter.insertContact(DBAdapter.java:81) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at yc.android.yourchallenger.MainActivity.onCreate(MainActivity.java:27) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.app.Activity.performCreate(Activity.java:5372) 06-01 19:41:11.948: E/SQLiteDatabase(15521): at android.a…
accepted answer: http://stackoverflow.com/a/23989670
has comment: http://stackoverflow.com/comment/36961624
has answer: http://stackoverflow.com/a/23989670
possible better answer: http://stackoverflow.com/a/23986686
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6763867
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36961774
score: 0
answer count: 2
upvote count: 1

http://stackoverflow.com/q/24036736
favorite count: 0
has comment: http://stackoverflow.com/comment/37055550
has comment: http://stackoverflow.com/comment/37055530
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37055438
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37056227
has body: I am trying to implement splash screen followed my main activity. Code below is what I have manged to do so far. And I am not able to get my splash screen working. Please help. On running the the file its showing SplashScreen.getSplashScreen() returned null.What to do ? SplashDemo.java public class SplashDemo extends Frame implements ActionListener { static void renderSplashFrame(Graphics2D g, int frame) { final String[] comps = {"foo", "bar", "baz"}; g.setComposite(AlphaComposite.Clear); g.fillRect(120,140,200,40); g.setPaintMode(); g.setColor(Color.BLACK); g.drawString("Loading "+comps[(frame/5)%3]+"...", 120, 150); } public SplashDemo() { super("SplashScreen demo"); setSize(300, 200); setLayout(new BorderLayout()); Menu m1 = new Menu("File"); MenuItem mi1 = new MenuItem("Exit"); m1.add(mi1); mi1.addActionListener(this); this.addWindowListener(closeWindow); MenuBar mb = new MenuBar(); setMenuBar(mb); mb.add(m1); final SplashScreen splash = SplashScreen.getSplashScreen(); if (splash == null) { System.out.println("SplashScreen.getSplashScreen() returned null"); return; } Graphics2D g = splash.createGraphics(); if (g == null) { System.out.println("g is null"); return; } for(int i=0; i&lt;100; i++) { renderSplashFrame(g, i); splash.update(); try { Thread.sleep(90); } catch(InterruptedException e) { } } splash.close(); setVisible(true); toFront(); } public void actionPerformed(ActionEvent ae) { System.exit(0); } private static WindowListener closeWindow = new WindowAdapter(){ public void windowClosing(WindowEvent e){ e.getWindow().dispose(); } }; public static void main (String args[]) { SplashDemo test = new SplashDemo(); } }
has answer: http://stackoverflow.com/a/24037261
type: Question
has title: swings trouble with splash screen
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37055470
accepted answer: http://stackoverflow.com/a/24037261
tagged with: splash-screen

http://stackoverflow.com/q/24050371
has title: How to intergrate user registration form with spring security
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/37096751
type: Question
score: 0
answer count: 1
tagged with: jsp
has body: I am using Spring Framework and Spring security in my web application. I want to integrate a user registration form to the front-end. I created the jsp page and the controller and linked the page to Home page. But the text box fields in the registration form are disabled when navigate to that page. I want know that spring-security is responsible for this and if yes what are the configurations I have to made in spring-security.xml Thanks. Here's my code JSP page <jsp:include page="header-form.jsp"> <jsp:param name="title" value="Customer"/> </jsp:include> <form:form id="frmEdit" method="post" form action="" modelAttribute="customer"> Personal Information First Name <form:input path="firstName" class="form-control" type="text" required="true" size="40" maxlength="10"/> Last Name <form:input path="lastName" class="form-control" type="text" required="true" size="40" /> <c:if test="${screenMode == 'add'}"> Country <form:select path="countryCode.id" id="countrylist" class="form-control"> Select <form:options items="${countryList}" itemValue="id" itemLabel="countryDesc" /> </form:select> </c:if> Contact No <form:input path="contactNo" class="form-control" type="text" required="true" size="40" /> Email <form:input path="email" class="form-control" type="text" required="true" size="40" /> NIC / PP / DL <form:input path="nicPpDl" class="form-control" type="text" required="true" size="40" /> Login Details User Name <form:input path="userName" class="form-control" type="text" required="true" size="20" /> Pass Word <form:input path="password" class="form-control" type="text" required="true" size="20" /> Confirm PassWord <form:input path="" class="form-control" type="text" required="true" size="40" /> Save changes Cancel </form:form> spring-security.xml Note that /cus/customer/list is the url for registration form. <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xm…
tagged with: spring-security
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24299922

http://stackoverflow.com/a/24791243
type: Answer
has body: Judging by your code you are loading and then rendering the map repeatedly in your update loop. This is bound to be rather slow. Instead, I would suggest you create your Map instance once, and introduce a method to this class that just calls the render(x, y) function and call that from your update loop.
answers question: http://stackoverflow.com/q/24027391
score: 0

http://stackoverflow.com/q/24056657
has comment: http://stackoverflow.com/comment/37093021
has comment: http://stackoverflow.com/comment/37135869
type: AnsweredQuestion
tagged with: apache-commons
tagged with: null-pointer
tagged with: java
has comment: http://stackoverflow.com/comment/37136188
score: 7
has answer: http://stackoverflow.com/a/33877280
has comment: http://stackoverflow.com/comment/37092537
type: Question
has comment: http://stackoverflow.com/comment/37129018
has body: Instead of the usual if (myString == null || myString.equals("")) I tend to prefer using the org.apache.commons.lang.StringUtils class and do if (StringUtils.isEmpty(myString)). However this - at least the way I'm doing it - comes with a gigantic downside: because FindBugs - or the compiler warning mechanism, f. ex. from Eclipse - will no longer see the explicit null-check, it will no longer consider myString as potentially null, so it will no longer raise the warnings about potential (or sure) null pointers on it, and those warnings are extremely useful in my view. Example (ADDED): import org.apache.commons.lang.StringUtils; public class TestWarning { void testWarning(String myString) { //if (myString == null || myString.equals("")) // With this, the last line shows the warning. if (StringUtils.isEmpty(myString)) // With this, no warning. { // Anything. } int x = myString.length(); // Warning is here: "Potential null pointer access: The variable myString may be null at this location" } } So I'm just trying to make sure that there is no way to eliminate or minimize this downside so that one can use StringUtils.isEmpty and still get the null pointer warnings. Maybe some annotation like @Nullcheck to add to the isEmpty method or something else ? ADDED: For ex., would it be feasible to create a custom annotation like @Nullcheck, add it to the arg of isEmpty like public static boolean isEmpty(@Nullcheck String str) just to indicate that the method does a null-check on that arg, and make so that the compiler warning mechanism or FindBugs treat a if (StringUtils.isEmpty(myString)) just like an explicit null-check ?
possible better answer: http://stackoverflow.com/a/24120996
tagged with: compiler-warnings
downvote count: 0
tagged with: findbugs
favorite count: 0
has comment: http://stackoverflow.com/comment/37128894
answer count: 3
has title: Using StringUtils.isEmpty without losing compiler warnings about null pointers
has comment: http://stackoverflow.com/comment/37093830
has comment: http://stackoverflow.com/comment/37093642
has answer: http://stackoverflow.com/a/24252610
accepted answer: http://stackoverflow.com/a/24252610
has comment: http://stackoverflow.com/comment/37129715
has comment: http://stackoverflow.com/comment/37122745
has answer: http://stackoverflow.com/a/24120996
has comment: http://stackoverflow.com/comment/37092559
upvote count: 7

converters
tags question: http://stackoverflow.com/q/24091479
tag name: converters
tags question: http://stackoverflow.com/q/23949440
type: Tag
tags question: http://stackoverflow.com/q/24088579

http://stackoverflow.com/comment/37024923
type: Comment
type: QuestionComment
score: 0
has text: Ohh, I see, you probably want while(!userLineInput.isEmpty()) {}
comment on: http://stackoverflow.com/q/24020223

http://stackoverflow.com/q/24102420
linked to: http://stackoverflow.com/q/13194081
tagged with: android
tagged with: sqlite
favorite count: 0
has body: I'm new to android and I'm working on a scheduling app. I've been using SQLite to store data onto my device and it's been working, however, I do have a delete button that I'm trying to also use to get rid of the item found in the list view. This is my DatabaseHandler.java code: private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "assignmentManager", TABLE_ASSIGNMENTS = "assignments", KEY_ID = "id", KEY_NAME = "name", KEY_TIME = "time", KEY_ASSIGNED = "assigned", KEY_DUE = "due"; public DatabaseHandler(Context context) { super( context, DATABASE_NAME, null, DATABASE_VERSION ); } @Override public void onCreate( SQLiteDatabase db ) { db.execSQL( "CREATE TABLE " + TABLE_ASSIGNMENTS + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_NAME + " TEXT," + KEY_TIME + " INTEGER," + KEY_ASSIGNED + " TEXT," + KEY_DUE + " TEXT )" ); } @Override public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ) { db.execSQL( "DROP TABLE IF EXISTS " + TABLE_ASSIGNMENTS ); onCreate( db ); } public void createAssignment( Assignment assignment ) { SQLiteDatabase db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put( KEY_NAME, assignment.getName() ); values.put( KEY_TIME, assignment.getTime() ); values.put( KEY_ASSIGNED, assignment.getAssigned() ); values.put( KEY_DUE, assignment.getDue() ); db.insert( TABLE_ASSIGNMENTS, null, values ); db.close(); } public Assignment getAssignment( int id ) { SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query( TABLE_ASSIGNMENTS, new String[] { KEY_ID, KEY_NAME, KEY_TIME, KEY_ASSIGNED, KEY_DUE }, KEY_ID + "=?", new String[] { String.valueOf(id) }, null, null, null, null ); if ( cursor != null ) cursor.moveToFirst(); GregorianCalendar dateDue = new GregorianCalendar( Assignment.getYear( cursor.getString( 4 ) ), Assignment.getMonth(cursor.getString(4)), Assignment.getDay(cursor.getString(4)) ); GregorianCalendar dateAssigned = new GregorianCalendar( Assi…
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37180298
answer count: 0
score: 1
tagged with: java
downvote count: 1
type: Question
has title: SQLite Delete Objects on Android
has comment: http://stackoverflow.com/comment/37182010

http://stackoverflow.com/a/23955892
upvote count: 1
has body: Is this what you are looking for? public class Main { public static void createFolder(String path) throws Exception { File dir = new File(path); dir.mkdir(); } public static void main(String[] args) throws Exception { String path = args[0]; //takes the first argument from the command line createFolder(path); } } So running your application with java -jar myapp.jar /home/me/folder would create the folder with the path /home/me/folder
type: Answer
answers question: http://stackoverflow.com/q/23955836
downvote count: 0
score: 1

http://stackoverflow.com/comment/37186731
has text: For the record, the question presented as duplicated isn't the same.
comment on: http://stackoverflow.com/q/24064234
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37094316
has text: hello Elias, sorry to bother you again, but i em still not able to run my code, I am providing all the information,lyk what i am left with after you told me what to do, please see if you can help me out. main class file location: C:\Users\Abc\Documents\NetBeansProjects\JavaApplication11\src\javaapplication11, exec command exec('C:\Users\Abc\Documents\NetBeansProjects\JavaApplication11\src\javaapplication11\main' .escapeshellarg($phonecode). ' '.escapeshellarg($keyword).' '.escapeshellarg($location), $output, $status); i didn't understand the part Then, to execute, you need to run the java..
comment on: http://stackoverflow.com/a/24055784
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37044237
type: AnswerComment
has text: Instead of doing substring. you can use groups().
type: Comment
comment on: http://stackoverflow.com/a/24030743
score: 0

http://stackoverflow.com/a/51132362
upvote count: 8
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/23952011
accepted answer of: http://stackoverflow.com/q/23952011
has body: Regardless of the technology you're using, you should always go "truth first". Where is the truth in an XML interface? In its XSD specification, not some implementation classes in any arbitrary language. Likewise, where's the truth when interacting with an RDBMS? It's in the database, written in the form of DDL. The database should "own" its schema, not have it generated from some derived client representation. I've written about this topic here. This is the only reasonable way to stay in control of your database schema in the language that matters to the database. This is also the only way to reasonably: Evolve the schema once you go live and cannot just simply drop and re-create it again Keep in control of database performace, especially when you write SQL queries rather than using the ORM to navigate your entities. We're intending to use an ORM (almost certainly Hibernate) to map tables to Java classes. His comment was a "database first" approach would preclude the use of good OO techniques such as inheritance. You should ask yourself why you need inheritance in the first place. Since you're storing your data using the relational model, you should use the relational model's modelling features, and all client representations (e.g. your ORM's) should be derived from that. In very rare cases, inheritance is even a viable modelling technique in this area, and mostly it still doesn't work well, because after more than 20 years of OO, people have concluded that inheritance was overused in early days of OO - especially inheritance of data structures. Composition should be favoured, and is more relational anyway. Chances are that your relational model will outlive your OO client representation and you should make sure that the relational model is sound and normalised, etc. This seems a good point but I'm wondering if there are any limitations. If I started from scratch with a Class Diagram instead of a Data Model diagram, would there be a way of including all necessary H…
type: Answer
score: 7

http://stackoverflow.com/q/23999579
has comment: http://stackoverflow.com/comment/36986301
has answer: http://stackoverflow.com/a/26610889
answer count: 3
upvote count: 1
tagged with: negative-number
has answer: http://stackoverflow.com/a/23999876
accepted answer: http://stackoverflow.com/a/23999634
type: AnsweredQuestion
downvote count: 0
tagged with: if-statement
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23999634
type: Question
has body: I have this exercise I have to do for my class. I can´t change how the method works and it is a pretty stupid method. I was wondering, though, if there is a more elegant way of guarantying this method can´t use negative numbers. I used a pretty big if: void abreTeatro(int codigoCamarote, int capacidadeCamarote, int precoCamarote, int codigoFrente, int capacidadeFrente, int precoFrente, int codigoMeio, int capacidadeMeio, int precoMeio, int codigoFundo, int capacidadeFundo, int precoFundo) { if ((codigoCamarote &gt; 0) &amp;&amp; (capacidadeCamarote &gt; 0) &amp;&amp; (precoCamarote &gt; 0) &amp;&amp; (codigoFrente &gt; 0) &amp;&amp; (capacidadeFrente &gt; 0) &amp;&amp; (precoFrente &gt; 0) &amp;&amp; (codigoMeio &gt; 0) &amp;&amp; (capacidadeMeio &gt; 0) &amp;&amp; (precoMeio &gt;0) &amp;&amp; (codigoFundo &gt; 0) &amp;&amp; (capacidadeFundo &gt; 0) &amp;&amp; (precoFundo &gt; 0)) { //do Something}; } } It´s an ugly code.... Even if I still use the IF part of the code, is there an alternative syntax that I could use to make this code more presentable?
possible better answer: http://stackoverflow.com/a/23999876
has title: More elegant way of guarantying a method can´t use negative numbers?
favorite count: 0

http://stackoverflow.com/a/24079994
type: Answer
has body: There's no difference in storing such constants. But it's usually not a good code-style.
answers question: http://stackoverflow.com/q/24079824
score: 0

http://stackoverflow.com/a/24048566
has comment: http://stackoverflow.com/comment/37077996
type: AcceptedAnswer
downvote count: 0
has body: PreparedStatement's indices start at 1. So instead of setting your parametres to 0, 1, 2, set them to 1, 2, 3. ps.setInt(1, id); ps.setString(2, name); ps.setInt(3, age); As to your second question: There's no real intuition to resolving these kinds of problems. The intuition will come with experience. What helps is a quick look at docs/tutorials, and seeing if something doesn't pop out at you that differs to your code/solution. Maybe take a break, and come back a bit later to get a fresh look at what you've done, see if you don't spot something you missed before.
answers question: http://stackoverflow.com/q/24048543
type: Answer
accepted answer of: http://stackoverflow.com/q/24048543
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37077959
has comment: http://stackoverflow.com/comment/37078244

http://stackoverflow.com/comment/37114461
type: QuestionComment
has text: Since `n` is a static field, the first iteration of your for loop is the only one where your `while` will be entered. Also, you don't need to keep re-instantiating Random (and in fact that's a really **bad** idea). You don't need a temporary int (or a cast) for gen.nextInt() either.
comment on: http://stackoverflow.com/q/24068167
score: 0
type: Comment

http://stackoverflow.com/q/23971419
score: 1
tagged with: java
downvote count: 1
type: Question
tagged with: ubuntu
accepted answer: http://stackoverflow.com/a/23971620
tagged with: bash
has title: How do I write a shell script to get a given process idle time?
answer count: 1
tagged with: shell
favorite count: 0
has body: I am new to Linux. I don't know about shell scripts. I need to get the idle process time of a given Linux process. I am writing a Java program. But there are no Linux commands for my need. How do I write a shell script that could do this? Then I can execute this script from Java.
tagged with: linux
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23971620

http://stackoverflow.com/comment/36993445
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23992670
has text: @Fabian `worker.get()` is supposed to be called within the `done()` method of the same worker, not anywhere else. In fact, unless you are making a pausing or stopping mechanism, you should not be keeping a reference of it at all. You haven't fixed much really. You must create your frame in EDT, in the initialization. Then, `doInBackground` is performed in the background, asynchronously. And then the `SwingWorker` calls its own `done()` and `process` methods on the EDT, you DO NOT call them yourself.
type: AnswerComment

http://stackoverflow.com/comment/37026248
comment on: http://stackoverflow.com/q/24021152
score: 0
type: Comment
type: QuestionComment
has text: Have you tried this? You can find if this is working or not by simple trying it. :)

http://stackoverflow.com/q/24026118
has comment: http://stackoverflow.com/comment/37035832
type: Question
score: -2
duplicate of: http://stackoverflow.com/q/9744639
answer count: 1
has comment: http://stackoverflow.com/comment/37035930
has body: I have a text document with maybe 50 URLs in there that I want the page titles to. I've been trying to use some code that does do that, but the compiler seems to be tripping up on scanner versus string arguments. Ideally, I'd like to take in a text document of URLs and dump the corresponding page titles to another doc. import java.io.*; import java.util.*; import java.net.URL; import java.net.URLConnection; import java.nio.charset.Charset; import java.util.regex.Matcher; import java.util.regex.Pattern; //code from: http://www.gotoquiz.com/web-coding/programming/java-programming/how-to-extract-titles-from-web-pages-in-java/ public class TitleExtractor { /* the CASE_INSENSITIVE flag accounts for * sites that use uppercase title tags. * the DOTALL flag accounts for sites that have * line feeds in the title text */ private static final Pattern TITLE_TAG = Pattern.compile("\\&lt;title&gt;(.*)\\&lt;/title&gt;", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); /** * @param x the HTML page * @return title text (null if document isn't HTML or lacks a title tag) * @throws IOException */ public static String getPageTitle(String url) throws IOException { URL u = new URL(url); URLConnection conn = u.openConnection(); // ContentType is an inner class defined below ContentType contentType = getContentTypeHeader(conn); if (!contentType.contentType.equals("text/html")) return null; // don't continue if not HTML else { // determine the charset, or use the default Charset charset = getCharset(contentType); if (charset == null) charset = Charset.defaultCharset(); // read the response body, using BufferedReader for performance InputStream in = conn.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in, charset)); int n = 0, totalRead = 0; char[] buf = new char[1024]; StringBuilder content = new StringBuilder(); // read until EOF or first 8192 characters while (totalRead &lt; 8192 &amp;&amp; (n = reader.read(buf, 0, buf.length)) != -1) { content.append(buf, 0, n)…
favorite count: 0
has title: Page titles from URLs dumped to file
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24026201
downvote count: 2
linked to: http://stackoverflow.com/q/9744639
has comment: http://stackoverflow.com/comment/37035952
upvote count: 0
tagged with: java

http://stackoverflow.com/a/24293696
type: AcceptedAnswer
has body: Please try using pubnub gwt jar available here https://github.com/pubnub/java/raw/gwt-uuid/gwt/3.3/api/PubnubGwt.jar The uuid you want to set can be passed to init method . Sample usage here https://github.com/pubnub/java/blob/gwt-uuid/gwt/3.3/examples/PubnubExample/src/com/pubnub/gwt/examples/client/PubnubExample.java#L101 'gwt-test-uuid' is the custom uuid in this case
answers question: http://stackoverflow.com/q/24062077
type: Answer
accepted answer of: http://stackoverflow.com/q/24062077
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/comment/37106438
type: Comment
has text: Nothing. I'll redo my project from the start, he is in the top right. Thank you.
comment on: http://stackoverflow.com/q/24063270
score: 0
type: QuestionComment

callouts
tags question: http://stackoverflow.com/q/24013082
tag name: callouts
type: Tag

http://stackoverflow.com/q/24021518
has title: App with google play location services crashes on launch
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37026945
tagged with: java
has body: After solving this problem yesterday there are no syntax errors anymore in my code. However when I launch my app on my phone it immediately crashes. I'm not sure where the error comes from and I think it's too much code if I post everything, so I will first post the logcat and if someone can narrow the error down I will post the corresponding section of the code. 06-03 19:18:34.288: D/AndroidRuntime(22511): Shutting down VM 06-03 19:18:34.288: W/dalvikvm(22511): threadid=1: thread exiting with uncaught exception (group=0x41532ba8) 06-03 19:18:34.288: E/AndroidRuntime(22511): FATAL EXCEPTION: main 06-03 19:18:34.288: E/AndroidRuntime(22511): Process: com.axelfiedler.stayup, PID: 22511 06-03 19:18:34.288: E/AndroidRuntime(22511): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.axelfiedler.stayup/com.axelfiedler.stayup.MainActivity}: java.lang.IllegalStateException: Not connected. Call connect() and wait for onConnected() to be called. 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.app.ActivityThread.access$800(ActivityThread.java:135) 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.os.Handler.dispatchMessage(Handler.java:102) 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.os.Looper.loop(Looper.java:136) 06-03 19:18:34.288: E/AndroidRuntime(22511): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-03 19:18:34.288: E/AndroidRuntime(22511): at java.lang.reflect.Method.invokeNative(Native Method) 06-03 19:18:34.288: E/AndroidRuntime(22511): at java.lang.reflect.Method.invoke(Method.java:515) 06-03 19:18:34.288: E/AndroidRuntime(22511): at com.android.inte…
answer count: 1
has comment: http://stackoverflow.com/comment/37027181
accepted answer: http://stackoverflow.com/a/24021616
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/24004471
has answer: http://stackoverflow.com/a/24021616
type: Question

http://stackoverflow.com/a/24056665
type: Answer
score: 1
has body: You can use a regular expression, looking from {custom to }. It will look like this: Pattern pattern = Pattern.compile("\\{custom.*?\\}", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(inputString); while (matcher.find()) { System.out.print(matcher.group()); } The .* after custom means 0 or more characters after the word "custom", and the question mark limits the regex to as few character as possible, meaning that it will break on the next } that it can find.
upvote count: 1
answers question: http://stackoverflow.com/q/24056577
has comment: http://stackoverflow.com/comment/37093111
downvote count: 0

http://stackoverflow.com/comment/37148335
type: AnswerComment
score: 0
type: Comment
has text: Can you provide me a detailed explanation as to how can i use NSIS for this.
comment on: http://stackoverflow.com/a/24084854

http://stackoverflow.com/comment/57628074
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24102730
has text: Coming to speak of extension methods and Java ... Is there a chance that Java somewhen in Java10+ or so will have them? I mean is there a general problem that prevents Java from having extension methods like binary backwards compatibility?

http://stackoverflow.com/q/23977793
tagged with: android
has title: How to programatically clear a diffrent apps data
tagged with: android-studio
type: UnansweredQuestion
has body: am making a app that clears the internet cache when you click a button. In which i want it to have the permission you clear other app data. I have tried many different codes and cant find a one that is used for this purpose. Is there a special permission i need or is it even possible. I have tried this code in MainActivity.java but cant seem to get it to work: private void clearPreferences() { try { // clearing app data Runtime runtime = Runtime.getRuntime(); runtime.exec("pm clear com.android.browser"); } catch (Exception e) { e.printStackTrace(); } } Any help would be great. Thanks!
type: Question
tagged with: browser-cache
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23983437
linked to: http://stackoverflow.com/q/5527764
duplicate of: http://stackoverflow.com/q/4856955
downvote count: 2
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/4856955
favorite count: 0

http://stackoverflow.com/comment/37163344
type: Comment
comment on: http://stackoverflow.com/a/24094650
type: AnswerComment
has text: Of course you should make the code more "synamic" so it can handle other kernel sizes and dimensions. If it was 1x5 then it should end 2 elments sooner than before.
score: 0

http://stackoverflow.com/a/23946268
has body: PreparedStatement pstmt = conexao.prepareStatement("select p.telefone, p.celular, u.email" + " from prestador as p inner join usuario as u on p.usuario = u.idusuario where p.idprestador=?"); This should fix the issue. The sql produced by your code is select p.telefone, p.celular, u.emailfrom prestador as p inner join usuario as u on p.usuario = u.idusuario where p.idprestador=? You need a space before the from clause.
has comment: http://stackoverflow.com/comment/36886493
answers question: http://stackoverflow.com/q/23946253
score: 0
has comment: http://stackoverflow.com/comment/36886485
type: Answer

http://stackoverflow.com/comment/36926268
has text: Print out `len` in the line before the one with the failure. It would really help if you'd show a short but *complete* program demonstrating the problem.
score: 0
comment on: http://stackoverflow.com/q/23967491
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23955462
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/23966368
answer count: 2
has title: How to generate unique element names or auto-increment element names with JAXB?
accepted answer: http://stackoverflow.com/a/23995734
favorite count: 0
has body: Is there a way to auto-increment the element names of a Collection when marshalling to an XML using JAXB? I generate an XML using this code: public void saveTestSettings(final String filename, final DefaultTestSettings t) throws Exception { try { final Path path = FileSystems.getDefault().getPath((paths.getTestSettingsPath() + filename)); if (Files.notExists(path.getParent())) throw new Exception(path.getParent().toString() + " does not exist!!"); final OutputStream out = new BufferedOutputStream(Files.newOutputStream(path)); final JAXBContext jaxbContext = JAXBContext.newInstance(DefaultTestSettings.class); final Marshaller m = jaxbContext.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(t, out); out.flush(); out.close(); } catch (JAXBException | IOException e) { e.printStackTrace(); throw new Exception(e.getMessage()); } } The resulting XML looks like this: A200 A0 A300 A400 A1 I would like the groups and instruments to be automatically incremented, so that the result looks like this: A200 A0 A300 A400 A1 I am not too familiar with using XML schema, would that work?
upvote count: 3
linked to: http://stackoverflow.com/q/10109418
has answer: http://stackoverflow.com/a/23995734
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36903410
possible better answer: http://stackoverflow.com/a/23966368
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36906183
downvote count: 0
type: Question
score: 3
has comment: http://stackoverflow.com/comment/36906105

http://stackoverflow.com/comment/37153036
score: 0
type: Comment
type: QuestionComment
has text: I just check and no fragment contains another fragment
comment on: http://stackoverflow.com/q/24088621

pool
tags question: http://stackoverflow.com/q/23962359
tag name: pool
type: Tag
tags question: http://stackoverflow.com/q/23946269

http://stackoverflow.com/comment/36979868
comment on: http://stackoverflow.com/q/23996269
score: 1
has text: You probably didn't register the namespace. Try `//*[local-name()='code']/text()`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36979637
type: Comment
has text: that's working.. thanks. could you please give me some links regarding what's going on here?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23995652

http://stackoverflow.com/comment/97760283
has text: Fantastic answer! The first one I find that not only repeats the mantra "db user != app user", but actually justifies it with a convincing argument.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24025987
type: AnswerComment

http://stackoverflow.com/comment/37084382
comment on: http://stackoverflow.com/q/24052289
score: 0
type: Comment
type: QuestionComment
has text: What is the value of gotText ? Did you try to print the value

http://stackoverflow.com/a/24031034
has body: Maybe you need to tackle different input formats Then catch the currently unmanaged format exception (just a sample): private String getconvertdate(String date) { System.out.println(date.length()); DateFormat inputFormat = null; if(date.length() == 20) inputFormat = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss",Locale.ENGLISH); if(date.length() == 10) inputFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.ENGLISH) ; if(null == inputFormat) return "Format invalid"; inputFormat.setTimeZone(TimeZone.getTimeZone("UTC")); DateFormat outputFormat = new SimpleDateFormat("dd-MMM-yyyy",Locale.ENGLISH); Date parsed = null; try { parsed = inputFormat.parse(date); } catch (ParseException e) { return "Input Date invalid"; } String outputText = outputFormat.format(parsed); return outputText; }
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24030767
upvote count: 3

http://stackoverflow.com/q/24055947
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37091301
has comment: http://stackoverflow.com/comment/37097294
has body: I have a server and that machine i run the server socket code. I have used thread pool to maintain the thread. The problem is, when i start the server socket it's listening fine. But the next day i see the console that is paused at some level and no listening at any TCP packets. There is no exception generated. Is there any limit of listening packets on server in java? How can i resolve this problem? Server class public final class Server { private final ServerSocket serverSocket; private final ExecutorService pool; public Server(int port, int poolSize) throws IOException { serverSocket = new ServerSocket(port); pool = Executors.newFixedThreadPool(poolSize); System.out.println("Server running..."); runServerEngine(); } public void runServerEngine() { // run the service try { while (true) { System.out.println("user come "); pool.execute(new Handler(serverSocket.accept())); } } catch (IOException ex) { System.out.println("Error " + ex); //pool.shutdown(); } } public static void main(String[] args) throws IOException { Server server = new Server(1256, 20);//port number and pooling size } } Handler class class Handler implements Runnable { private Socket socket = null; //private static Location location = new Location(); Handler(Socket socket) { this.socket = socket; } private Handler() { } String recievedPacket = null; @Override public void run() { // read and service request on socket try { BufferedReader in = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); while ((recievedPacket = in.readLine()) != null) { //recievedPacket = in.readLine(); System.out.println("Recieved packate " + recievedPacket); if (recievedPacket != null) { try { System.out.println("Saving function " + recievedPacket); } catch (Exception ex) { System.out.println(ex); } } } } catch (IOException ex) { System.out.println(ex); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/24059274
accepted answer: http://stackoverflow.com/a/24059274
has comment: http://stackoverflow.com/comment/37091316
tagged with: sockets
tagged with: multithreading
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37096866
score: 1
tagged with: java
has title: Java server socket program after one day it stops listening
type: Question

http://stackoverflow.com/a/24103874
accepted answer of: http://stackoverflow.com/q/24103725
answers question: http://stackoverflow.com/q/24103725
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37181754
has body: No, it cannot be changed by programming. It is based on alphabetical order.. So if you really want to make your app appear first you gotta follow the strategy adopted by Dropbox, Pocket.. etc, ie "Add to Dropbox" "Add to pocket" so that A appears first in the list
type: Answer
has comment: http://stackoverflow.com/comment/100861582

http://stackoverflow.com/q/23991281
has title: Regex to check indonesian format number
has body: I try to check Indonesian format number using java regex. But i have some problem to do it. The problem is my regex can't detect 0,12 and 2.005.000 as a number(true). Below valid number in Indonesian format: 1 15 0,12 123.621 2.005.000 This is my code : Pattern doublePattern = Pattern.compile("[-+]?\\d*\\.?\\d+"); System.out.println("1 is "+doublePattern.matcher("1").matches()); System.out.println("15 is "+doublePattern.matcher("15").matches()); System.out.println("0,12 is "+doublePattern.matcher("0,12").matches()); System.out.println("123.621 is "+doublePattern.matcher("123.621").matches()); System.out.println("2.005.000 is "+doublePattern.matcher("2.005.000").matches()); Result/output program : 1 is true 15 is true 0,12 is false 123.621 is true 2.005.000 is false 0,12 and 2.005.000 are false(not detect as number). i think my regex is wrong.
favorite count: 0
has comment: http://stackoverflow.com/comment/36972534
possible better answer: http://stackoverflow.com/a/23991390
has answer: http://stackoverflow.com/a/23991390
accepted answer: http://stackoverflow.com/a/23991371
score: -3
tagged with: regex
type: AnsweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23991394
type: Question
has comment: http://stackoverflow.com/comment/36970237
has answer: http://stackoverflow.com/a/23991371
has comment: http://stackoverflow.com/comment/36970167
answer count: 3
upvote count: 0

http://stackoverflow.com/a/24004809
upvote count: 2
answers question: http://stackoverflow.com/q/23995566
downvote count: 0
has body: The window above was produced with the code below, which uses 3 external classes. import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class GridBagLayout{ JFrame frame; public GridBagLayout() { initComponents(); } private void initComponents(){ JTextField text = new JTextField("",10); JButton but1 = new JButton("button 1"); JButton but2 = new JButton("button 2"); JButton but3 = new JButton("button 3"); JLabel lab0 = new JLabel("Enter a sentence"); JLabel lab1 = new JLabel("test 1"); JLabel lab2 = new JLabel("test 2"); JLabel lab3 = new JLabel("test 3"); frame = new JFrame("TestGridBagLayout"); frame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); frame.setLayout(new java.awt.GridBagLayout()); frame.add(lab0, new GBConstraints(0,0)); frame.add(text, new GBConstraints(1,0)); frame.add(but1, new GBConstraints(0,1)); frame.add(lab1, new GBConstraints(1,1)); frame.add(but2, new GBConstraints(0,2)); frame.add(lab2, new GBConstraints(1,2)); frame.add(but3, new GBConstraints(0,3)); frame.add(lab3, new GBConstraints(1,3)); frame.setVisible(true); frame.pack(); } public static void main(String[] args) { new GridBagLayout(); } } The window below was produced by changing the new GBConstraints lines above to the lines shown below the picture, the point being that there are several fairly easy ways to tweak the layout to make it look just the way you want--how close together and how vertically aligned, for two issues. frame.add(lab0, new GBConstraints(0,0).anchor(EAST)); frame.add(text, new GBConstraints(1,0).ipad(100, 0).anchor(WEST)); frame.add(but1, new GBConstraints(0,1)); frame.add(lab1, new GBConstraints(1,1)); frame.add(but2, new GBConstraints(0,2)); frame.add(lab2, new GBConstraints(1,2).insets(15, -15, 5, 5)); frame.add(but3, new GBConstraints(0,3).anchor(EAST)); frame.add(lab3, new GBConstraints(1,3).anchor(WEST)); Note that the second line above has two constraints added onto th…
type: Answer
has comment: http://stackoverflow.com/comment/36996203
score: 2

http://stackoverflow.com/a/60099997
has body: I have tried these versions of the below softwares; they work together and generate the jacoco report without any extra effort. I use the gradle build tool with powermock, mockito and wiremock. powermock-api-mockito2:2.0.2 powermock-module-junit4:2.0.2 gradle 5.6.2 The above correctly generates the jacoco coverage report.
upvote count: 1
has comment: http://stackoverflow.com/comment/106295197
has comment: http://stackoverflow.com/comment/106295713
score: 1
answers question: http://stackoverflow.com/q/23983740
downvote count: 0
type: Answer

http://stackoverflow.com/q/24057255
favorite count: 0
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has body: I've read A LOT about this matter but nothing seems to work with me right! I'm using Netbeans 8.0 and Python 2.6.5, Jython 2.5.1 (the default from adding Python and Jython Plugin to netbeans) I'm a mac os x 10.9.3 user I tried to open a new Jython Code where I add the path to python to get it work: /Library/Frameworks/Python.framework/Versions/2.7/bin/python and it does. I also tried to call a Python code from Java code using Jython and it works for simple print code. But when I add an nltk POS code (which work very fine in Python interpreter) it throws an error: ImportError: No module named nltk I thried those Paths: /Library/Frameworks/Python.framework/Versions/2.7/bin/python /Library/Python/2.7/site-package when I call python from terminal the nltk import work fine: Sosys-MacBook-Pro:~ ha$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ha/apache-maven-3.2.1/bin:/Users/ha/apache-opennlp-1.5.3/bin:/Users/ha/jython2.5.4rc1:/Users/ha/nltk_data:/Library/Python/2.7/site-packages:/usr/lib/python2.7/ Sosys-MacBook-Pro:downloads ha$ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import nltk &gt;&gt;&gt; Then I get another error: ImportError: No module named signal. and so on with those no module named... I also tried to add jython-standalone-2.7-b21.jar in the classpath in the Libraries but it doesn't solve this problem. How can I get it work? Appendix: my Java Code: package jythonprojecttes; import java.lang.*; import org.python.util.PythonInterpreter; public class JythonProjectTes { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here try { System.out.print(java.lang.System.getProperty("java.class.path")); PythonInterpreter.initialize(System.getProperties(), System.getProperties(), new String[0]); PythonInterpreter interp = new Pyth…
tagged with: jython-2.5
tagged with: java
type: Question
upvote count: 4
has title: Jython in Java error: ImportError: No module named
downvote count: 0
score: 4
tagged with: python-2.7
tagged with: macos

http://stackoverflow.com/comment/37098364
has text: I wish you'd made it clearer which API you were using in the original question, and that you were working with NamedIndividuals. It's still not too hard to list equal individuals with the OWLAPI, though. It should be a matter of asking for same individual axioms… I might get to come back to this in a while…
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24058130

http://stackoverflow.com/comment/37039249
type: QuestionComment
type: Comment
has text: `Future` might help you. See http://stackoverflow.com/questions/2275443/how-to-timeout-a-thread
comment on: http://stackoverflow.com/q/24027314
score: 0

http://stackoverflow.com/comment/37141028
comment on: http://stackoverflow.com/q/24082419
type: Comment
type: QuestionComment
has text: what do you propose? please
score: 0

http://stackoverflow.com/comment/36982779
type: Comment
comment on: http://stackoverflow.com/a/23990073
has text: What about using a ContainerRequestFilter ? Maybe you could check the requested URI in `filter(ContainerRequestContext requestContext)` and call the `ContainerRequestContext#abortWith(Response)` method to avoid calling hitting the resource. You may need to annotated this ContainerRequestFilter `@PreMatching` so that it will be executed upon receiving a client request but before a resource method is matched. (I'm not sure when the resource constructor is actually called)
type: AnswerComment
score: 0

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/23992474
tags question: http://stackoverflow.com/q/24035898
tags question: http://stackoverflow.com/q/24013404

http://stackoverflow.com/q/23949440
tagged with: java
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/36892485
has comment: http://stackoverflow.com/comment/36892376
has comment: http://stackoverflow.com/comment/36892666
tagged with: get
score: 0
has comment: http://stackoverflow.com/comment/36892387
tagged with: converters
possible better answer: http://stackoverflow.com/a/23949527
tagged with: string
has answer: http://stackoverflow.com/a/23949527
has comment: http://stackoverflow.com/comment/36892727
has comment: http://stackoverflow.com/comment/36892564
has answer: http://stackoverflow.com/a/23949529
has answer: http://stackoverflow.com/a/23949493
accepted answer: http://stackoverflow.com/a/23949493
has comment: http://stackoverflow.com/comment/36892361
has body: I have a couple to class in which I'm getting and setting a few things and then finally calling it in my main method. But when I call my class in the main method it just gives me the object instead of name,address and age. I know this structure is very complicated but I want to keep this structure because later on I will be adding a lot of things to this. It would be AMAZING if someone could tell me how to do this. I would really appreciate this. Below is my code for all my classes This is my first class public class methodOne { public String getName() { String name = "UserOne"; return name; } public int getAge() { int age = 17; return age; } public String getAddress() { String address = "United States"; return address; } } This is my second class public class methodTwo { String name; String address; int age; public methodTwo(methodOne objectOne) { name=objectOne.getName(); address=objectOne.getAddress(); age=objectOne.getAge(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } This is my third class public class methodThree { private methodTwo methodTwoInMethodThree; private methodOne methodOneInMethodThree; public methodThree() { this.methodOneInMethodThree = new methodOne(); this.methodTwoInMethodThree = new methodTwo(methodOneInMethodThree); } public methodTwo getMethodTwoInMethodThree() { return methodTwoInMethodThree; } public void setMethodTwoInMethodThree(methodTwo methodTwoInMethodThree) { this.methodTwoInMethodThree = methodTwoInMethodThree; } } This is my fourth class which is the method maker public class methodMaker { public methodThree brandNewFunction(methodTwo object) { methodThree thirdMethod = new methodThree(); thirdMethod.setMethodTwoInMethodThree(object); return thirdMethod; } } This is my main class w…
has answer: http://stackoverflow.com/a/23949755
answer count: 4
has comment: http://stackoverflow.com/comment/36892422
has title: Convert Object to String
type: AnsweredQuestion

http://stackoverflow.com/q/24066935
tagged with: fibonacci
tagged with: performance
score: -2
accepted answer: http://stackoverflow.com/a/24067083
has comment: http://stackoverflow.com/comment/37117415
upvote count: 0
answer count: 1
favorite count: 0
has body: Project Euler, problem 2: Determine the sum of the even numbers in the Fibonacci sequence up to 4 000 000. First I tried to use a recursive algorithm for the sequence but I realized I dont have all the time in the world so I now use an iterative. It is still extremely slow. Can I improve my code? public class Euler2Correct { public static int Fibonacci(int j){ /** * Metod for returnerning number [I]j[/I] in the sequence. * */ if(j&lt;=1){ return 1; } else if(j==2){ return 2; } int tmp; int a=2; int b=1; for(int k=3; k&lt;=j; k++){ tmp=a+b; b=a; a=tmp; } return a; } public static void main(String[]args){ int s=0; for(int i=2; i&lt;4000000; i=i+3){ //Every three number is even s = s + Fibonacci(i); } System.out.println(s); } }
has comment: http://stackoverflow.com/comment/37115527
has comment: http://stackoverflow.com/comment/37112007
has comment: http://stackoverflow.com/comment/37115711
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24067083
tagged with: java
downvote count: 2
has title: How to write an efficient Fibonacci summing algorithm
tagged with: loops
type: Question

http://stackoverflow.com/q/24094508
type: Question
score: 0
has body: I have a table designed this way mysql> select * from categories limit 50; +-------------+-------------+-----------------+------------+------+------+------+------+------+------+------+ | category_id | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10 | +-------------+-------------+-----------------+------------+------+------+------+------+------+------+------+ | 1 | Popcorn | Regular Pack | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 1 | Popcorn | Regular Pack | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 1 | Popcorn | Regular Pack | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 2 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 2 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 2 | Popcorn | Bucket | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 7 | Soft Drinks | Fountain | Apple | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 7 | Soft Drinks | Fountain | Apple | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 8 | Soft Drinks | Fountain | Orange | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 8 | Soft Drinks | Fountain | Orange | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 9 | Soft Drinks | Fountain | Lemon | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | 9 | Soft Drinks | Fountain | Lemon | NULL | NULL | NULL | NULL | NULL | NULL | NULL | I need to map the data of the above table . a sample xml file , just to repersent structure For example , Under Popcorn i must have Regular Pack , Bucket And under Soft Drinks i must have Fountain , and under Fountain i must have different categories Apple ,Orange and Lemon < Regular Pack> <Bucket > <Apple> <Orange> < Lemon> Once i retrive the values , how to put a condition that matches the above requirement ?? A psecoude code will be also sufficient for me to proccedd while(rs.next()) { String T1 = rs.getString("T1"); String T2 = rs.getString("T2"); String T3 = rs.getString("T3"); String T4 = rs…
has title: How do i put a condition for matching the above requirement
answer count: 1
has comment: http://stackoverflow.com/comment/37163382
has answer: http://stackoverflow.com/a/24094736
accepted answer: http://stackoverflow.com/a/24094736
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/37066984
comment on: http://stackoverflow.com/q/24041441
has text: Did you read: http://stackoverflow.com/questions/2028620/java-sockets-and-dropped-connections ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36922592
has text: What does `m.matches()` do?
comment on: http://stackoverflow.com/q/23965410
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24081792
has comment: http://stackoverflow.com/comment/90489559
has comment: http://stackoverflow.com/comment/101985219
upvote count: 27
has comment: http://stackoverflow.com/comment/37201057
accepted answer of: http://stackoverflow.com/q/24081417
type: AcceptedAnswer
downvote count: 0
has body: Simply transform the runnables into callables: List&lt;Callable&lt;Void&gt;&gt; callables = new ArrayList&lt;&gt;(); for (Runnable r : runnables) { callables.add(toCallable(r)); } executor.invokeAll(callables); private Callable&lt;Void&gt; toCallable(final Runnable runnable) { return new Callable&lt;Void&gt;() { @Override public Void call() { runnable.run(); return null; } }; }
answers question: http://stackoverflow.com/q/24081417
type: Answer
score: 27

http://stackoverflow.com/q/23951696
accepted answer: http://stackoverflow.com/a/23951924
has answer: http://stackoverflow.com/a/23951985
downvote count: 0
possible better answer: http://stackoverflow.com/a/23951985
answer count: 3
tagged with: sql
favorite count: 0
has body: I am trying to insert a $_POST array into a mysql database. The foreach works but not all values are inserted on the same row as you can see on the image below. This is the foreach that i use to insert the array into the database: if($_POST) { // con-&gt;insert is my mysql function to insert the values foreach ($_POST as $key =&gt; $value) { if($con-&gt;insert('test',$key, $value)==true) { echo 'Het werkt!!!'; } } } EDIT This is the con function public function insert($table,$row,$value) { $query = mysqli_query($this-&gt;connect, "INSERT INTO `$table` (`$row`) VALUES ('$value')"); if ($query == true) { return true; } else{ return false; } } I want to collect the variables from the post and then i want to put them in the database on the same row of the table. How can i get the values on the same row? Thank in advance
has comment: http://stackoverflow.com/comment/36896653
upvote count: 1
has comment: http://stackoverflow.com/comment/36896400
has comment: http://stackoverflow.com/comment/36896395
tagged with: php
has comment: http://stackoverflow.com/comment/36896623
has answer: http://stackoverflow.com/a/23952062
type: AnsweredQuestion
has title: How to insert $_POST from Java
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23951924
type: Question

http://stackoverflow.com/comment/37157738
has text: can you post the LogCat of the crash?
score: 3
comment on: http://stackoverflow.com/q/24091582
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23958677
answers question: http://stackoverflow.com/q/23958607
has body: Java allows you to declare a final variable, and assign it later, as long as it's not used before then. Try including your array initializer ({ "Delete", "Edit" }) in an array creation expression (new CharSequence[] { "Delete", "Edit" }): final CharSequence[] items; if (presetItemId == 0) { items = new CharSequence[] { "Delete", "Edit" }; } else{ items = new CharSequence[] { "Delete"}; } new AlertDialog.Builder(context).setTitle("Meal Item") .setItems(items, new DialogInterface.OnClickListener() { //...
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23958607
type: Answer

http://stackoverflow.com/q/23948913
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23948938
type: Question
score: -2
has answer: http://stackoverflow.com/a/23948973
answer count: 2
downvote count: 2
favorite count: 0
has body: Application Structure first: //This class has a listview which will be populated from custom adapter public class Transactions_show extends Activity implements OnItemClickListener //This class is custom adapter which returns custom view for each row to be populated in above listview using sqlite database public class CustomAdapter extends BaseAdapter //Here all is working fine //Now //setting onitemclicklistener on each item of listview public class Transactions_show extends ListActivity implements OnItemClickListener { List&lt;Transactions&gt; all_transactions; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.all_transactions); DatabaseHandler db = new DatabaseHandler(getApplicationContext()); all_transactions = db.get_all_transactions(); size_of_transaction = all_transactions.size(); ListView all_transactions_list = (ListView) findViewById(R.id.all_transaction_show_list); CustomAdapter adapter = new CustomAdapter(this, all_transactions); all_transactions_list.setAdapter(adapter); try { all_transactions_list.setOnItemClickListener(this); } catch (NullPointerException e) { Log.e("null pointer exception at item click", e.getMessage()); } } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Transactions single_transaction = new Transactions(); single_transaction = all_transactions.get(position); Intent intent = new Intent(this, transacee_summary.class); int p_n = single_transaction.get_phone_number(); Intent.putExtra("phone_number", p_n); startActivity(intent); /* * Toast toast = Toast.makeText(getApplicationContext(), "Item " + * (position + 1) + ": " +single_transaction.get_phone_number() , * Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM | * Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); */ } } error is occuring here Intent.putExtra("phone_number", p_n); Which is : Cannot make a static reference to the non-static method putExtra(String, i…
tagged with: android-listview
type: UnansweredQuestion
tagged with: custom-adapter
tagged with: android
linked to: http://stackoverflow.com/q/2042813
linked to: http://stackoverflow.com/q/768969
has title: Cannot make a static reference to the non-static method in onitemclicklistener on custom listview adapter fetching data from sqlite database

http://stackoverflow.com/comment/37037407
comment on: http://stackoverflow.com/a/24026948
type: AnswerComment
type: Comment
has text: so you means if i make small buffer many times, there total sizes can be over 2^31 ? when I allocate many times, I can't see memory increasing. how can I do? can you show me some code snippets?
score: 0

http://stackoverflow.com/comment/36939443
has text: Do you know what is it? Can you display it's hex value?
score: 1
comment on: http://stackoverflow.com/q/23974982
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37050377
comment on: http://stackoverflow.com/a/24032166
type: AnswerComment
score: 0
type: Comment
has text: I have updated my answer. I think I didn't understood correctly what you neede. I hope the last change is what you want. Best regards.

http://stackoverflow.com/q/24091320
type: Question
has answer: http://stackoverflow.com/a/24092094
score: 0
answer count: 1
has title: Apple fullscreen hook for Java
tagged with: macos
accepted answer: http://stackoverflow.com/a/24092094
has body: So far I have taking the application to fullscreen working without a problem. However, when the user uses the operating system controls to bring the window out of fullscreen, I need to perform an action. Is there a hook or event that I can use to do this? I found AppEventListener in com.apple.eawt, but it appears to be empty.
tagged with: swing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/37174194
score: 0
type: Comment
type: QuestionComment
has text: This might be more appropriate on a different site? Also this is hardly a java question. The only relation to java is that glassfish is written in java and is a javaee server. But the password management has nothing todo with java.
comment on: http://stackoverflow.com/q/24100437

http://stackoverflow.com/comment/36911829
type: QuestionComment
score: 1
has text: These related might be useful: 1) [Adding a custom tool to the android adb shell](http://stackoverflow.com/questions/23131081/adding-a-custom-tool-to-the-android-adb-shell) and 2) [How can i run C binary (executable file) in Android from Android Shell](http://stackoverflow.com/questions/9868309/how-can-i-run-c-binary-executable-file-in-android-from-android-shell)
comment on: http://stackoverflow.com/q/23959210
type: Comment

http://stackoverflow.com/comment/36981423
type: QuestionComment
comment on: http://stackoverflow.com/q/23997059
has text: Looks like bad design.
score: 1
type: Comment

http://stackoverflow.com/q/23952824
tagged with: java
tagged with: regedit
type: Question
duplicate of: http://stackoverflow.com/q/16871179
score: 0
answer count: 2
has title: Java: how to run jar application as MS Windows Context Menu (Right Click on Screen)?
tagged with: jar
has answer: http://stackoverflow.com/a/23953369
has answer: http://stackoverflow.com/a/23953147
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16871179
tagged with: contextmenu
has body: I read this article and wanted to do same thing using Java (.jar) file instead of .exe And suppose my program just prints the path of the selected file which right clicked to my content menu. Please see below Image. I want like this the option(Copy File Path) in MS Windows Context Menu using a Java Application: Sorry for my weird language, i hope somebody fix that. Best regards

code-injection
tags question: http://stackoverflow.com/q/24070481
tag name: code-injection
tags question: http://stackoverflow.com/q/23944934
type: Tag

http://stackoverflow.com/q/24000459
has comment: http://stackoverflow.com/comment/36988023
has title: How to inspect JSP request URL for String
type: Question
has answer: http://stackoverflow.com/a/24001049
has body: I have the following processor.jsp file: &lt;% response.sendRedirect("http://buzz.example.com"); %&gt; I want to change it so that it inspects the HTTP request URL for the presence of the word "fizz" and, if it exists, redirect the user to http://fizz.example.org instead. So something like: &lt;% String reqUrl = request.getURL().toLowerCase(); String token = null; if(reqUrl.contains("fizz")) { token = "fizz"; } else { token = "buzz"; } String respUrl = "http://%%%TOKEN%%%.example.com".replace("%%%TOKEN%%%", token); response.sendRedirect(respUrl); %&gt; However this doesn't work. Any ideas on what I should be using instead of request, or if I'm doing anything else wrong?
tagged with: jsp
answer count: 1
has comment: http://stackoverflow.com/comment/36989991
has comment: http://stackoverflow.com/comment/36987970
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36990178

http://stackoverflow.com/a/23995296
answers question: http://stackoverflow.com/q/23995085
upvote count: 1
downvote count: 1
type: Answer
has body: The first is the standard output for the toString() method. See here. The second is the hashcode for this object.
score: 0

http://stackoverflow.com/comment/37054417
type: AnswerComment
type: Comment
has text: ya i've got the code and its working correctly but its not delivering the message @gau123
comment on: http://stackoverflow.com/a/24035165
score: 0

http://stackoverflow.com/comment/37146095
type: QuestionComment
comment on: http://stackoverflow.com/q/24085180
score: 0
has text: another simple example: HttpServletResponse presponse; presponse.setContentType(application/download; charset=utf-8)); presponse.setHeader("Content-Disposition", "attachment;filename=\"" + param.get("fileName") + "." + param.get("extension") + "\""); ServletOutputStream lout = presponse.getOutputStream(); lout.write((byte[]) Utilities.covertObjecttoByteArray(data)); but I get a file with special characters
type: Comment

http://stackoverflow.com/comment/37097687
has text: Oh my. I completely took the spring security out of scope of my trouble there. Do you know any walkaround I could try?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24058657
type: AnswerComment

http://stackoverflow.com/comment/37172836
comment on: http://stackoverflow.com/q/24099456
score: 0
has text: @Pshemo I tried doing that but it threw an error...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23981799
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: intellij-idea
tagged with: eclipselink
tagged with: jpa
downvote count: 0
has body: Thanks to all... I've three jars, one with dao logic, other with persistence archive (mappings, persistence.xml and some orm files) and other is the application project. I'm using intellij idea 13 and gradle to develop this application but in the application project, when I try to run obtains the next error: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException Exception Description: An exception was thrown while trying to load persistence unit at url: file:/F:/IdeaProjects/com.reyma.db/out/artifacts/com_reyma_db/com.reyma.db.jar Internal Exception: java.lang.NullPointerException at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionLoadingFromUrl(PersistenceUnitLoadingException.java:100) at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:597) at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:481) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:172) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:154) at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:135) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at javax.persistence.Persistence$createEntityManagerFactory.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at com.…
favorite count: 0
has comment: http://stackoverflow.com/comment/36997714
type: UnansweredQuestion
has title: How to load persistence unit from other jars?
score: 2
has comment: http://stackoverflow.com/comment/36952797

http://stackoverflow.com/q/23990299
type: AnsweredQuestion
has body: I am trying to make a simple Android app to send strings over WiFi to a microcontroller that will later on be used as commands to turn an led on and off. Below is the code that I have and I am having issues with understanding why it doesn't work. Basically an exception is thrown and the "connection failed" toast is envoked. String hostname = "192.168.50.1"; int port = 5001; PrintWriter out = null; //access_point.connect(new InetSocketAddress(hostname, port)); public void command() throws Exception { try{ Socket access_point = new Socket(hostname,port); out = new PrintWriter(access_point.getOutputStream(), true); out.println("Turn on"); Toast.makeText(getBaseContext(), "Connection successful", Toast.LENGTH_LONG).show(); // BufferedReader in = new BufferedReader(new InputStreamReader(access_point.getInputStream())); } catch(Exception e){ Toast.makeText(getBaseContext(), "Connection failed", Toast.LENGTH_LONG).show(); } } ToggleButton tbutton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fullscreen); // code for toggle button tbutton = (ToggleButton) findViewById(R.id.toggleButton1); tbutton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(((ToggleButton)v).isChecked()) { try{ command(); Toast.makeText(getBaseContext(), "Communication ON string sent", Toast.LENGTH_SHORT).show(); } catch(Exception e) { Toast.makeText(getBaseContext(), "Communication failed", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(getBaseContext(), "Communication OFF string sent", Toast.LENGTH_LONG).show(); } } }); } }
has title: Android socket programing
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/23990678
accepted answer: http://stackoverflow.com/a/23990678
score: 0
downvote count: 2
tagged with: android
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36968253
tagged with: sockets
linked to: http://stackoverflow.com/q/13681189

http://stackoverflow.com/q/24062665
favorite count: 0
has body: If I have a Spring bean that contains another non Spring bean like so : @Component class SpringBean { private MyBean mb = new MyBean(); } I receive error : unable to wire bean MyBean But if I declare the Bean within a method : @Component class SpringBean { private void myMethod(){ MyBean mb = new MyBean(); } } Then the bean is initialized correctly when the bean is called. So does Spring not allow non Spring beans to be created by Spring beans ? What is the reasoning behind this?
accepted answer: http://stackoverflow.com/a/24062755
has title: If one bean is managed by Spring does this mean all created beans also have to be managed
has comment: http://stackoverflow.com/comment/37103652
tagged with: spring
type: AnsweredQuestion
upvote count: 2
downvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24062755
answer count: 1
has comment: http://stackoverflow.com/comment/37103580

http://stackoverflow.com/q/24090264
accepted answer: http://stackoverflow.com/a/24090632
tagged with: regex
answer count: 4
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24090427
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/24090427
type: Question
has answer: http://stackoverflow.com/a/24090365
tagged with: split
has answer: http://stackoverflow.com/a/24090459
has answer: http://stackoverflow.com/a/24090632
has body: I have requirement to split a string based on Regular expression which will be of the below format. There are 3 different type of String values - ABC_1234_XL.jpg XYZ_7890_SM.jpg PQ_R_4567_LG.jpg The regex that I have right now which isn't working is - (^[a-zA-Z])(_\\d+_)([a-zA-Z]$) in the above ABC, XYZ and PQ_R are 3 types of image types which I want to extract separately and compare it with respective list of corresponding Types fetched from DB. So in case if I go with normal split by underscore "_", then it flunks the purpose while splitting the 3rd string. So I need a solution to split these string based on Regular expression, where every time the center element will [0-9] and the left would be Image Type and the right would be Image Size. Meaning - ImageType_ImageTypeID_ImageSize. We need to split this having the center element (imageTypeID) as base and get the left &amp; right date by excluding the "_". How to achieve this with Split along with Regex? Help please and let me know in case if you need more info.
downvote count: 0
has title: split into different Strings based on regex in java
favorite count: 0

http://stackoverflow.com/a/23964692
score: -1
has body: Perhaps this example of code will do what you need, using three classes Test - the main test code Stock - the implied code for Stock from your question StockCheck - the corrected code from your question. (Note: you may really want to use an ArrayList inside StockQuote so you can add and delete Stocks.) Test class package stackJavaExample; public class Test { public static void main(String[] args) { String[] testNames = {"test1","test2","notThere"}; StockCheck mStockCheck = new StockCheck(); for (int i=0; i&lt;testNames.length; i++) { Stock result = mStockCheck.getStock(testNames[i]); if (result == null) { System.out.println("No stock for name: " + testNames[i]); } else { System.out.println("Found stock: " + result.getName() + ", " + result.getSymbol() + ", " + result.getValue()); } } } } Stock class package stackJavaExample; public class Stock { private String symbol; private String name; private double value; public Stock(String symbol, String name, double value) { this.symbol = symbol; this.name = name; this.value = value; } public String getSymbol() { return symbol;} public String getName() { return name;} public double getValue() {return value;} } StockCheck class package stackJavaExample; public class StockCheck { private Stock[] d; public StockCheck() { d = new Stock[2]; d[0] = new Stock("a","test1", 22); d[1] = new Stock("b","test2", 34); } public Stock getStock(String name) { for (int i=0; i &lt; d.length; i++) { if (d[i].getName().equalsIgnoreCase(name)) { return d[i]; } } return null; } }
upvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23964475
accepted answer of: http://stackoverflow.com/q/23964475
downvote count: 1

http://stackoverflow.com/q/23945427
tagged with: java
tagged with: sqlexception
has answer: http://stackoverflow.com/a/23945722
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36885081
favorite count: 0
score: 0
tagged with: oracle-database
has body: I've made certain jtextfield, jRadioButtons, and some text areas. I want them to insert to data entered in these SQL Database. I've made the following code: Connection conn = null; //Statement stm = null; PreparedStatement pst = null; ResultSet rs = null; try{ Class.forName("oracle.jdbc.OracleDriver"); System.out.println("Driver Loaded."); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "hr", "hr"); System.out.println("Driver Connected."); pst=conn.prepareStatement("insert into directorsdb (DIRECTOR_NAME, DOB, DIN, PAN, UIN, BIRTH_PLACE, PASSPORT, DRIVING_LIC, NATIONALITY, OCCUPATION, OCCUPATION_COMPANY, DESIGNATION, QUALIFICATION, ADDRESS_OFF, ADDRESS_RESI, CONTACT_HOME, CONTACT_WORK, CONTACT_MOBILE, EMAIL_PERSONAL, EMAIL_WORK, EMAIL_OTHER, SECRETARY_NAME, SECRETARY_CONTACT, SECRETARY_EMAIL, DSC, DSC_EXPIRY, FATHER_NAME, MOTHER_NAME, APPOINTMENT_DATE, POSITION_BOARD, CESSATION_DATE, CESSATION_REASON, PROMOTER, INDEPENDENT_DIRECTOR, ABOUT)" + "values("+jFormattedTextField1.getText()+"','"+jDateChooser1.getDate()+"','"+DIN.getText()+"','"+PAN.getText()+"','"+UIN.getText()+"','"+jFormattedTextField4.getText()+"','"+passportno.getText()+"','"+dlicense.getText()+"','"+jFormattedTextField5.getText()+"','"+jFormattedTextField6.getText()+"','"+jFormattedTextField7.getText()+"','"+jFormattedTextField8.getText()+"','"+jFormattedTextField9.getText()+"','"+officeadd.getText()+"','"+residentialadd.getText()+"','"+jFormattedTextField12.getText()+"','"+jFormattedTextField13.getText()+"','"+jFormattedTextField14.getText()+"','"+jFormattedTextField15.getText()+"','"+jFormattedTextField16.getText()+"','"+jFormattedTextField17.getText()+"','"+jFormattedTextField18.getText()+"','"+jFormattedTextField19.getText()+"','"+jFormattedTextField20.getText()+"','"+buttonGroup1.getSelection().getActionCommand()+"','"+jDateChooser2.getDate()+"','"+jFormattedTextField22.getText()+"','"+jFormattedTextField23.getText()+"','"+jDateChooser3.getDate()+"','"+jFormattedTextFi…
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36884949
has title: SQLException: Missing IN or OUT parameter at index:: 1

http://stackoverflow.com/comment/36957998
score: 0
type: Comment
has text: thanks for the explanation, I didn't undestand well at beginning, but then I realized that was a recursivity problem at main() method. Thanks a lot for the help :)
type: AnswerComment
comment on: http://stackoverflow.com/a/23975252

http://stackoverflow.com/comment/72003439
comment on: http://stackoverflow.com/a/27769038
type: AnswerComment
has text: @gce : Can you please give the full mvn command you used to make it work? Please include all goals run. Are you using all 4 goals of which you have in your pom.xml?
score: 0
type: Comment

http://stackoverflow.com/q/24009683
tagged with: io
tagged with: spring
has title: write string to pdf file
tagged with: java
downvote count: 2
tagged with: stream
linked to: http://stackoverflow.com/q/312230
type: Question
score: -2
has comment: http://stackoverflow.com/comment/37006182
has comment: http://stackoverflow.com/comment/37006414
has comment: http://stackoverflow.com/comment/37005203
upvote count: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24010389
has body: I need to write a String object "plain text" to a pdf file from a java program, does java or spring have any built-in libraries that can do the job.if not what are the best choice external libraries? I know I can use FileOutputStream to write data to a file but is there any option that can format the data in pdf and write it to the file, like .setContentType("application/pdf") of the HttpServletResponse thanks in advance

http://stackoverflow.com/q/24077703
tagged with: rest
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
score: 1
tagged with: java
type: Question
has title: RESTEasy+JUnit : Is it possible to test the web services in the same WAR?
tagged with: junit
has body: Is it possible in a JUnit test method to : Deploy REST web services Run a client call from the Junit in the same war project? My applicantion architecture is like this : /main/java/here/the/package/to/the/services /test/java/here/the/package/to/the/junit/methods/using/client Thank you a lot!
downvote count: 0
answer count: 1
tagged with: deployment
favorite count: 0
has answer: http://stackoverflow.com/a/24118501

http://stackoverflow.com/comment/37001638
has text: May I know why Ehcache/terracotta failed the evaluation?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24007873

http://stackoverflow.com/q/24079862
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I have a program that, among other tasks, has to change the super class of some classes using JDT. I have two strings with the qualified name of the superclasses to swap, for example "org.example.John" and "org.example.Smith" and I'm parsing the whole AST searching for classes that extend these ones. My problem happens when I'm trying to find out the qualified name of the super class. I just can't find a way. Given an ICompilationUnit (representing a class), I use a an ASTVisitor to parse the TypeDeclaration, as the following method shows. public boolean visit(TypeDeclaration typeDeclaration) { TypeDeclaration[] types = typeDeclaration.getTypes(); superClass = typeDeclaration.getSuperclassType(); superClass.getNodeType(); Class nodeType = ASTNode.nodeClassForType(superClass.getNodeType()); if (newSuperClass != null) { Name oldName = typeDeclaration.getAST().newName(oldSuperClass); SimpleType oldType = typeDeclaration.getAST().newSimpleType(oldName); Name newName = typeDeclaration.getAST().newName(newSuperClass); SimpleType newType = typeDeclaration.getAST().newSimpleType(newName); if (superClass != null &amp;&amp; superClass.equals(oldType)) { typeDeclaration.setSuperclassType(newType); } } return true; } It it my understanding that Eclipse is capable of making the connection between the super class declaration (e.g. public class MySubClass extends John) and map it to the actual Type defined in the imports (e.g. import org.example.John). I'm looking for a way to do the same as Eclipse does. Possible alternative solutions would be anything that would help me change the superclass of a class using JDT, given a plain text qualified name.
tagged with: java
tagged with: eclipse-jdt
tagged with: eclipse
type: Question
score: 2
has title: JDT - Trying to change superclass of Type. I don't know the Qualified Name of a Super Class
downvote count: 0

http://stackoverflow.com/comment/37137324
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24078847
score: 0
has text: Yes, exactly. As I said, you can't identify them. Unless you have some sort of login, you can't do what you ask for.

http://stackoverflow.com/comment/36896125
type: Comment
type: QuestionComment
has text: Can you please post a relevant snippet of the code you're running?
comment on: http://stackoverflow.com/q/23951145
score: 0

http://stackoverflow.com/comment/36926955
comment on: http://stackoverflow.com/q/23967861
score: 1
has text: You would really *really* be better off upgrading - it's worth putting significant effort into that. JDK 1.5 is over 10 years old now... how confident are you that there aren't security problems that haven't been patched on your machine?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24008283
has title: What is the difference between Android Private Libraries, Dependencies and the libs folder?
possible better answer: http://stackoverflow.com/a/24008552
favorite count: 0
linked to: http://stackoverflow.com/q/22261288
upvote count: 10
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37002618
has answer: http://stackoverflow.com/a/24008552
tagged with: eclipse
type: Question
score: 9
has answer: http://stackoverflow.com/a/24008581
accepted answer: http://stackoverflow.com/a/24008581
has comment: http://stackoverflow.com/comment/37002688
has comment: http://stackoverflow.com/comment/37002479
answer count: 2
has body: I am new to Android Programming. I am using Eclipse as the IDE for development. I have started a new project and some jar files were automatically added to the project. Could you explain what each of these jar files mean? Android 4.4.2 android.jar Android Private Libraries android-support-v7-appcompat.jar android-support-v4.jar Android Dependencies appcompat_v7_2.jar libs android-support-v4.jar Also, apart from these, there is a folder generated named "appcompat_v7_2" which can be seen in the Project Explorer. It also contains Android Private Libraries and libs folder. I feel that there is some sort of redundancy involved here. Do clear the confusion.
downvote count: 1

http://stackoverflow.com/a/24040856
has comment: http://stackoverflow.com/comment/37063276
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37063407
has comment: http://stackoverflow.com/comment/37063214
type: Answer
has body: In the context of class declaration, and according to the JLS #8.1.1, these are all class modifiers. And if you read a bit further you will see that only public, private and protected are access modifiers (which makes sense: they determine whether the class is accessible or not from other parts of the code). So yes, technically, abstract and final are not access modifiers and the error message could be more precise. Note that javac (Java 8) error message is: illegal combination of modifiers: abstract and final
upvote count: 3
has comment: http://stackoverflow.com/comment/37063682
answers question: http://stackoverflow.com/q/24040700
has comment: http://stackoverflow.com/comment/37063871
score: 3
accepted answer of: http://stackoverflow.com/q/24040700
has comment: http://stackoverflow.com/comment/37063493

http://stackoverflow.com/comment/37088738
comment on: http://stackoverflow.com/q/24054456
score: 0
type: Comment
type: QuestionComment
has text: try to use unions on your view `CF_VIEW_DAILY_STAT`

http://stackoverflow.com/comment/50254754
has text: Use @EnableAspectJAutoProxy(proxyTargetClass = true)
score: 1
comment on: http://stackoverflow.com/a/25139480
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24077524
has answer: http://stackoverflow.com/a/24078590
possible better answer: http://stackoverflow.com/a/54450536
downvote count: 0
tagged with: runtime
has comment: http://stackoverflow.com/comment/37131245
tagged with: javafx-8
has body: I have a program which loads many fxml files when executed. The application will be finished in a short time, and loading the application just takes too long. There are many fxml files (20+) and all these fxml files are loaded with Java code. There will be a point that the application is finished and ready for use, but all files will be loaded with every execution of the program. Can the fxml files only be compiled once, because they won't be changed when finished? The java code will of course be compiled once, it's only the fxml files. The application now takes 25 seconds to start, with 14 seconds loading the fxml. Is there a way to make all this faster? EDIT #1: Are there any tools that are provided for free and that make the execution of applications (Java) much faster? Or is the execution time merely dependent on the way the program is written? Which design patterns could help fastening up the execution time of your application? EDIT #2: The following code will explain my problem in a nutshell: package main; ....... ....... public class MainClass { .... .... List&lt;InformationController&gt; controllerList; public mainClass(List&lt;InformationControllers&gt; controllerList) { this.controllerList = otherClass.getControllerList(); loadFXMLFiles(); } public void loadFXMLFiles() { for(InformationController controller : controllerList) { controller.loadFXML(); } doOtherStuff(); } .... } All those InformationControllers have their loading of other fxml files too, so it's actually a tree of fxml files that is loaded. This is loaded at every start of the application, so is there a way to do this loading only once maybe?
favorite count: 0
has title: Is there a way to compile / load fxml files faster and only one time, and not at every restart of an application?
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/37131114
accepted answer: http://stackoverflow.com/a/24078590
has comment: http://stackoverflow.com/comment/37131200
type: AnsweredQuestion
tagged with: java
tagged with: javafx
score: 10
has answer: http://stackoverflow.com/a/54450536
upvote count: 10
linked to: http://stackoverflow.com/q/14972199
type: Question
linked to: http://stackoverflow.com/q/435553
answer count: 2

http://stackoverflow.com/a/24021378
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24021329
answers question: http://stackoverflow.com/q/24021329
type: Answer
has body: A Set will not allow more than one element that compares equal. Your use of TreeSet will have it relying on calling compareTo. [A] TreeSet instance performs all element comparisons using its compareTo (or compare) method You do have compareTo defined in Circle. However, your compareTo method is always returning 0, so all your Circle objects will compare equal to each other, and only one will make it in to your TreeSet. You will need to properly define your compareTo method. In addition, you may want to use the generics on the TreeSet class and implementing the generic form of Comparable in Circle, e.g.: Set&lt;Circle&gt; circles; and circles = new TreeSet&lt;Circle&gt;(); Then in Circle: public class Circle implements Comparable&lt;Circle&gt; { and @Override public int compareTo(Circle t) { // Return -1, 0, or 1 if this object &lt;, equal, or &gt; than "t" }
score: 1

http://stackoverflow.com/comment/37090417
has text: yes, it is a swing application in java
comment on: http://stackoverflow.com/q/24055502
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37093199
type: Comment
has text: By page I meant a JFrame. I did initialize the fields. They arent editable anymore
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24056600

http://stackoverflow.com/comment/36980924
has text: @ibrahimyilmaz, read the Javadoc for AnnotationUtils.findAnnotation.
type: Comment
comment on: http://stackoverflow.com/a/23994529
score: 1
type: AnswerComment

http://stackoverflow.com/a/24003216
accepted answer of: http://stackoverflow.com/q/24003061
has body: The quick fix is to reference the CardLayout and content pane directly. Viz. public void actionPerformed(ActionEvent evt) { if(panel) { //CardLayout pane = (CardLayout)this.getLayout(); cc.last(this.getContentPane()); panel = false; } else { //CardLayout pane = (CardLayout)this.getLayout(); cc.first(this.getContentPane()); panel = true; } //repaint(); not necessary either.. } A better fix is to design the GUI in a JPanel (and use the CardLayout in that), and to simply create an instance of JFrame in which to show the panel (instead of extending frame).
answers question: http://stackoverflow.com/q/24003061
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/24066867
has title: How to start a count in java from bottom-left corner?
answer count: 1
tagged with: arrays
downvote count: 0
tagged with: grib
tagged with: counting
has answer: http://stackoverflow.com/a/24066905
favorite count: 0
has body: I know in java the top-left is considered the (0,0) coordinate. I am trying to count the pixel of a file. The file pixel's (0,0) coordinate, starts in the bottom-left corner. The total overall area of the screen is 1121x881. I need to count the pixels in order so that the data matches up with the coordinates. The area I want out of the 1121x881 is 543x451. Can anyone help me do this?
upvote count: 1
accepted answer: http://stackoverflow.com/a/24066905
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37111779
has comment: http://stackoverflow.com/comment/37112908
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37111605
type: Question

akka
type: Tag
tags question: http://stackoverflow.com/q/24013627
tags question: http://stackoverflow.com/q/23945464
tag name: akka

http://stackoverflow.com/comment/37067745
has text: How to decide which is the primary language for the repository, or there is not a way?
type: AnswerComment
comment on: http://stackoverflow.com/a/24029900
score: 0
type: Comment

http://stackoverflow.com/q/23949293
tagged with: encoding
has comment: http://stackoverflow.com/comment/36892539
has comment: http://stackoverflow.com/comment/36892314
tagged with: ascii
score: 0
has title: Convert text to Unicode/UTF-8
favorite count: 0
has comment: http://stackoverflow.com/comment/36893313
tagged with: decoding
type: UnansweredQuestion
tagged with: utf-8
has comment: http://stackoverflow.com/comment/36899884
answer count: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I have a text - "¸ÁévÀAvÀæöå ºÉÆÃgÁlzÀ°è «zÁåyðUÀ¼ÀÆ ¥Á¯ÉÆÎArzÀÝgÀÄ.", which I copied from a web page which had UTF-8 encoding. There is this website ASCII2UNICODE in which I copy-paste the text above and after converting I get - "ಸ್ವಾತಂತ್ರ್ಯ ಹೋರಾಟದಲ್ಲಿ ವಿದ್ಯಾರ್ಥಿಗಳೂ ಪಾಲ್ಗೊಂಡಿದ್ದರು." which is perfectly correct. How can I do this in Java? I have tried : System.out.println(new String("¸ÁévÀAvÀæöå ºÉÆÃgÁlzÀ°è «zÁåyðUÀ¼ÀÆ ¥Á¯ÉÆÎArzÀÝgÀÄ.".getBytes("ASCII"), "UTF-8")); System.out.println(new String("¸ÁévÀAvÀæöå ºÉÆÃgÁlzÀ°è «zÁåyðUÀ¼ÀÆ ¥Á¯ÉÆÎArzÀÝgÀÄ.".getBytes("UTF-8"), "ASCII")); Now I am really not sure whether the source text is ASCII or UTF-8.

http://stackoverflow.com/q/24102055
upvote count: 1
type: Question
has title: Passing ArrayList to Ruby as a RubyArray
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24117576
downvote count: 0
answer count: 1
favorite count: 0
has body: In Ruby, if you do something like print ["Hello", 1, 2] You get an output like ["Hello" , 1 , 2] Have some ArrayList object, list in Java. It contains objects of type Object. I am passing this list to my Ruby code. When you print this, the console outputs something like &lt;Java::JavaUtil::ArrayList:0x5ab077a7&gt; Which is correct, of course. However, I would like to get the same behaviour as above. If list contains two objects of type Object, when Ruby pints it, I want to get [Object:0x1234567 , Object:0x21432423] Rather than the reference of the list itself. I suspect I should convert list to RubyArray before passing it to Ruby. But how?
tagged with: jruby
type: UnansweredQuestion

http://stackoverflow.com/q/24027249
type: Question
tagged with: payload
has body: I've sent a device a configuration profile with an SCEP payload. When the device downloads this config profile, it is supposed to connect to my Java SCEP server and write a CSR to its OutputStream in PKCS10 form. However, when I print the contents of the stream, I get a bunch of garbled nonsense; I know that the request should start with -----BEGIN CERTIFICATE REQUEST----- and end with -----END CERTIFICATE REQUEST-----, but this is not the case. Here is the SCEP payload: PayloadContent Key Type RSA Key Usage 0 Keysize 1024 Name CA-SCEP Subject <array/> URL https://myserver.example.com PayloadDescription Configures SCEP PayloadDisplayName SCEP (CA-SCEP) PayloadIdentifier com.Example.rdesirazu.SCEP PayloadOrganization Example PayloadType com.apple.security.scep PayloadUUID 5C125B3C-4427-49CE-980B-21FC1254D506 PayloadVersion 1
answer count: 1
has answer: http://stackoverflow.com/a/29342707
type: UnansweredQuestion
tagged with: csr
tagged with: profile
score: 0
tagged with: java
tagged with: certificate
has title: SCEP Payload Not working

http://stackoverflow.com/comment/37025976
has text: Your inner loops condition for filling the array, differs from the condition outputting the array. This means your never filling `background[][19]`. But you are outputting it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24020896
type: Comment

http://stackoverflow.com/q/24033818
has comment: http://stackoverflow.com/comment/37050152
has answer: http://stackoverflow.com/a/24034063
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24034361
downvote count: 0
tagged with: desktop-application
possible better answer: http://stackoverflow.com/a/24033947
has answer: http://stackoverflow.com/a/24033947
favorite count: 0
answer count: 3
linked to: http://stackoverflow.com/q/29426
has body: I've an the Eclipse IDE with android sdk as I am an android developer. I want to develop a simple java desktop application consists of splash screen and a login screen which is connect to MS SQL through JDBC. Now, how will I enable my Eclipse to let me develop java desktop applications. or shall I use net beans. I have also downloaded the netbeans 8.0 but it not showing me the java desktop application. Also, I have installed and unzip the JDBC driver,there are 2 jar files sqlJDBC and sqlJDBC4. Please kindly tell me which jar file shall i use.
has title: setting your IDE(eclipse) for java desktop application
accepted answer: http://stackoverflow.com/a/24034361
has comment: http://stackoverflow.com/comment/37050853
has comment: http://stackoverflow.com/comment/37049975
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/23979257
tagged with: android
has body: I am changing x coordinate every time when when render method is called.Is it working faster on 4 core than on 1 core ? I have tested it on Alcatel Snap (4 core 1.2Ghz) and Xperia X 10 (1 core) .And does it mean that on 1 core fps is smaller than on 4 core?
type: AnsweredQuestion
tagged with: libgdx
tagged with: java
has title: Android LibGDX Mobile cores
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23980985
linked to: http://stackoverflow.com/q/23995854
score: 0
accepted answer: http://stackoverflow.com/a/23980985

hibernate
tags question: http://stackoverflow.com/q/24047242
tags question: http://stackoverflow.com/q/23973872
tags question: http://stackoverflow.com/q/23954979
tags question: http://stackoverflow.com/q/24061656
tags question: http://stackoverflow.com/q/24073906
tags question: http://stackoverflow.com/q/23978446
tags question: http://stackoverflow.com/q/24005100
tags question: http://stackoverflow.com/q/24002870
tags question: http://stackoverflow.com/q/24012311
tags question: http://stackoverflow.com/q/23992949
tags question: http://stackoverflow.com/q/24095348
tags question: http://stackoverflow.com/q/24073182
tags question: http://stackoverflow.com/q/24011607
tags question: http://stackoverflow.com/q/23977909
tags question: http://stackoverflow.com/q/23947701
tags question: http://stackoverflow.com/q/23999709
tags question: http://stackoverflow.com/q/23978628
tags question: http://stackoverflow.com/q/24034404
tags question: http://stackoverflow.com/q/24083727
tags question: http://stackoverflow.com/q/24093383
tags question: http://stackoverflow.com/q/23943845
tags question: http://stackoverflow.com/q/24019427
tags question: http://stackoverflow.com/q/23954790
tags question: http://stackoverflow.com/q/23951932
tags question: http://stackoverflow.com/q/23951796
tags question: http://stackoverflow.com/q/24034490
tags question: http://stackoverflow.com/q/24070183
tags question: http://stackoverflow.com/q/23998507
tags question: http://stackoverflow.com/q/24064635
tags question: http://stackoverflow.com/q/24078153
tags question: http://stackoverflow.com/q/24078508
tags question: http://stackoverflow.com/q/24017963
tags question: http://stackoverflow.com/q/24023655
tags question: http://stackoverflow.com/q/24058371
tags question: http://stackoverflow.com/q/24055594
tags question: http://stackoverflow.com/q/23967486
tags question: http://stackoverflow.com/q/24044130
tags question: http://stackoverflow.com/q/24089645
tags question: http://stackoverflow.com/q/24058144
tags question: http://stackoverflow.com/q/24030550
tags question: http://stackoverflow.com/q/24101556
tags question: http://stackoverflow.com/q/23947860
tags question: http://stackoverflow.com/q/24078369
tags question: http://stackoverflow.com/q/24002105
tags question: http://stackoverflow.com/q/24065817
tag name: hibernate
tags question: http://stackoverflow.com/q/24011759
tags question: http://stackoverflow.com/q/24068171
tags question: http://stackoverflow.com/q/24016319
tags question: http://stackoverflow.com/q/24082890
tags question: http://stackoverflow.com/q/23983455
tags question: http://stackoverflow.com/q/23979135
tags question: http://stackoverflow.com/q/24060782
tags question: http://stackoverflow.com/q/23980058
tags question: http://stackoverflow.com/q/24072867
tags question: http://stackoverflow.com/q/24065284
tags question: http://stackoverflow.com/q/24034750
tags question: http://stackoverflow.com/q/24103497
tags question: http://stackoverflow.com/q/24059138
tags question: http://stackoverflow.com/q/24034015
tags question: http://stackoverflow.com/q/24061849
tags question: http://stackoverflow.com/q/24053894
tags question: http://stackoverflow.com/q/24060498
tags question: http://stackoverflow.com/q/24038665
tags question: http://stackoverflow.com/q/24087605
tags question: http://stackoverflow.com/q/24036224
tags question: http://stackoverflow.com/q/23966161
tags question: http://stackoverflow.com/q/23965584
tags question: http://stackoverflow.com/q/24055158
tags question: http://stackoverflow.com/q/23974128
tags question: http://stackoverflow.com/q/23994515
tags question: http://stackoverflow.com/q/24020326
tags question: http://stackoverflow.com/q/24065524
tags question: http://stackoverflow.com/q/24090273
tags question: http://stackoverflow.com/q/24038072
tags question: http://stackoverflow.com/q/23976763
tags question: http://stackoverflow.com/q/24040208
tags question: http://stackoverflow.com/q/24021606
tags question: http://stackoverflow.com/q/23996149
tags question: http://stackoverflow.com/q/23952011

http://stackoverflow.com/a/24101055
answers question: http://stackoverflow.com/q/24099921
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37176174
has comment: http://stackoverflow.com/comment/37175700
score: 1
accepted answer of: http://stackoverflow.com/q/24099921
has comment: http://stackoverflow.com/comment/37176230
has body: Not sure, but you should try with another Reader to specify another charset. Charset charset = Charset.forName("UTF-8"); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset)); textarea.read( reader , null );
has comment: http://stackoverflow.com/comment/37178496
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37178200

http://stackoverflow.com/q/23995981
tagged with: java
answer count: 2
tagged with: tableview
score: 2
downvote count: 0
has body: I am currently developing a JavaFX Application with FXML that includes a TableView. I could not figure out how to use StringConverter&lt;T&gt; in the TextFieldTableCell&lt;S,T&gt;. I've done some code so far. It returns an Exception when texfield value saving to the cell; This is my source... @FXML private TableColumn&lt;Customer, Integer&gt; columnID; columnID.setCellFactory( new Callback&lt;TableColumn&lt;Customer, Integer&gt;, TableCell&lt;Customer, Integer&gt;&gt;() { StringConverter&lt;Integer&gt; converter; @Override public TableCell&lt;Customer, Integer&gt; call(TableColumn&lt;Customer, Integer&gt; list) { return new TextFieldTableCell&lt;&gt;(converter); } } ); And it returns this Exception... Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Attempting to convert text input into Object, but provided StringConverter is null. Be sure to set a StringConverter in your cell factory. at javafx.scene.control.cell.CellUtils$4.handle(CellUtils.java:247) at javafx.scene.control.cell.CellUtils$4.handle(CellUtils.java:243) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImp…
has answer: http://stackoverflow.com/a/57929612
has title: JavaFX: TableView couldn't edit with FXML
has answer: http://stackoverflow.com/a/23996628
tagged with: javafx-8
tagged with: tablecelleditor
favorite count: 0
tagged with: fxml
upvote count: 2
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/36901158
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23954296
has text: Yes Peter..u r right. The code was developed 10 years ago only. We are just doing some enhancements.

http://stackoverflow.com/comment/36911256
score: 0
comment on: http://stackoverflow.com/q/23959505
type: Comment
type: QuestionComment
has text: how can i do that peeskillet?

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/24103281
tags question: http://stackoverflow.com/q/23986348
type: Tag
tags question: http://stackoverflow.com/q/24021430
tags question: http://stackoverflow.com/q/24070444
tags question: http://stackoverflow.com/q/24086529
tags question: http://stackoverflow.com/q/24025302
tags question: http://stackoverflow.com/q/24101928

http://stackoverflow.com/q/24053526
upvote count: 1
accepted answer: http://stackoverflow.com/a/24054259
type: Question
has body: I'm using Java EE 7 with JPA (Eclipselink). I have a simple database: A membership, a person and a persongroup. A Persongroup has memberships. A Membership has a person and a persongroup. My code to add a membership to a persongroup: Membership membership = new Membership(); membership.setPerson(person); membership.setPersonGroup(personGroup); personGroup.getMemberships().add(membership); membershipSession.persist(membership); This snippet works. It is creating the Membership with the person and the persongroup. But on reading the personGroup after that, the personGroup contains not the new membership. After redeploying or something similar, the persongroup has the new membership. The persist process is successful. Only something in JPA cache is going wrong. With Membership membership = new Membership(); membership.setPerson(person); membership.setPersonGroup(personGroup); personGroup.getMemberships().add(membership); membershipSession.persist(membership); personGroupSession.merge(personGroup); it works. My hope is to reduce the personGroupSession.merge(personGroup); or understanding, why I need this line. This is my relationship mapping (reduced for the case) @Entity public class PersonGroup { @OneToMany(cascade = CascadeType.ALL, mappedBy = "personGroup") private List&lt;Membership&gt; memberships = new ArrayList&lt;&gt;(); } @Entity public class Membership { @ManyToOne @JoinColumn private Person person; @ManyToOne @JoinColumn private PersonGroup personGroup; } @Entity public class Person { @OneToMany(cascade = CascadeType.ALL, mappedBy = "person") private List&lt;Membership&gt; memberships = new ArrayList&lt;&gt;(); }
has comment: http://stackoverflow.com/comment/37086677
has title: Best practise for JPA merge and create
tagged with: eclipselink
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24054259
has comment: http://stackoverflow.com/comment/37086756
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/36955454
score: 0
type: Comment
type: QuestionComment
has text: how "large" is the amount? why you have to store them in source codes?
comment on: http://stackoverflow.com/q/23983285

http://stackoverflow.com/comment/36949562
score: 0
type: Comment
has text: So usefull links aswell. Thank you again.
type: AnswerComment
comment on: http://stackoverflow.com/a/23974063

http://stackoverflow.com/q/23986088
has answer: http://stackoverflow.com/a/23986153
has comment: http://stackoverflow.com/comment/36960828
has comment: http://stackoverflow.com/comment/36960964
has answer: http://stackoverflow.com/a/23986152
has title: Java Code - Comparing last 4 letters
type: AnsweredQuestion
score: 1
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/23986113
downvote count: 2
has answer: http://stackoverflow.com/a/23986113
has answer: http://stackoverflow.com/a/23986173
has answer: http://stackoverflow.com/a/23986239
accepted answer: http://stackoverflow.com/a/23986153
type: Question
has comment: http://stackoverflow.com/comment/36960880
answer count: 6
has body: Implement a method that returns true if the final four character substrings of s1 and s2 are equal. If the length of either string is less than 4, the method should return false. You may use the method s.substring(n, m) that yields the substring of s beginning at index n and ending at index m-1. As an answer I delivered following code, I was just wondering whether I did it in a correct way: public static boolean compareLast4 (String s1, String s2) { s1len = s1.length; s2len = s2.length; if (s1lan &lt; 4 || s2len &lt; 4) return false; for (int i = 0; i &lt; s1len; i++) if (s1.substring() - 4.equals(s2.length() - 4)) return true; return false; }
has comment: http://stackoverflow.com/comment/36960861
has comment: http://stackoverflow.com/comment/36960833
has answer: http://stackoverflow.com/a/23986406
favorite count: 0

http://stackoverflow.com/a/24074843
score: 0
has body: Get the text box content and store it in public static variable, then u can access that variable in table viewer : public static String txtContents; txtContents = txt.getText(); Get the row index by adding this in your button listener: String rowIdx = event.widget.getData(----); parse it to integer and remove the selected row from table by : table.remove(int rowIdx);
type: Answer
answers question: http://stackoverflow.com/q/24074365

http://stackoverflow.com/a/24035143
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24035068
has body: You're assigning a new instance of Wrapper to the reference of the argument in your changeWrapper method and returning it. As such, the w of your returned Wrapper is 19. This doesn't change the passed object, only the reference within method's scope, and of course, the returned object. However, you are assigning that returned Wrapper instance with w == 19 to the w local variable of your main method. Remove w = new Wrapper(); from changeWrapper. To recap (scope within main method) Line 3 doesn't do anything to w Line 6 changes w.w to 19
type: Answer

http://stackoverflow.com/comment/36923519
type: Comment
has text: THANK YOU SO MUCH!! :) As always it's one of those small things! I can get back to finishing the rest of my assignment now. Thanks again!
comment on: http://stackoverflow.com/a/23965771
score: 0
type: AnswerComment

http://stackoverflow.com/q/23961173
has answer: http://stackoverflow.com/a/23961213
has comment: http://stackoverflow.com/comment/36914407
score: 0
has answer: http://stackoverflow.com/a/23961210
answer count: 2
favorite count: 0
has body: Just for curiosity, why when working with java threads it is like a standard to use Thread.sleep(100) ? Why not another value instead of 100?
has comment: http://stackoverflow.com/comment/36914436
upvote count: 2
possible better answer: http://stackoverflow.com/a/23961213
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36914943
has comment: http://stackoverflow.com/comment/36914429
tagged with: java
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/23961210
has comment: http://stackoverflow.com/comment/36914431
has title: Java thread.sleep standard curiosity

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/24029867

http://stackoverflow.com/q/23957898
upvote count: 1
linked to: http://stackoverflow.com/q/10446986
accepted answer: http://stackoverflow.com/a/24023926
type: Question
has comment: http://stackoverflow.com/comment/36908903
downvote count: 0
tagged with: ubuntu
answer count: 1
tagged with: executable-jar
has body: I have some Java (swing) code that makes a call to Runtime.getRuntime().exec(). The program runs perfectly well if I run it from the command line. The problem is, when I'm not running from command line, the application isn't making the call to Runtime.getRuntime().exec(), so I can't execute the system commands that I want. When I double click the jar file, the GUI pops up, and everything works perfectly, except for the system call. Here is a similar thread about a program outputting to console after double-clicking an executable jar, but it isn't quite what I'm looking for: Double Clicking JAR file does not open Command Prompt Any ideas on how to get this to work? Any help is greatly appreciated! I'm running Ubuntu on a VM, and I also eventually want to port this to Mac OS.
has comment: http://stackoverflow.com/comment/36913071
favorite count: 0
has answer: http://stackoverflow.com/a/24023926
linked to: http://stackoverflow.com/q/588634
has comment: http://stackoverflow.com/comment/36908672
has title: Runtime.getRuntime().exec() not working when double-clicking executable jar
has comment: http://stackoverflow.com/comment/36984358
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36909504
score: 1
tagged with: java

http://stackoverflow.com/a/56289986
has comment: http://stackoverflow.com/comment/137654765
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/137640429
score: 1
has comment: http://stackoverflow.com/comment/137641482
has comment: http://stackoverflow.com/comment/100344397
answers question: http://stackoverflow.com/q/24010109
has body: the simplest solution is using List::listIterator and Stream::generate List&lt;Integer&gt; list = Arrays.asList(1, 2, 3, 4, 5); ListIterator&lt;Integer&gt; listIterator = list.listIterator(list.size()); Stream.generate(listIterator::previous) .limit(list.size()) .forEach(System.out::println);
has comment: http://stackoverflow.com/comment/137509453
upvote count: 1

http://stackoverflow.com/q/23960028
has comment: http://stackoverflow.com/comment/36912072
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23960250
upvote count: 3
has answer: http://stackoverflow.com/a/23960218
tagged with: java
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/23960280
score: -2
downvote count: 5
answer count: 3
has title: How to organize text files in Java
has body: So i have an assignment in which i have to create several text files, and be able to put these text files into categories. I only know how to create a text file to the default location in eclipse. I am unaware on how to create a text file to a certain location. Could someone perhaps lead me in the right direction on how to organize text files into specific folders?
favorite count: 0

http://stackoverflow.com/q/24039086
type: UnansweredQuestion
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37060691
has comment: http://stackoverflow.com/comment/37059617
has answer: http://stackoverflow.com/a/24039301
type: Question
tagged with: split
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/37060034
linked to: http://stackoverflow.com/q/1732348
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has title: Java - HTML code: extract part of the tag
favorite count: 0
has answer: http://stackoverflow.com/a/24039327
has body: I have to extract some integers from a tag of a html code. For example if I have: &lt; tag blabla="title"&gt;&lt;a href="/test/tt123&gt; TEST 1 &lt; tag &gt; I did that removing all the chars and leaving only the digits and it worked until in the title name there was another digit, so i got "1231". str.replaceAll("[^\\d.]", ""); How can I do to extract only the "123" integer?? Thanks for your help!
has answer: http://stackoverflow.com/a/24039548

http://stackoverflow.com/a/24039327
has body: You could do this (a method that removes all duplicates in any number): int[] foo = new int[str.length]; for(int i = 0; i &lt; str.length; i++) { foo[i] = Integer.parseInt(str.charAt(i)); } Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(); for(int i = 0; i &lt; foo.length; i++){ set.add(foo[i]); } Now you have a set where all duplicate numbers from any string are removed. I saw your last comment not. So this answer might not be very useful to you. What you could do is that the three first digits in the foo array as well, which will give you 123.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24039086

http://stackoverflow.com/a/24091939
accepted answer of: http://stackoverflow.com/q/24053944
type: Answer
score: 2
downvote count: 0
has body: It's Phidget, but not RFIDPhidget. There is no WaitForAttachment in the manager class because it is not necessary. The previous code works fine, but the wait time must be a little bit longer and the program won't terminate before something is attached. Manager manager; manager = new Manager(); try { manager.addAttachListener(new AttachListener() { public void attached(AttachEvent ae) { try { System.out.println("attached" + ((Phidget)ae.getSource()).getSerialNumber()); } catch (PhidgetException ex) { } } }); manager.open(); } catch (PhidgetException exception) { System.err.println(exception.getErrorNumber()+ exception.getDescription()); } // Allow the Phidgets time to attach Thread.sleep(1000);
upvote count: 2
answers question: http://stackoverflow.com/q/24053944
type: AcceptedAnswer

http://stackoverflow.com/a/23945610
has body: You need to read the Protocol chapter of the Object Serialization Specification. The stream is full of type and block markers in addition to the actual data. This is one of them, and it is filtered out by ObjectInputStream when the stream is read correctly. EDIT The extra bytes are 77 64, which means TC_BLOCK_DATA of size 0x64.
downvote count: 0
has comment: http://stackoverflow.com/comment/36885553
type: Answer
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23945586
has comment: http://stackoverflow.com/comment/36885397
score: 4
answers question: http://stackoverflow.com/q/23945586

http://stackoverflow.com/q/24029867
has comment: http://stackoverflow.com/comment/37042651
has body: I am trying to implement a Binary Tree class.Here's the insert method.When I compile it I get an error as "uses unchecked or unsafe operations.Recompile with -Xlint:unchecked for details". Can some on please tell me how I can correct this? public class BinaryNode{ Comparable element; BinaryNode left; BinaryNode right; BinaryNode(Comparable theElement,BinaryNode lt,BinaryNode rt){ element=theElement; left=lt; right=rt; } BinaryNode(Comparable theElement){ this(theElement,null,null); } } public class BinaryTr { private BinaryNode root; BinaryTr(){ root=null; } public void insert(Comparable x){ root=insert(root,x); } public BinaryNode insert(BinaryNode current,Comparable x){ if (current==null) current=new BinaryNode(x); else{ if(current.element.compareTo(x)&gt;0) current.left=insert(current.left,x); else if (current.element.compareTo(x)&lt;0) current.right=insert(current.right,x); else{ System.out.println("Duplicates not allowed"); } } return current; } public static void main (String args[]){ BinaryTr t=new BinaryTr(); t.insert(5); t.insert(4); t.insert(5); } }
tagged with: java
tagged with: comparable
has comment: http://stackoverflow.com/comment/37043171
type: Question
tagged with: data-structures
tagged with: binary-tree
has title: Binary Tree implementation using Comparable in Java
score: 0
has comment: http://stackoverflow.com/comment/37043198
has comment: http://stackoverflow.com/comment/37042885
has comment: http://stackoverflow.com/comment/37042941
has comment: http://stackoverflow.com/comment/37042659
linked to: http://stackoverflow.com/q/197986
answer count: 0
has comment: http://stackoverflow.com/comment/37042705
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/197986
has comment: http://stackoverflow.com/comment/37043478

http://stackoverflow.com/q/24088623
has body: I want to use maven to build projects in which there are unresolved compilation problems. The main purpose is package and deploy or run aplications using some kind of stubs for classes that contains compilation errors, like I understand that Eclipse does (thanks to JDT Core). I configurate maven java compiler plugin following Apache Maven documentation at Using Non-Javac compiler to use Eclipse compiler. Thinking that maybe should set some arguments to modify the compiler/builder behaivor I was reading Help Eclipse - Compiling Java code but I don't realize which compiler/builder option or combination of these does the trick. So far, the next configuration of the maven java compiler plugins compile using the eclipse compiler and package the application including generated .class (jvm bytecode) only for java classes without compilation errors. To get this behaivor it just require use the eclipse compiler (see compilerId and the dependency) and set failOnError=false. maven-compiler-plugin 3.1 eclipse 1.7 1.7 true true true false <org.eclipse.jdt.core.compiler.problem.fatalOptionalError>disabled</org.eclipse.jdt.core.compiler.problem.fatalOptionalError> <org.eclipse.jdt.core.compiler.problem.forbiddenReference>ignore</org.eclipse.jdt.core.compiler.problem.forbiddenReference> org.codehaus.plexus plexus-compiler-eclipse 2.3 With this configuration I could run java application as long as the execution doesn't use classes not included for compilation errors (because the stubs aren't generated) but on a Java EE container, the classloading will faild so the application can never be deployed. I appreciate any help on this.
type: Question
has title: Incremental java compile with maven (like Eclipse does)
accepted answer: http://stackoverflow.com/a/31280951
tagged with: maven-compiler-plugin
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37152089
favorite count: 0
has comment: http://stackoverflow.com/comment/37209822
tagged with: maven
has answer: http://stackoverflow.com/a/31280951
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse-jdt
upvote count: 1

http://stackoverflow.com/comment/37063520
type: AnswerComment
score: 0
type: Comment
has text: NP, but remember that the `_blank` window name is subjecting the behavior to the browsers. I suppose that's why Vaadin offers the second method signature. I tested o`_blank` on Firefox & Chrome but I can't tell about any other. HTH.
comment on: http://stackoverflow.com/a/24039630

http://stackoverflow.com/comment/37075366
type: Comment
type: QuestionComment
has text: Your code is hard to read as its indentation and use of white space is all over the place. Consider fixing this, so that we can understand it easier; if you do this you'll greatly increase your chances of getting good help. Specifically, indent each block 4 spaces (don't use tabs), avoid more than 1 empty line, and use your empty lines sparingly. Luck!
comment on: http://stackoverflow.com/q/24047045
score: 1

http://stackoverflow.com/q/23990805
has comment: http://stackoverflow.com/comment/36969166
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36970974
downvote count: 0
has comment: http://stackoverflow.com/comment/36969548
tagged with: java
possible better answer: http://stackoverflow.com/a/23990875
score: 13
has comment: http://stackoverflow.com/comment/36969225
has title: Converting different countrys currency to double using java
type: Question
duplicate of: http://stackoverflow.com/q/3730019
has comment: http://stackoverflow.com/comment/36969719
has comment: http://stackoverflow.com/comment/36969505
upvote count: 13
has comment: http://stackoverflow.com/comment/36970739
accepted answer: http://stackoverflow.com/a/23991368
has answer: http://stackoverflow.com/a/41784496
has body: I have once scenario where in i get the currencies as a String, for eg: $199.00 R$ 399,00 £25.00 90,83 € AED 449.00 How do i convert these currencies to double in java?
has answer: http://stackoverflow.com/a/23990875
has answer: http://stackoverflow.com/a/23990860
has answer: http://stackoverflow.com/a/23991368
favorite count: 0
tagged with: currency

http://stackoverflow.com/comment/37075014
has text: If the function peek is failing, then why not let it throw an exception?
comment on: http://stackoverflow.com/q/24046971
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24071345
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24071517
tagged with: android-button
upvote count: 2
tagged with: for-loop
answer count: 1
has title: how to send variable to another activity from for (or while) loop
favorite count: 0
tagged with: android
downvote count: 1
tagged with: android-activity
has body: i'm new to android and i have a problem. i want to sent variable "adresa" from for (or while) loop to another activity when click on button, but allways send last value from loop. here is code: PS. sorry for my english this is first activity package com.example.locationtracker; 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 android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.app.ActionBar.LayoutParams; import android.widget.LinearLayout; import android.widget.Toast; import android.widget.Button; public class DatabasesActivity extends Activity { public static String adresa; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final DBAdapter2 db = new DBAdapter2(this); //---get a posao--- db.open(); final Cursor c = db.getPosao(0); if (c.moveToFirst()){ final int x = 0; final LinearLayout lm = (LinearLayout) findViewById(R.id.linearMain); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // while (c.moveToNext()) { for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) { LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.HORIZONTAL); final Button button = new Button(this) ; button.setId(x+1); button.setText("id: " + c.getString(0) + "\n" + "Ime: " + c.getString(1) + "\n" + "Adresa: " + c.getString(2) + "\n" + "Telefon: " + c.getString(3) + "\n" + "Napomena: " + c.getString(4) + "\n" + "Status: " + c.getString(5)); button.setLayoutParams(params); adresa = c.getString(2); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on click Inte…
accepted answer: http://stackoverflow.com/a/24071517

http://stackoverflow.com/a/35812932
upvote count: 19
downvote count: 1
answers question: http://stackoverflow.com/q/23991694
type: Answer
has comment: http://stackoverflow.com/comment/98981580
score: 18
has body: You can try installing minio server on your laptop/system, its open source &amp; single static binary. Server is S3 compatible. Then you can try minio-java client library for all operations, following is basic operations example. Installing minio server [GNU/Linux] $ wget https://dl.minio.io/server/minio/release/linux-amd64/minio $ chmod 755 minio $ ./minio --help Hope it helps Disclaimer: I work for Minio

http://stackoverflow.com/a/33065266
has body: Goto Settings>Plugins then search for spring mvc and enable it
answers question: http://stackoverflow.com/q/24050533
type: Answer
score: 0

http://stackoverflow.com/q/24003949
has comment: http://stackoverflow.com/comment/36994773
favorite count: 0
tagged with: operators
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36994713
has answer: http://stackoverflow.com/a/24004386
answer count: 4
has title: Why is modulo 3 inefficient?
has answer: http://stackoverflow.com/a/24004113
tagged with: java
upvote count: 1
has body: I have this code here. This code is called 'efficient' because it is more efficient than modulo 3. But why is modulo 3 inefficient? Does it not do the same operations underneath? Whats the complexity of modulo operation?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36995186
tagged with: modulo
has comment: http://stackoverflow.com/comment/36995290
has comment: http://stackoverflow.com/comment/36994816
has answer: http://stackoverflow.com/a/24004162
score: 0
has answer: http://stackoverflow.com/a/24004124

http://stackoverflow.com/q/24088323
has answer: http://stackoverflow.com/a/24088383
has body: i have following piece of code import java.io.*; import java.util.*; class MainDriver{ public static void main(String aa[]){ Scanner reader = new Scanner (System.in); String name; System.out.println("enter your name"); name = reader.nextLine(); name.trim(); System.out.println (name); } } And i am wondering about output if i give whitespaces in input input bayant singh output bayant singh So why name.trim; is not working here?As i am guessing output to be bayantsingh //no spaces
linked to: http://stackoverflow.com/q/214714
type: Question
has comment: http://stackoverflow.com/comment/37151401
linked to: http://stackoverflow.com/q/9544182
has answer: http://stackoverflow.com/a/24088359
tagged with: string
favorite count: 0
has title: How to trim spaces of runtime variable in java?
answer count: 3
score: 2
has comment: http://stackoverflow.com/comment/37151486
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/279507
has comment: http://stackoverflow.com/comment/37151678
downvote count: 1
has answer: http://stackoverflow.com/a/24088331
tagged with: java

http://stackoverflow.com/a/24090253
accepted answer of: http://stackoverflow.com/q/24087337
upvote count: 2
type: Answer
score: 2
has body: Put the exclude configuration into the pom.xml file of moduleN that you want to do the exclusions from: org.codehaus.mojo cobertura-maven-plugin 2.6 com/aaa/**/*.class com/xxx/**/*.class
has comment: http://stackoverflow.com/comment/67534322
answers question: http://stackoverflow.com/q/24087337
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23995644
has comment: http://stackoverflow.com/comment/36979054
has comment: http://stackoverflow.com/comment/36980600
score: 0
has comment: http://stackoverflow.com/comment/36979311
has comment: http://stackoverflow.com/comment/36980240
type: Answer
has comment: http://stackoverflow.com/comment/36980794
has comment: http://stackoverflow.com/comment/36978755
has comment: http://stackoverflow.com/comment/36980408
has comment: http://stackoverflow.com/comment/36979257
has comment: http://stackoverflow.com/comment/36980020
has comment: http://stackoverflow.com/comment/36979377
has comment: http://stackoverflow.com/comment/36980301
has comment: http://stackoverflow.com/comment/36979429
has body: Yeah, a web service would do (like posted on the comments above) If you really need to go for sockets you will then need a server-socket within a wile loop to wait for incoming requests and open a new thread per client request. see a really basic example here: http://cs.lmu.edu/~ray/notes/javanetexamples/
accepted answer of: http://stackoverflow.com/q/23995502
has comment: http://stackoverflow.com/comment/36978871
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23995502

http://stackoverflow.com/q/24054705
downvote count: 1
type: AnsweredQuestion
has body: I'm taking a practice exam for one of my classes, I came across a problem that asked me to implement a static generic method. I was correct for the body of the method, but my guess for the actual method signature was different. I guessed: public static &lt;T&gt; boolean isSorted(T[] array, Comparator&lt;T&gt; cmp){ ... The practice exam's answer, however, used a bounded wildcard like this: public static &lt;T&gt; boolean isSorted(T[] a, Comparator&lt;? super T&gt; cmp) I read through the javadoc again and even though I know what this means (super being restrictive in a upwardly inclusive manner in the class hierarchy for that type T you specify), I don't think I fully understand why you would want to use a bounded wildcard in like this. Thanks in advance.
tagged with: java
linked to: http://stackoverflow.com/q/1292109
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/24054863
has title: Java Why use of bounded wildcards in this example?
answer count: 1
has comment: http://stackoverflow.com/comment/37089610
tagged with: generics
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/24054863

http://stackoverflow.com/a/24097981
score: 0
type: Answer
has body: After you add the new components, call repaint() on the panel. matchPanelBase.repaint();
answers question: http://stackoverflow.com/q/24097948

http://stackoverflow.com/comment/36979257
has text: hmm that helps thanks.Well i will dig in then, i am kinda new to these stuff.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23995644

http://stackoverflow.com/comment/37034298
has text: Yes, it could, but I would at least like to see log entries that make sense, but if you insist... I take it it's only the negative numbers that are broken? Do all the negative values come out as `65533`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24024895

http://stackoverflow.com/comment/37076724
has text: There is nothing in the logcat about the MuPDFActivity so it doesn't really help. You should either add logging to MuPDFActivity or use breakpoints and debugging to check it is even starting. If it is, then you can try to work out why it can load the PDF.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24022303

http://stackoverflow.com/a/23964543
downvote count: 0
score: 3
type: Answer
has body: One issue I see is that when a Thread is being asked to read, for example, lines 80000000 through 90000000, you are still reading in the first 80000000 lines (and ignoring them). Maybe try java.io.RandomAccessFile. In order to do this, you need all of the lines to be the same number of Bytes. If you cannot adjust the structure of your file, then this would not be an option. But if you can, this should allow for greater concurrency.
upvote count: 3
answers question: http://stackoverflow.com/q/23964343

http://stackoverflow.com/a/24087355
answers question: http://stackoverflow.com/q/24087285
has comment: http://stackoverflow.com/comment/37149455
has body: You're using the Iterator twice, which is causing your issue. Basically, you go all the way through the list and then while you're at the end, you ask if there's another element in the list (which there isn't). The list doesn't restart when you reach the end. Instead of two while loops, just use one. public void print(){ Iterator&lt;AddingBoth&gt; iter = list.iterator(); AddingBoth temp; while(iter.hasNext()){ temp = iter.next(); System.out.println(temp.getRadius()+" "); System.out.println("Value: "+temp.getValue()); } }
score: 0
type: Answer

http://stackoverflow.com/comment/36926071
type: Comment
type: QuestionComment
has text: You want 2 different sorted lists? Or you want to sort by one criterion and use a second criterion for sorting objects that are equivalent according to the first criterion?
comment on: http://stackoverflow.com/q/23967352
score: 0

http://stackoverflow.com/a/24025987
has comment: http://stackoverflow.com/comment/37072580
type: Answer
has comment: http://stackoverflow.com/comment/37036417
has body: In part, your application shouldn't be managing MySQL users. This is because someone who can manipulate your application can manipulate it to gain access to the full db or render the entire db unusable. The application should authenticate with the db as the application, and the application's account for the db (i.e. the MySQL user) should be granted only permissions needed for that application. In general the ability to create users, destroy users or grant permissions (any or all of those) are inadvisable for an application to have, as your model is wide open to escalation-type attacks. I'd reconsider your design, and use for e.g. a column to separate user data or a meta structure like key-value pairs.
has comment: http://stackoverflow.com/comment/37079478
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24025516
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24025516
has comment: http://stackoverflow.com/comment/97760283

http://stackoverflow.com/q/24011759
tagged with: hibernate-mapping
has title: Hibernate performs delete cascade in wrong order
linked to: http://stackoverflow.com/q/951074
has comment: http://stackoverflow.com/comment/37009231
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37010137
type: Question
tagged with: java
tagged with: hibernate
tagged with: orm
has body: My Db is throwing a Constraing violation (FK) because Hibernate performs a cascade delete in the wrong order. Details: I delete a Member, that has a Wallet with Wallet transactions (value-type), and the wallet transaction has an association to a product just like the Member contains collection of products (see the Hibernate mapping below). I delete a Member instance, and want Hibernate to remove both the products and Wallet transactions. It seems that it first removes the product instances (through cascading), such that a FK violation is thrown by the DB, as it's still referenced by a Wallet transaction, that wasn't removed yet (through cascade) I played around with the cascade setting, like all-delete-orphan (on the products), etc..., but no luck I also emptied the wallet transactions and flushed the hibernate session in the same removal transaction, but also the same error. Please some understanding and help to get the order of cascade deletion correct? The hibernate mapping (I left out the none-important parts like PK and properties): <cache usage="read-write" /> <key column="idTaxer" not-null="true" /> <property name="amount" type="big_decimal" column="amount" /> <many-to-one name="product" column="idPrdInst" class="Product" cascade="none" /> <key column="idTaxer" not-null="true" /> <one-to-many class="Product" /> ... <many-to-one name="member" column="idMember" class="Member" cascade="none" /> The DB error: ERROR: update or delete on table "prd" violates foreign key constraint "fk_1umej7" on table "wallet_tx" DETAIL: Key (id)=(75bef42fc4544) is still referenced from table "wallet_tx".
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/24081890
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/24093654
score: 4
favorite count: 0
linked to: http://stackoverflow.com/q/5587482

http://stackoverflow.com/comment/36940195
type: Comment
comment on: http://stackoverflow.com/q/23975112
type: QuestionComment
has text: Also, if you're on Java 7, you can write numbers in plain binary using the `0b` prefix (e.g. `0b11111111` is a byte with all 1s)
score: 0

http://stackoverflow.com/comment/37319422
type: Comment
has text: @eomeroff javac and ikvm are different things. Open a new question to this new problem.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24088348

http://stackoverflow.com/comment/37002247
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23967847
has text: Thanks, but it is not working with Solaris Sparc. root@iwfmvs009:~# java -version 2>&1 | head -1 | cut -d'"' -f2 -bash: java: command not found please give some more solution on it

http://stackoverflow.com/comment/36968259
has text: ohhhh sry i forgot to post the pastebin link , sry *facepalm*
comment on: http://stackoverflow.com/q/23990116
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23960025
favorite count: 0
has answer: http://stackoverflow.com/a/23960091
tagged with: android
has body: Ok, so this code is right off the Android Developer site which sets an ImageView to a Bitmap: class BitmapWorkerTask extends AsyncTask&lt;Integer, Void, Bitmap&gt; { private final WeakReference&lt;ImageView&gt; imageViewReference; private int data = 0; public BitmapWorkerTask(ImageView imageView) { // Use a WeakReference to ensure the ImageView can be garbage collected imageViewReference = new WeakReference&lt;ImageView&gt;(imageView); } // Decode image in background. @Override protected Bitmap doInBackground(Integer... params) { data = params[0]; return decodeSampledBitmapFromResource(getResources(), data, 100, 100)); } // Once complete, see if ImageView is still around and set bitmap. @Override protected void onPostExecute(Bitmap bitmap) { if (imageViewReference != null &amp;&amp; bitmap != null) { final ImageView imageView = imageViewReference.get(); if (imageView != null) { imageView.setImageBitmap(bitmap); } } } } And basically, what I want to do is instead of doing imageView.setImageBitmap(bitmap); I want to return that Bitmap so I can then use it in my Main UI. Is there any way of going about doing this? Sorry about my lack of knowledge on AsyncTask, I just started learning it recently. Thank you!
answer count: 4
tagged with: android-asynctask
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23960256
accepted answer: http://stackoverflow.com/a/23961034
tagged with: bitmap
possible better answer: http://stackoverflow.com/a/23960159
has title: How to return a Bitmap from an Async Task in Android app
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23960159
tagged with: java
has answer: http://stackoverflow.com/a/23961034
type: Question
upvote count: 2
tagged with: imageview

http://stackoverflow.com/a/23992722
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36973023
has body: Object#finalize() is not supposed to be invoked externally. From the Javadocs Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.
answers question: http://stackoverflow.com/q/23992650
downvote count: 0
has comment: http://stackoverflow.com/comment/36972763
type: Answer

http://stackoverflow.com/q/23964070
tagged with: netbeans
score: 0
answer count: 1
tagged with: java
has title: Bad display of running project
has answer: http://stackoverflow.com/a/23964114
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36920134
has body: I have a problem with display running project in NetBeans. Designed interface looks like: But when project is running, it looks like: I don't know what happened. I changed nothing.
type: Question
has comment: http://stackoverflow.com/comment/36920212
accepted answer: http://stackoverflow.com/a/23964114

http://stackoverflow.com/comment/37013179
score: 0
comment on: http://stackoverflow.com/q/24013819
type: Comment
type: QuestionComment
has text: As i told sub1,sub2 also has to delete.only i need to show .zip file remaining everyting inside Books folder i have to delete.for the same code i'm able to delete all files inside sub1,sub2.But sub1,sub2 are not deleting,I'm also using windows only.

http://stackoverflow.com/comment/104008332
type: AnswerComment
type: Comment
score: 28
has text: This doesn't reverse the stream. It sorts the stream in reverse order. So if you had `Stream.of(1,3,2)` the result would be `Stream.of(3,2,1)` NOT `Stream.of(2,3,1)`
comment on: http://stackoverflow.com/a/41911784

http://stackoverflow.com/a/24090673
score: 1
has comment: http://stackoverflow.com/comment/37157496
has comment: http://stackoverflow.com/comment/37156244
upvote count: 1
has comment: http://stackoverflow.com/comment/37157390
answers question: http://stackoverflow.com/q/24089812
has body: The issue is that you're just checking for new connections with key.isAcceptable(). You also need to check for reads with key.isReadble(). You should only be doing connection setup from key.isAcceptable(). See Java ServerSocketChannel SocketChannel (Callback)
has comment: http://stackoverflow.com/comment/37157688
accepted answer of: http://stackoverflow.com/q/24089812
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37156280
has comment: http://stackoverflow.com/comment/37156516
type: Answer
has comment: http://stackoverflow.com/comment/37157942

http://stackoverflow.com/comment/36895120
comment on: http://stackoverflow.com/q/23951011
type: Comment
type: QuestionComment
score: 2
has text: I dont think there's anything wrong with storing it as text?

http://stackoverflow.com/comment/37056835
type: QuestionComment
comment on: http://stackoverflow.com/q/24037689
has text: post your stacktrace.
score: 0
type: Comment

http://stackoverflow.com/q/24104796
answer count: 1
has comment: http://stackoverflow.com/comment/37187015
favorite count: 0
tagged with: macos
has title: A couple of questions about Eclipse
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37183406
has body: I've been learning to program in Java and the one thing I'm having difficulty locking down is an IDE that I actually like! I tried NetBeans, but did not get on with it at all. I've recently been using CodeRunner, which I found on the Mac App Store. I like CodeRunner, but I worry that it might be a bit simplistic. So I've been thinking of trying Eclipse, but there are a couple of things I'm not quite sure about that hopefully someone here can answer. First of all, I've tried installing Eclipse on my Mac and I'm baffled by the fact that it comes with a folder packed full of program files and not as just a packaged Mac app. I'm not entirely sure what to do with it; are there any Mac Eclipse users out there who can advise me? My other query has to do with projects. I've worked with a couple of different Java books and they all recommend using a single project to hold all of the java files for the book. Can anyone explain why this is? I would prefer to keep my own folder structure, for example having a separate folder for each chapter. Would I just have a different project for each chapter instead, is that how this works? My apologies if these are noob questions; I really want to get my head around Java, but need to be able to get comfortable with the IDE ideally first! Many thanks.
downvote count: 0
has comment: http://stackoverflow.com/comment/37183383
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24105374
accepted answer: http://stackoverflow.com/a/24105374
tagged with: eclipse
upvote count: 1

http://stackoverflow.com/comment/36987783
comment on: http://stackoverflow.com/q/23991722
score: 0
type: Comment
type: QuestionComment
has text: @ Dhrubajyoti Gogoi I have added the logs also can you please help me out in this

http://stackoverflow.com/q/23952068
answer count: 3
has comment: http://stackoverflow.com/comment/36896970
has answer: http://stackoverflow.com/a/23952604
favorite count: 0
has answer: http://stackoverflow.com/a/23952113
type: UnansweredQuestion
has body: I'm sorry if my title isn't specific enough. I'm trying to create a calculator. You enter: "operation" "num1" "num2" and you get your answer. Currently, I receive the following error from the code below: Exception in thread "main" java.lang.Error: Unresolved compilation problem: This method must return a result of type int at LessonOne.Main.calcu(Main.java:17) at LessonOne.Main.main(Main.java:13) My inputs are, "+", "5", "5" Please tell me what I'm doing wrong. I spent a couple hours editing this and this is the best I've come up with. I'm totally stuck. package LessonOne; import java.util.Scanner; public class Main { public static Scanner s = new Scanner(System.in); //&lt;-- DO NOT TOUCH public static void main(String[] args) { String oper = getStr(); //Enter your operator int numberOne = getInteger(); //Enter your first number int numberTwo = getInteger(); //Enter your second number int total = calcu(oper, numberOne, numberTwo); //Perform calculation System.out.println(total); //Print the total } static int calcu(String oper, int numberOne, int numberTwo) { if (oper.equals('+')) { int total = add(numberOne, numberTwo); return total; } else if (oper.equals('-')) { int total = sub(numberOne, numberTwo); return total; } else if (oper.equals('*')) { int total = multi(numberOne, numberTwo); return total; } else if (oper.equals('/')) { int total = div(numberOne, numberTwo); return total; } } static int add(int numberOne, int numberTwo) { return int total = numberOne + numberTwo; } static int multi(int numberOne, int numberTwo) { return int total = numberOne * numberTwo; } static int sub(int numberOne, int numberTwo) { return int total = numberOne - numberTwo; } static int div(int numberOne, int numberTwo) { return int total = numberOne / numberTwo; } public static String getStr() {//&lt;-- DO NOT TOUCH return s.nextLine();//&lt;-- DO NOT TOUCH }//&lt;-- DO NOT TOUCH public static int getInteger() { //&lt;-- DO NOT TOUCH return s.nextInt(); //&lt;-- DO NOT TOUCH } //&lt;…
upvote count: 1
downvote count: 1
tagged with: java
has title: How to return an int in my java calculator?
has answer: http://stackoverflow.com/a/23952131
type: Question
tagged with: calculator
has comment: http://stackoverflow.com/comment/36896991
tagged with: int
score: 0

http://stackoverflow.com/a/24034624
type: AcceptedAnswer
has body: I would guess that EnumSet is what you are looking for: import java.awt.*; import java.awt.event.*; import java.util.*; import java.util.List; import javax.swing.*; import javax.swing.table.*; public final class EnumSetTest { private JComponent makeUI() { String[] columnNames = {"REPORT ID", "ACTION"}; Object[][] data = { {"Report1", EnumSet.of(Actions.PRINT)}, {"Report2", EnumSet.of(Actions.PRINT, Actions.EDIT)}, {"Report3", EnumSet.allOf(Actions.class)}, {"Report4", EnumSet.of(Actions.PRINT)} }; DefaultTableModel model = new DefaultTableModel(data, columnNames) { @Override public Class&lt;?&gt; getColumnClass(int column) { return getValueAt(0, column).getClass(); } }; JTable table = new JTable(model); table.setRowHeight(36); TableColumn column = table.getColumnModel().getColumn(1); column.setCellRenderer(new ButtonsRenderer()); column.setCellEditor(new ButtonsEditor(table)); return new JScrollPane(table); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } public static void createAndShowGUI() { JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(new EnumSetTest().makeUI()); f.setSize(320, 240); f.setLocationRelativeTo(null); f.setVisible(true); } } enum Actions { PRINT, EDIT; } class ButtonsPanel extends JPanel { public final List&lt;JButton&gt; buttons = new ArrayList&lt;&gt;(); public ButtonsPanel() { super(new FlowLayout(FlowLayout.LEFT)); setOpaque(true); for (Actions a : Actions.values()) { JButton b = new JButton(a.toString()); b.setFocusable(false); b.setRolloverEnabled(false); add(b); buttons.add(b); } } protected void updateButtons(Object value) { if (value instanceof EnumSet) { EnumSet ea = (EnumSet) value; removeAll(); if (ea.contains(Actions.PRINT)) { add(buttons.get(0)); } if (ea.contains(Actions.EDIT)) { add(buttons.get(1)); } } } } class ButtonsRenderer implements TableCellRenderer { private final ButtonsPa…
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24025560
type: Answer
answers question: http://stackoverflow.com/q/24025560
downvote count: 0
score: 5

http://stackoverflow.com/a/24064596
has comment: http://stackoverflow.com/comment/37107258
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/24064542
answers question: http://stackoverflow.com/q/24064542
has comment: http://stackoverflow.com/comment/37107371
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37107326
has body: You're downloading the web page, not the file itself. The URL for the file is: https://github.com/msysgit/msysgit/releases/download/Git-1.9.2-preview20140411/Git-1.9.2-preview20140411.exe So just do: URL url = new URL("https://github.com/msysgit/msysgit/releases/download/Git-1.9.2-preview20140411/Git-1.9.2-preview20140411.exe");
upvote count: 4
has comment: http://stackoverflow.com/comment/37107202
has comment: http://stackoverflow.com/comment/37107275

http://stackoverflow.com/comment/37503625
score: 0
comment on: http://stackoverflow.com/q/24050160
type: Comment
type: QuestionComment
has text: Thanks. Reading through the docs now. Do you know of any examples by any chance?

http://stackoverflow.com/comment/37109036
type: AnswerComment
comment on: http://stackoverflow.com/a/24065452
type: Comment
has text: @LuiggiMendoza Edited to clarify that it is the immutability of the properties used in the key mapping algorithm.
score: 0

http://stackoverflow.com/comment/37038083
type: AnswerComment
type: Comment
has text: That does not answer thé question about nested loops.
comment on: http://stackoverflow.com/a/24026751
score: 0

http://stackoverflow.com/comment/41272174
type: AnswerComment
comment on: http://stackoverflow.com/a/24070458
score: 0
type: Comment
has text: @Basilevs So you mean this have to do with the garbage colloector. This makes complete sense since this symptoms of this problems looks similar and the troubles appear at the memory limit

http://stackoverflow.com/comment/36920491
comment on: http://stackoverflow.com/q/23964101
type: Comment
type: QuestionComment
score: 0
has text: Have you looked over the Android tutorials on [Saving Data](http://developer.android.com/training/basics/data-storage/index.html) and [Data Storage](http://developer.android.com/guide/topics/data/index.html)?

http://stackoverflow.com/a/24026010
answers question: http://stackoverflow.com/q/24025938
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: You need to put the text between the &lt;html&gt; and &lt;/html&gt; tags as such: title[i].setText("&lt;html&gt;&lt;br/&gt;" + titleText[i] + "&lt;/html&gt;"); The content inclosed between the tags &lt;html&gt;&lt;/html&gt; tells the button to interpret it as HTML content.
type: Answer
accepted answer of: http://stackoverflow.com/q/24025938

http://stackoverflow.com/comment/37074752
has text: The program would work fine but not for `n=20` because the `int` will overflow.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24046872

http://stackoverflow.com/comment/37025912
type: Comment
has text: For flowController to be invoked, specify a simpleurlhandlermapping mapped to flowcontroller.
type: AnswerComment
comment on: http://stackoverflow.com/a/24020343
score: 0

http://stackoverflow.com/q/24055944
type: UnansweredQuestion
tagged with: oracle-database
has title: ORA-01461: can bind a LONG value only for insert into a LONG
score: 2
answer count: 0
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40899520
type: Question
has body: I am using iBATIS from my application. this error is thrown: operation; uncategorized SQLException for SQL []; SQL state [72000]; error code [1461]; --- The error occurred in com/syngenta/panda/dao/sqlmap/shared/Task.xml. --- The error occurred while applying a parameter map. --- Check the TaskSQLMap.updateTask-InlineParameterMap. --- Check the statement (update failed). --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column the query I am using is UPDATE TASK SET TIME_CONSUMED = #timeConsumed#, TIME_SUBMITTED = #timeSubmitted# , TIME_COMPLETED = #timeCompleted# , TASK_STATUS_UID = #status.id#, FAILURE_REASON = #failureReason# WHERE TASK_UID = #id# there is no long type for all properties inserted, however there is a long type for another property that is not included in the update statement. and there is no LONG type for all columns in the table. can you please help
has comment: http://stackoverflow.com/comment/40895655
tagged with: sql-update
tagged with: sql
downvote count: 0
has comment: http://stackoverflow.com/comment/37095297
favorite count: 0
tagged with: ibatis

http://stackoverflow.com/a/24071366
accepted answer of: http://stackoverflow.com/q/24071227
has comment: http://stackoverflow.com/comment/37135481
has comment: http://stackoverflow.com/comment/37135060
has comment: http://stackoverflow.com/comment/37120613
answers question: http://stackoverflow.com/q/24071227
has comment: http://stackoverflow.com/comment/37129894
has comment: http://stackoverflow.com/comment/37120058
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37120676
type: Answer
has comment: http://stackoverflow.com/comment/37130536
has comment: http://stackoverflow.com/comment/37120286
has body: is there any way to do the processing in a different Thread and afterwards get the arrayLists and variables back into the main thread? Yes, there is. You can (and probably should) start a new thread after dialog.setVisible(true) using new Thread() { @Override public void run() { getNewValues(); } }.start(); Once this job is done, from your "worker"-thread, you can invoke EventQueue.invokeLater(new Runnable() { @Override public void run() { //overwrite existing variables, update GUI elements, trigger repaints, etc. dialog.setVisible(false); } }; However, you should always try to separate your data from your view. That means: You probably should not invoke those actions from your worker thread, but implement the observer pattern to inform your GUI that the data has changed and to refresh itself.
downvote count: 0
score: 1

http://stackoverflow.com/a/23943871
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23943645
has body: As Jim Garrison mentioned in the comments, when the JVM is starting-up things run slower. This is due to a number of factors including "Just in Time" compilation or JIT... profiling just a few lines of code is basically meaningless... the same lines of code run after an app has started may take a fraction of the time that they take if they are run in isolation. Also, (slow) initialisation of big data structures is usually performed in its entirety before the start of a game update loop. It is also possible to use multi-threading for background loading and init of resources... although often simply pre-loading everything during inter-level menu screens is acceptable. Modern game loops are often a lot more complex than your example too: For example, things such as mini-maps are often updating with a lower frequency or only being partially updated every frame, whilst physics often needs to run at a higher sample rate than the paint cycle.
type: Answer
downvote count: 0

http://stackoverflow.com/a/23950217
answers question: http://stackoverflow.com/q/23949962
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23949962
has body: use this in place of JOptionPane.showInputDialog("correct the following string"); String mystr = JOptionPane.showInputDialog(null, "correct the following string", "correct the following string");

http://stackoverflow.com/comment/37177485
score: 0
type: AnswerComment
has text: If someone is asking you to process XML using an environment that does not provide an XML parser then you need to have a serious discussion with them.
comment on: http://stackoverflow.com/a/24090640
type: Comment

http://stackoverflow.com/a/24099663
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/37204036
has comment: http://stackoverflow.com/comment/37176190
has comment: http://stackoverflow.com/comment/37173553
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24099407
answers question: http://stackoverflow.com/q/24099407
has body: java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable The jar that contains the org.mozilla.javascript.Scriptable.class is not in the classpath. Add the suitable meven dependency.

http://stackoverflow.com/q/24044912
has comment: http://stackoverflow.com/comment/37071280
has comment: http://stackoverflow.com/comment/37071204
upvote count: 2
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/24045119
score: 1
tagged with: java
tagged with: loops
has title: Java: How to get my code to loop a check for if a file exists AND if a file doesn't exist with two different actions?
linked to: http://stackoverflow.com/q/1816673
has body: I'm having an issue with my code, where the loop works fine if a file exists, but if it doesn't then it only repeats once. I'd like it to work so that if a user enters a filename, and that file exists, it outputs that files content, and then asks the name of a new file. It should keep doing this until the user enters an escape word. If the file doesn't exist, it should tell them the file doesn't exist, and then prompt them to enter a new file name to see if it exists. This should loop continuously until the escape word is entered. Once the escape word is entered, it should output the end game message. I need to accomplish this without using methods, since it's for a college beginning java class. I have only a few weeks of coding experience and I'm completely stuck on getting this to function properly. My teacher suggested to "use an if else block to make the 2 paths mutually exclusive," although I'm not quite sure what this means or how to accomplish it. Can anyone help me fix my code to accomplish the above? Relevant code: while (!filename.equals(escapeWord)) { System.out.print("\nWhere would you like to go?\n"); filename = keyboard.nextLine(); File file = new File(filename); Scanner inputFile = new Scanner(file); if (!file.exists()) { System.out.println("You can't go that way!"); return; } while (inputFile.hasNext()) { String fileRead = inputFile.nextLine(); System.out.println(fileRead); dayCount += 1; } inputFile.close(); } //End Game Message System.out.println("Congratulations, your adventure is over. " + "You spent " +dayCount + " days adventuring!");
type: Question
has comment: http://stackoverflow.com/comment/37070982
answer count: 2
has answer: http://stackoverflow.com/a/24045087
favorite count: 0
has comment: http://stackoverflow.com/comment/37070889

http://stackoverflow.com/a/24103617
score: 0
type: Answer
has body: A SQL variable contains a single value, not a list of values. Some databases allow for lists to be passed (for example as a custom data type), but that is unusual and typically complex. The usual solution is the build a SQL string without parameters. This feels wrong, but there is no better solution. For example: sql = "select * from tbl where name in (" for(int i = 0; i &lt; array.length; i++) { if (i != 0) sql += ", "; sql += "'" + StringEscapeUtils.escapeSql(name) + "'"; } sql += ");" Note the use of escapeSql so the code works for names with a single quote.
answers question: http://stackoverflow.com/q/24103556

http://stackoverflow.com/comment/97724722
type: Comment
has text: Hi! vadim how can we achieve this with XML tags ?
comment on: http://stackoverflow.com/a/40579055
type: AnswerComment
score: 0

http://stackoverflow.com/comment/54312493
type: Comment
comment on: http://stackoverflow.com/a/33249912
score: 0
type: AnswerComment
has text: I thought it was about just printing things in reverse order not in sorted order (ie. descending order), and it works with parallel stream too : `public static <T> void reverseHelper(List<T> li){ li.parallelStream() .sorted((x,y)->-1) .collect(Collectors.toList()) .forEach(System.out::println); }`

http://stackoverflow.com/comment/37055068
type: Comment
has text: So then i should be able to type in a popped-up JFrame and still receive key presses and handle them in another JFrame?
type: AnswerComment
comment on: http://stackoverflow.com/a/24035935
score: 0

http://stackoverflow.com/q/23945765
has body: I was able to successfully build avahi per the instructions, but the next step in the quick start of running "ant test-browse" results in a symbol lookup error, and I'm confused about how to proceed with troubleshooting this problem. I did find the following post that showed a similar problem, but wasn't able to make any progress (it seems the thread was never publicly resolved anyway). Here is the error output that I see: myUser@ubuntu:~/Downloads/avahi4j-0.1$ ant test-browse Buildfile: /home/myUser/Downloads/avahi4j-0.1/build.xml init: compile: [javac] /home/myUser/Downloads/avahi4j-0.1/build.xml:109: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds jar: jnilib: [exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src' [exec] make: Nothing to be done for `all'. [exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src' test-browse: [java] Avahi4J v0.1-0 [java] /usr/lib/jvm/java-7-oracle/jre/bin/java: symbol lookup error: /home/myUser/Downloads/avahi4j-0.1/libavahi4j.so: undefined symbol: avahi_malloc BUILD FAILED /home/myUser/Downloads/avahi4j-0.1/build.xml:185: Java returned: 127 Total time: 0 seconds
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23964675
tagged with: c++
tagged with: avahi
type: UnansweredQuestion
has title: Why does Avahi "ant test-browse" fail with "libavahi4j.so: undefined symbol: avahi_malloc"?
tagged with: ant
tagged with: java
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/q/23952078
has comment: http://stackoverflow.com/comment/36897517
type: UnansweredQuestion
has body: I am having a large HTML content in a String and I am trying to render it to the browser using output stream of response and also response getWriter method, but only half of the content is getting rendered when I checked the view source. I used this following code, resp.setHeader("Content-Encoding","utf-8"); resp.getWriter().println(htmlSourceToRender); resp.getWriter().flush(); Can anyone help me on this please.
has comment: http://stackoverflow.com/comment/36897240
answer count: 0
tagged with: java
has title: Response renders only half of the HTML
has comment: http://stackoverflow.com/comment/36897395
type: Question
has comment: http://stackoverflow.com/comment/36897485
score: 0

http://stackoverflow.com/comment/36917872
type: Comment
type: QuestionComment
has text: read your error stacktrace, it tells you what you are doing wrong for the second problem. I think you'll have to make a rather custom component to display that sort of progress
comment on: http://stackoverflow.com/q/23962657
score: 0

http://stackoverflow.com/q/23966431
type: Question
score: 3
has body: hi im using maven to compile a jersey web services project and im getting error compiling it in windows 2008 server. Here is the error: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Administrator\Documents\MyApplication>mvn -e exec:java [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBu ilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building MyApplication 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- exec-maven-plugin:1.3:java (default-cli) @ MyApplication --- [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6. [WARNING] java.lang.ClassNotFoundException: rb.resource.Main at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281) at java.lang.Thread.run(Unknown Source) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.244 s [INFO] Finished at: 2014-05-31T12:20:54+08:00 [INFO] Final Memory: 12M/91M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3:java (default-cli) on project MyApplication: An exception occured while executing the Java class. rb.resource.Main -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed …
has answer: http://stackoverflow.com/a/43985387
has comment: http://stackoverflow.com/comment/36925980
answer count: 2
has comment: http://stackoverflow.com/comment/36924816
has comment: http://stackoverflow.com/comment/36925757
downvote count: 0
has answer: http://stackoverflow.com/a/24525167
tagged with: maven-3
has comment: http://stackoverflow.com/comment/36925821
favorite count: 0
has comment: http://stackoverflow.com/comment/36925430
type: UnansweredQuestion
has title: Maven Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3
has comment: http://stackoverflow.com/comment/36925213
tagged with: exec-maven-plugin
has comment: http://stackoverflow.com/comment/36926150
upvote count: 3
tagged with: java

http://stackoverflow.com/q/24014100
answer count: 1
downvote count: 0
has title: Raster vs paint(g) , paintComponent(g)
tagged with: raster
tagged with: paintcomponent
has body: I'm a novice programmer and recently I came across many methods of animation: Using BufferedImages , ie. draw to image and display using double buffering or triple buffering methods . Making my sprites components by extending Component or Button . and repainting by repaint(g). Rastering, using rasters and integer arrays, bitmaps and the like. I realise that method 1 and 2 are similar as they use paint() methods , however Rastering involves self-made functions , eg. creating functions that set background by traversing the whole array representing each pixel and setting colour to desired colour . I've seen many folks online use raster methods even though 1 &amp; 2 seem simpler . Please help me out here guys and tell me what path i should follow and why .
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24015840
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: graphics

http://stackoverflow.com/q/23983433
possible better answer: http://stackoverflow.com/a/23983467
has answer: http://stackoverflow.com/a/23983467
type: Question
answer count: 2
has title: Java: Superclass constructor needs preparation
score: 0
tagged with: java
has body: I have a following superclass: class FloatVector { private List&lt;Float&gt; components; public FloatVector(List&lt;Float&gt; comps) { components = comps; } public int getComponentCount(){ return components.size(); } public float getComponent(int ind){ return components.get(ind); } //other methods } and I want to extend it to, for example, a 2D vector: public class FloatVector2D extends FloatVector { FloatVector2D(float x,float y) { List&lt;Float&gt; comps = new ArrayList&lt;&gt;(); comps.add(x); comps.add(y); super(comps); } } but the IDE claims, that the superclass constructor must be the first call. There must be a way to implement the required behaviour.
has answer: http://stackoverflow.com/a/23983470
has comment: http://stackoverflow.com/comment/36955771
accepted answer: http://stackoverflow.com/a/23983470
has comment: http://stackoverflow.com/comment/36955859
type: AnsweredQuestion

hql
tag name: hql
tags question: http://stackoverflow.com/q/23956824
tags question: http://stackoverflow.com/q/24001951
tags question: http://stackoverflow.com/q/23978446
tags question: http://stackoverflow.com/q/24000740
type: Tag
tags question: http://stackoverflow.com/q/24023655

http://stackoverflow.com/comment/37014292
type: Comment
has text: Logging to console/SYSTEM_OUT is redirected by Tomcat to the catalina.out file. Remove all the `<appeder=ref ref="Console"/>` lines from the log4j2 configuration file.
comment on: http://stackoverflow.com/q/24009198
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37090551
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24055502
has text: I haven't written any specific code yet. I have been trying to find any way...but only found html codes for it, which I could not comprehend. I wanted something in java language, so need help

notnull
type: Tag
tags question: http://stackoverflow.com/q/24065249
tag name: notnull

http://stackoverflow.com/comment/37246069
has text: Thanks for this. Just one question, what method did you use to read the csv file, some mahout library such as CSVVectorIterator ? or did you write your own csv reader? Thanks.
type: Comment
comment on: http://stackoverflow.com/a/24083564
score: 0
type: AnswerComment

http://stackoverflow.com/a/24061013
score: 1
upvote count: 1
has body: An object oriented approach would be much better. Create an Area class: public class Area { private final int areaNumber; private final int someOtherValue; public Area(int areaNumber, int someOtherValue) { this.areaNumber = areaNumber; this.someOtherValue = someOtherValue; } @Override public String toString() { return String.format("Area: %d (%d)", areaNumber, someOtherValue); } } Then use it like this: List&lt;Area&gt; areas = Arrays.asList( new Area(1, 15), new Area(2, 7), new Area(3, 11)); // etc Area maxArea = Collections.max(areas, new Comparator&lt;Area&gt;() { @Override public int compare(Area o1, Area o2) { return Integer.compare(o1.someOtherValue, o2.someOtherValue); } }); System.out.println(maxArea); This would print: Area: 1 (15) Depending upon your exact use case, you may wish to have your Area class implement Comparable&lt;Area&gt; if you always plan to order the instances in the same way.
answers question: http://stackoverflow.com/q/24060564
type: Answer
downvote count: 0

http://stackoverflow.com/comment/69714696
comment on: http://stackoverflow.com/a/27045440
type: Comment
has text: Again we can immediately see an issue regarding action attribute is not specified in html form tag.Every form tag should and must specify action tag to overcome compile errors
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36946808
score: 0
has text: please give me your mail or facebook account I`ll send you the image of my code stackoverflow does not allow me to post it ,says your post is mostly code
comment on: http://stackoverflow.com/q/23978277
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37007848
has text: Okay. And if I got a path like RemoteSyntaxCheck/xx/xx/xx/xx, the value="Remote*" should match it right or?
comment on: http://stackoverflow.com/a/24009697
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24077254
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24077182
downvote count: 0
has body: The right way, since Java5, is the use of the ThreadPoolExecutor.
type: Answer

http://stackoverflow.com/comment/37193388
type: Comment
has text: This requires a basic read of OOP concepts. non-static properties are properties of an object that are related to individual objects, instead of the class. i.e. every object will have its own copy of the property. e.g. for a Student class, student's name is an instance property, since every object of the class (i.e. every student) should have a name of his/her own. Similary, properties like student's ID, student's GPA etc. are all instance properties, as opposed to minimum credits required for graduation (which in case of most undergraduate programs in US is 120). Common properties are static.
comment on: http://stackoverflow.com/a/24097482
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36975220
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23978481
has text: Andrea, the Hibernate documentation is well written and will tell you that the approach is right.

http://stackoverflow.com/a/24218322
type: Answer
answers question: http://stackoverflow.com/q/24103704
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24103704
has body: It is possible to capture objects in a pool when the pool is closed and put these objects back in the pool when a pool is opened with Yapool. I added a test-case to Yapool that shows how this could be done. Persisting these objects "between pools" is not part of Yapool. But you can, for example, store them in a file and load them before a pool is opened. Update: added another test-case which shows a more proper implementation and also shows a corner-case.
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37167988
type: Comment
comment on: http://stackoverflow.com/a/24097089
score: 0
type: AnswerComment
has text: I am not sure what kind of reference you want to find. Pure logic seems to be enough to say that `null` should never be returned as result of `iterator()`. You need to know that `Iterable` objects are mainly used in `for-each` loop (`for(T element : IterableInstance)`). If you would implement `iterable()` would you want people who will use your code to also have to handle `NullPointerException` each time they use it in `for-each`?

http://stackoverflow.com/q/23979831
linked to: http://stackoverflow.com/q/18991143
answer count: 0
has comment: http://stackoverflow.com/comment/36956019
type: Question
tagged with: dot
score: 0
tagged with: java
has title: Graphviz antlr dot swing
linked to: http://stackoverflow.com/q/23809005
has body: I have build a ANTLR3 swing application, My problem is how to display tree of my file in graph My code is like this Antlr3JavaParser parser = new Antlr3JavaParser(tokens); CommonTree tree; try { tree = (CommonTree) parser.compilationUnit().getTree(); DOTTreeGenerator gen = new DOTTreeGenerator(); StringTemplate st = gen.toDOT(tree); TextAreaParseTree.setText(st.toString()); // This my text area } catch (RecognitionException e) { e.printStackTrace(); return false; } which is give me an output like This is my screeshot application https://www.dropbox.com/s/iulr9htjmn5i441/Stack.png How Can I make this code to be looked a graph (perhaps an image) like in https://www.dropbox.com/s/i50oq8rir66wvce/DIkitLagi.png Thank you so much
has comment: http://stackoverflow.com/comment/36956066
type: UnansweredQuestion
tagged with: graphviz
tagged with: antlr

http://stackoverflow.com/a/24013518
upvote count: 2
has comment: http://stackoverflow.com/comment/137557105
answers question: http://stackoverflow.com/q/24013420
score: 2
has body: The basic idea of a JDialog IS to block the underlying thread until the user reacts to it. If you need to run something on the UI thread which should not be interrupted, consider using an additional worker thread for it. This way, the UI will be blocked by the JDialog, but the underlying process won't.
downvote count: 0
type: Answer

http://stackoverflow.com/q/24034747
downvote count: 0
type: UnansweredQuestion
has title: how to implement mouselistener on a particular shape?
has body: i have created an circular strip using swing in java, and now i want to display some text on mouse click clicking a particular region of the strip such as region between 45 degrees and 135 degrees central angle can anybody help me out? import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Ellipse2D; import javax.swing.JFrame; import javax.swing.JLabel; public class Test extends JFrame implements MouseListener { //public static final int MOUSE_CLICKED; public static void main(String[] args) { new Test(); } public Test() { this.setSize(400,400); this.setVisible(true); addMouseListener(this); } public void paint(Graphics g) { g.fillArc(50,50,230,270,45,90); g.setColor(Color.red); double radius1 = 230; double theta=90; double a1 = (Math.PI * radius1 * radius1*theta)/360; System.out.println("area"+a1); double radius2 = 200; double a2 = (Math.PI * radius2 * radius2*theta)/360; System.out.println("area2"+a2); double a=a1-a2; System.out.println("fin area"+a); g.fillArc(50,50,230,270,135,90); g.setColor(Color.blue); g.fillArc(50,50,230,270,225,90); g.setColor(Color.yellow); g.fillArc(50,50,230,270,315,90); g.setColor(Color.magenta); Graphics2D comp2D=(Graphics2D)g; comp2D.setColor(Color.white); Ellipse2D.Float sign=new Ellipse2D.Float(90F,90F,150F,200F); comp2D.fill(sign); { //System.out.println("hello"); } } //} }
score: 2
favorite count: 0
type: Question
upvote count: 2
tagged with: mouselistener
has comment: http://stackoverflow.com/comment/37052101
tagged with: swing
answer count: 1
tagged with: paint
tagged with: java
has answer: http://stackoverflow.com/a/24035204

http://stackoverflow.com/a/23946176
has body: This looks wrong: (OuterSpace)(getComponents()[0]).start(); It usually is done: ((OuterSpace)getComponents()[0]).start(); Having said this, regardless of what is right or wrong, this code looks like a fragile and dangerous kludge. If this were my project, I'd try to hold a more secure class-specific reference to my OuterSpace field, one that would not require casting, or require that my component be in a specific component array position.
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23946137
has comment: http://stackoverflow.com/comment/36886568
has comment: http://stackoverflow.com/comment/36886733
accepted answer of: http://stackoverflow.com/q/23946137
has comment: http://stackoverflow.com/comment/36886327
type: Answer
has comment: http://stackoverflow.com/comment/36886532

http://stackoverflow.com/comment/36951568
type: AnswerComment
score: 0
has text: I have rewritten the code, so it encrypts it with Cipher, but still does not work, but what do you mean by the `Signature` what it does it do and how do I use it?
type: Comment
comment on: http://stackoverflow.com/a/23974880

http://stackoverflow.com/comment/37013532
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24012978
type: Comment
has text: I tried with longtext but still error is coming.

http://stackoverflow.com/q/23999315
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24000101
tagged with: java
score: -1
tagged with: listview
type: Question
upvote count: 0
tagged with: android-listfragment
has title: Update private ListFragment from parent activity
tagged with: adapter
has body: I have a FragmentActivity which creates a ListFragment. Inside the ListFragment is a custom adapter. When I would try to make the adapter public, it wouldn't let me. So, I don't really have access to the adapter or I'm not sure how to get it. I add some data to the listview statically with a public arraylist of objects that I declare early in the lifecycle. However, other data I want to retrieve with AsyncTask from a Database. I get this data in the parent activity and I know right when it is finished fetching the data. So, Can I update the listView within the ListFragment with access to the arraylist, but not access to the adapter? If so, can I do it from the activity or do I need to somehow call a method in listFragment? If I need to call a method in listFragment, how do I access that method from the activity? If this is not possible without access to the adapter, how do I get access to the adapter without the public keyword? Would it be better to move my AsycTask to my ListFragment? I know it sounds like a lot, but I'm just wondering how to refresh the listview with those cicumstances. Help is greatly appreciated. Call to method: ListFragment fragment = (ListFragment) getSupportFragmentManager().findFragmentByTag("fragtag"); fragment.updateData(); Method that refreshes: public void updateData(){ ((ArrayAdapter)this.getListAdapter()).notifyDataSetChanged(); } It is in my subclass of ListFragment, but not in any methods. **Edit:**Now I get the following error: Error parsing data java.lang.ClassCastException: com.dynamic_internet_solutions.scsinfo.app.SpeakerListFragment$1SpeakersListAdapter cannot be cast to android.widget.ArrayAdapter **Edit - Solved: ** I did ListFragment fragment = (ListFragment) getSupportFragmentManager().findFragmentByTag("fragtag"); BaseAdapter adapter = (BaseAdapter) fragment.getListAdapter(); adapter.notifyDataSetChanged(); after I set the tag of my fragment on initialization.
has answer: http://stackoverflow.com/a/24000101
tagged with: android
answer count: 1
favorite count: 0
downvote count: 1

http://stackoverflow.com/comment/37139735
comment on: http://stackoverflow.com/q/24082285
score: 0
has text: Look into virtual machines. I *think* the network type you are looking for is "Bridged". This will allow you to run multiple OS's from the same machine, and each will have its own IP address.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24033187
upvote count: 0
score: -3
has title: Make exception in Java
has comment: http://stackoverflow.com/comment/37048824
accepted answer: http://stackoverflow.com/a/24033300
has body: I want to test development code. How I can make exception into my code in order to test code? try { throw new Exception(); } catch (Exception e) { }
has comment: http://stackoverflow.com/comment/37048662
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37048710
favorite count: 0
type: Question
tagged with: exception
answer count: 2
has comment: http://stackoverflow.com/comment/37050359
has answer: http://stackoverflow.com/a/24033300
tagged with: java
has answer: http://stackoverflow.com/a/24033385
downvote count: 3
possible better answer: http://stackoverflow.com/a/24033385

http://stackoverflow.com/q/24067173
downvote count: 0
answer count: 4
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: Unexpected java charAt output
score: 1
tagged with: java
has body: The code is String veggie = "eggplant"; int length = veggie.length(); char zeroeth = veggie.charAt(0); char third = veggie.charAt(4); String caps = veggie.toUpperCase(); System.out.println(veggie + " " + caps); System.out.println(zeroeth + " " + third + " " + length); System.out.println(zeroeth + third + length); The output reads: eggplant EGGPLANT e 1 8 217 This doesn't make sense to me. Referencing a charAt outputs numbers instead of characters. I was expecting it to output the characters. What did I do wrong?
has answer: http://stackoverflow.com/a/24067506
type: Question
has comment: http://stackoverflow.com/comment/37112168
has comment: http://stackoverflow.com/comment/37112130
has answer: http://stackoverflow.com/a/24067277
has answer: http://stackoverflow.com/a/24067224
has answer: http://stackoverflow.com/a/24067221

url
tags question: http://stackoverflow.com/q/24064542
tag name: url
tags question: http://stackoverflow.com/q/23961984
tags question: http://stackoverflow.com/q/24029988
tags question: http://stackoverflow.com/q/24077453
tags question: http://stackoverflow.com/q/24076757
tags question: http://stackoverflow.com/q/24018032
tags question: http://stackoverflow.com/q/23946921
tags question: http://stackoverflow.com/q/23961197
tags question: http://stackoverflow.com/q/23975663
type: Tag

kinect
type: Tag
tags question: http://stackoverflow.com/q/24098937
tag name: kinect

http://stackoverflow.com/comment/37591032
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23976358
has text: As no one has any other explanation, I am going to accept your answer.

http://stackoverflow.com/comment/37124055
comment on: http://stackoverflow.com/q/24067134
type: QuestionComment
has text: @kamil i have already posted my error
score: 0
type: Comment

http://stackoverflow.com/comment/36884702
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23945234
has text: @DSlomer64: `inputLineLengths[i] = inputLine.length;` in `main()`

http://stackoverflow.com/q/23980404
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23980449
type: Question
has comment: http://stackoverflow.com/comment/36949841
linked to: http://stackoverflow.com/q/1574837
tagged with: java
has title: How do I redirect the output of one process as an input to another process?
score: -1
linked to: http://stackoverflow.com/q/9834086
has body: I need to execute the command, ps -aux | awk ' /^user/ { system("pstree " $2) }' But as I can't execute both in one process I would like to execute both in separate processes and redirect the output of ps -aux process as input to awk process.How do I code this? Please help.
tagged with: bash
duplicate of: http://stackoverflow.com/q/9834086
answer count: 1
has comment: http://stackoverflow.com/comment/36949798
tagged with: shell
tagged with: ubuntu
favorite count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/36950773

struts2
tags question: http://stackoverflow.com/q/24063808
tags question: http://stackoverflow.com/q/24057649
tags question: http://stackoverflow.com/q/23977256
tags question: http://stackoverflow.com/q/24041409
tag name: struts2
tags question: http://stackoverflow.com/q/24039570
tags question: http://stackoverflow.com/q/24018120
tags question: http://stackoverflow.com/q/24066664
tags question: http://stackoverflow.com/q/23957800
tags question: http://stackoverflow.com/q/24043032
tags question: http://stackoverflow.com/q/24017544
tags question: http://stackoverflow.com/q/24005108
type: Tag
tags question: http://stackoverflow.com/q/24056713
tags question: http://stackoverflow.com/q/24021152

http://stackoverflow.com/q/24097251
favorite count: 0
has comment: http://stackoverflow.com/comment/37168238
has comment: http://stackoverflow.com/comment/37168307
tagged with: type-erasure
has comment: http://stackoverflow.com/comment/37168312
has body: List&lt;? extends Number&gt; list1 = new ArrayList&lt;Number&gt;(){ {addAll(Arrays.asList(1,2,3,4,5));} }; ListIterator listIterator = list1.listIterator(); listIterator.next(); listIterator.set(999); System.out.println(list1); this code works and outs [999, 2, 3, 4, 5] But if I write so: List&lt;? extends Number&gt; list1 = new ArrayList&lt;Number&gt;(){ {addAll(Arrays.asList(1,2,3,4,5));} }; list1.set(0,999); I see java: method set in interface java.util.List&lt;E&gt; cannot be applied to given types; required: int,capture#1 of ? extends java.lang.Number found: int,int reason: actual argument int cannot be converted to capture#1 of ? extends java.lang.Number by method invocation conversion Plese clarify this behaviour. P.S. This question was arisen after watching code from Collections.reverse method public static void reverse(List&lt;?&gt; list) { int size = list.size(); if (size &lt; REVERSE_THRESHOLD || list instanceof RandomAccess) { for (int i=0, mid=size&gt;&gt;1, j=size-1; i&lt;mid; i++, j--) swap(list, i, j); } else { ListIterator fwd = list.listIterator(); ListIterator rev = list.listIterator(size); for (int i=0, mid=list.size()&gt;&gt;1; i&lt;mid; i++) { Object tmp = fwd.next(); fwd.set(rev.previous()); rev.set(tmp); } } }
has answer: http://stackoverflow.com/a/24097655
accepted answer: http://stackoverflow.com/a/24097655
has title: Why cannot I modify collection through up bounded reference but can through its iterator?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: collections
has comment: http://stackoverflow.com/comment/37168582
type: Question
has comment: http://stackoverflow.com/comment/37168216
has comment: http://stackoverflow.com/comment/37168339
has comment: http://stackoverflow.com/comment/37168263
has comment: http://stackoverflow.com/comment/37168350
has comment: http://stackoverflow.com/comment/37168320
answer count: 1
downvote count: 0
tagged with: generics
has comment: http://stackoverflow.com/comment/37168352
tagged with: wildcard

http://stackoverflow.com/q/23960415
type: Question
tagged with: network-programming
has body: I was wondering if there are any libraries useful for network packet capture and analysis that do not build off of libpcap? I'm trying to develop a platform-independent application. Thanks
answer count: 1
tagged with: libpcap
downvote count: 0
has comment: http://stackoverflow.com/comment/36919037
has title: Network packet capture in Java without libpcap
favorite count: 0
has answer: http://stackoverflow.com/a/23962744
tagged with: packet
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/a/24087216
upvote count: 4
has comment: http://stackoverflow.com/comment/62958647
score: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24086968
type: Answer
has body: In addition to regular expressions, and assuming you actually want to know if the String doesn't contain only characters, you can use Character.isLetter(char) - boolean hasNonLetters = false; for (char ch : s.toCharArray()) { if (!Character.isLetter(ch)) { hasNonLetters = true; break; } } // hasNonLetters is true only if the String contains something that isn't a letter - From the Javadoc for Character.isLetter(char), A character is considered to be a letter if its general category type, provided by Character.getType(ch), is any of the following: UPPERCASE_LETTER LOWERCASE_LETTER TITLECASE_LETTER MODIFIER_LETTER OTHER_LETTER

http://stackoverflow.com/comment/36960514
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23985630
has text: This worked... yet the program don't wanna run. Also, I am not using a .jar file...
type: AnswerComment

http://stackoverflow.com/comment/36979434
score: 0
type: Comment
type: QuestionComment
has text: I closed your question as duplicate but if you think duplicate doesn't explain your problem and you will be able to explain which part it not explained I will reopen your question.
comment on: http://stackoverflow.com/q/23995682

http://stackoverflow.com/comment/36960237
score: 0
type: Comment
has text: @user3502615: I can only guess that it is, `spells[k][1] = image.getSubimage((34*2*k)-34*2,0,34,34);`, that your image variable is null, but **you** should tell us as this is information only **you** have.
comment on: http://stackoverflow.com/a/23985630
type: AnswerComment

http://stackoverflow.com/comment/37107725
type: AnswerComment
comment on: http://stackoverflow.com/a/24064855
type: Comment
has text: +1 That's much more elegant!
score: 2

http://stackoverflow.com/comment/37105802
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24063818
has text: can you please explain us exact compilation error so that we can help you

http://stackoverflow.com/a/24097999
has body: Yes, since you might not want to show the same menus in all your activities, you must tell explicitly that you want to show them in the java code of your activity like you just said. This is if you have created a basic Android Project with the wizard and it created already an Activity, chances are the file you have to add that in is called MainActivity.java inside src/ folder. This is, of course if you didn't change the name of it when prompted.
answers question: http://stackoverflow.com/q/24097804
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/37100681
has text: @Genzotto I didn't write any queries in HQL or JPQL. It's a common SELECT query built by Hibernate. I'm trying to stick with pure JPA, using EntityManager instead of Hibernate Session. I just forgot to mention I'm using Spring Data JPA (but in a CDI environment). This query is generated by the findAll() defined [here](http://docs.spring.io/spring-data/data-commons/docs/current/api/org/springframework/data/repository/CrudRepository.html?is-external=true#findAll()).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23945908

http://stackoverflow.com/comment/37131477
type: Comment
type: QuestionComment
has text: @halex - sorry - bad english)
score: 0
comment on: http://stackoverflow.com/q/24077680

http://stackoverflow.com/q/24006901
tagged with: javascript
score: -1
linked to: http://stackoverflow.com/q/16562173
upvote count: 0
duplicate of: http://stackoverflow.com/q/16562173
answer count: 1
has comment: http://stackoverflow.com/comment/36999865
favorite count: 0
has answer: http://stackoverflow.com/a/24007079
type: UnansweredQuestion
has title: how to avoid IllegalStateException
has comment: http://stackoverflow.com/comment/37000253
has body: &lt;% String emi1; String repo1; String arr1; String reso1; String pi1; emi1=request.getParameter("e"+count); repo1=request.getParameter("repo"+count); arr1=request.getParameter("a"+count); reso1=request.getParameter("r"+count); pi1=request.getParameter("pi"+count); if(emi1!=null &amp;&amp; repo1!=null &amp;&amp; arr1!=null &amp;&amp; reso1!=null &amp;&amp; pi1!=null) { String ReserveDt = request.getParameter("ReserveDate"); System.out.println(emi1); System.out.println(repo1); System.out.println(arr1); System.out.println(reso1); System.out.println(pi1); System.out.println(ReserveDt); String sql=("BEGIN DECLARE @DT DATE;DECLARE @CIR NVARCHAR(2);SET @CIR='"+circle+"' DECLARE @MON NVARCHAR(2); DECLARE @DAY NVARCHAR(2); " +"DECLARE @YEAR NVARCHAR(4);DECLARE @curr NVARCHAR(50); DECLARE @reg nvarCHAR(3);" +"set @reg='"+utype+"' SET @DT='"+ReserveDt+"' SET @day=(SELECT DATEPART(day,@DT)) " +"SET @MON=(SELECT DATEPART(month,@DT)) SET @year=(SELECT DATEPART(year,@DT)) " +"SET @curr=@reg+convert(nvarchar(2),@DAY)+convert(nvarchar(2),@MON)+convert(nvarchar(4),@YEAR)+CONVERT(NVARCHAR(2),@CIR) " +"INSERT INTO [DCRA].[dbo].[SAM]([REGION],[CIRCLE],[TOTAL],[EMI],[REPO],[REPO ARREAR],[RES],[CURR_DATE],[PI],[DATAID]) " +"VALUES (@reg,@CIR,0.24,"+emi1+","+repo1+","+arr1+","+reso1+",'"+ReserveDt+"',"+pi1+",@curr) end"); System.out.println(sql); stmt=con.createStatement(); stmt.executeUpdate(sql); System.out.println(sql); if("stmt"!=null) { response.sendRedirect("Add.jsp"); } } count++; System.out.println(count+"my count"); } } catch(Exception e) { %&gt; &lt;script type="text/javascript"&gt; alert("Data is alredy insert or please check your data!"); &lt;/script&gt; &lt;% e.printStackTrace(); } %&gt; I am very new into jsp , i am inserting the value into table that time it gives me error. I am showing data is added successfully in add.jsp.how to resolve this problem.please help me to resolve this problem.
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/36964523
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23988075
score: 0
has text: I think you have to cast explicity `Account account = (Account)query.getSingleResult()`

http://stackoverflow.com/a/23962867
accepted answer of: http://stackoverflow.com/q/23962798
has body: Try with JComponent#setAlignmentX() method Enclose the anchor inside a div that is aligned to center. JLabel lblWebsite = new JLabel(" Visit lblAbout1 ", BoxLayout.X_AXIS); lblWebsite.setAlignmentX(Component.CENTER_ALIGNMENT); Snapshots:
has comment: http://stackoverflow.com/comment/36917958
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23962798

http://stackoverflow.com/comment/37083202
comment on: http://stackoverflow.com/q/24051548
has text: @ElliottFrisch This is really already the top one.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24087994
accepted answer: http://stackoverflow.com/a/24125823
has title: Eclipse JDT Batch Compiler OutOfMemoryError
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37150912
tagged with: java
tagged with: eclipse-jdt
tagged with: eclipse
type: Question
has body: I'm trying to use a multi-threaded compiler to decrease the duration of our build and I found that the eclipse JDT Batch Compiler does just that. When I switched to the JDT compiler however I'm getting an OutOfMemoryError. Increasing the heap size doesn't help. java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ... Caused by: java.lang.OutOfMemoryError: Java heap space at java.io.BufferedReader.&lt;init&gt;(BufferedReader.java:80) at java.io.BufferedReader.&lt;init&gt;(BufferedReader.java:91) ... Here is the relevant part of our build.xml. &lt;property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/&gt; &lt;javac srcdir="${env.BUILDSRC}" destdir="${env.BUILDBIN}" includeantruntime="false" debug="on" deprecation="no" target="1.6" source="1.6" fork="true" executable="/opt/java/jdk1.6.0_65_64bit/bin/javac" memoryInitialSize="1024M" memoryMaximumSize="2560M" &gt; &lt;compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-1.6"/&gt;
has answer: http://stackoverflow.com/a/24125823
score: 0
tagged with: javac
answer count: 1
has comment: http://stackoverflow.com/comment/37222435

http://stackoverflow.com/comment/36922781
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23965417
score: 0
has text: @ajb False. You can do it using reflection. But you're right about the fact that whatever he wants to achieve - it can be done more easily.

http://stackoverflow.com/comment/36986188
has text: You should provide both the code snippet that is failing and a copy of the stack trace from the logs in the Admin Console.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23998124
type: AnswerComment

http://stackoverflow.com/comment/37179445
comment on: http://stackoverflow.com/q/24102646
score: 1
has text: http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24084140
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37143182
tagged with: java
score: -1
has title: How to delete an entity from entities having same key of appengine datastore in java
tagged with: google-cloud-datastore
upvote count: 0
has answer: http://stackoverflow.com/a/24084406
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37143345
tagged with: google-app-engine
has body: I have entities having same key., How can I delete one of them according to the desired property?
accepted answer: http://stackoverflow.com/a/24084406
has comment: http://stackoverflow.com/comment/37142970
downvote count: 1

htmlunit-driver
tags question: http://stackoverflow.com/q/23949547
type: Tag
tag name: htmlunit-driver

http://stackoverflow.com/comment/36924098
comment on: http://stackoverflow.com/a/23966037
score: 0
type: AnswerComment
type: Comment
has text: @Kigyo looks like scala might be okay after all

http://stackoverflow.com/comment/37117028
type: Comment
type: QuestionComment
has text: does Message extend Comparable?
comment on: http://stackoverflow.com/q/24069733
score: 0

http://stackoverflow.com/comment/37076711
has text: Basically, getRescource uses the class's ClassLoader to try and find a reference to the named resource within the class-path context of the ClassLoader. Depending on how is used, this can use a relative path (to the class) or a absolute path (relative to each class-path entry)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24046924

http://stackoverflow.com/comment/37172287
score: 1
comment on: http://stackoverflow.com/q/24099276
has text: Thanks you a lot. I originally didn't notice that the comment and the answer came from the same user - so I thought you're one of the guys who just randomly comment/downvote when they don't know the answer.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24022455
linked to: http://stackoverflow.com/q/24011490
answer count: 0
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/71128693
upvote count: 7
has comment: http://stackoverflow.com/comment/37075877
type: Question
has comment: http://stackoverflow.com/comment/71132295
tagged with: jersey
downvote count: 0
linked to: http://stackoverflow.com/q/2364110
tagged with: jackson
has comment: http://stackoverflow.com/comment/71109651
has title: How to do JAX-RS partial update with bean validation
linked to: http://stackoverflow.com/q/19732423
has body: It may seem crazy but I'm having trouble with JAX-RS partial JSON requests. For example suppose we have an entity: public class Data { private String a; private String b; private Integer c; /* this is flat and large object with many fields */ } @PUT @Consumes(MediaType.APPLICATION_JSON) @Path("/data") public Response updateData(Data d) { /* update database */ } Now I want to let user update some fields. So user sends request like this: { "a": "data of field a" } This means only update field "a". When user wants to set field "a" to null he will send { "a": null }. The problem is on server side I can't decide Whether client wants to set field "a" to null or there is no field "a" in the request thus I should not touch field "a"(In both cases "a" will be null). One solution is to read Map&lt;String, Object&gt; instead of Data. In this way I can differentiate these two cases, but I will loose bean validation framework plus I should do lots of type casting(Object to String/Integer/List&lt;Integer&gt;). Is there any concise way to handle such partial update requests? I'm using Jersey 2.9 with Jackson 2.3 on Jetty.
tagged with: jax-rs
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/71156920
has comment: http://stackoverflow.com/comment/37031930
has comment: http://stackoverflow.com/comment/71156881

http://stackoverflow.com/a/24090718
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24089740
has body: There are two problems I can see. First, C++ is using uint32_t, and giving you a value of 3,297,211,900. This number is larger than can fit in a signed 32-bit int, and Java uses only signed integers. However, -1,868,221,715 is not equal to 3,297,211,900, even accounting for the difference between signed and unsigned ints. (In Java 8 they have added Integer.toUnsignedString(int), which will convert a signed 32-bit int to its unsigned string representation. In earlier versions of Java, you can cast the int to a long and then mask off the high bits: ((long) i) &amp; 0xffffffffL.) The second problem is that you are using the wrong version of getBytes(). The one that takes no argument converts a Unicode String to a byte[] using the default platform encoding, which may vary depending on how your system is set up. It could be giving you UTF-8, Latin1, Windows-1252, KOI8-R, Shift-JIS, EBCDIC, etc. Never, ever, ever call the no arguments version of String.getBytes(), under any circumstances. It should be deprecated, decimated, defenestrated, destroyed, and deleted. Use s.getBytes("UTF-8") (or whatever encoding you're expecting to get) instead. As the Zen of Python says, "Explicit is better than implicit." I can't tell if there may be any other problems beyond these two.
upvote count: 2
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24089740

http://stackoverflow.com/a/24003644
downvote count: 0
score: 9
type: AcceptedAnswer
type: Answer
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24003631
answers question: http://stackoverflow.com/q/24003631
has body: There is no difference. The \u00E4 is translated to ä at compile time.

http://stackoverflow.com/comment/36978485
type: AnswerComment
score: 1
type: Comment
has text: I am going to try your first approach (using a monitor, if that's the correct terminology?). Great resource here as well: http://www.csc.villanova.edu/~mdamian/threads/javamonitors.html Thanks!
comment on: http://stackoverflow.com/a/23959107

http://stackoverflow.com/comment/37189792
type: Comment
type: QuestionComment
has text: Ok, trying to simplfy, I've created a very simple project.... The application only java file contains: [code]package helloworldJava; public class clsMain { // Native routine to receive data from the specified serial device private static native int openDevice(String strDevice, int intBaudRate, int intRx); private static native byte[] readDevice(int intFD, int intExpectedLength, int intDebug); public static void main(String[] args) { System.out.println("Hello World Java!"); } }[/code]
score: 0
comment on: http://stackoverflow.com/q/23982687

http://stackoverflow.com/a/23992967
accepted answer of: http://stackoverflow.com/q/23991546
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37008856
score: 1
has comment: http://stackoverflow.com/comment/36973703
has comment: http://stackoverflow.com/comment/36974221
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36975283
has comment: http://stackoverflow.com/comment/36974052
has body: Starting from the v0.10.0, the installation steps have changed and the datatables-servlet2 extra, in which leaved the old DatatablesFilter class you've mentionned, no longer exist. First of all, ensure to have declared all needed components in your web.xml file, especially DandelionFilter and DandelionServlet. Installation guides here. A migration guide from 0.9.x to 0.10.x has also been written. Regarding the export features, it seems you've preferred the filter-based export. In this situation, you have to update your web.xml file as well: datatables com.github.dandelion.datatables.core.web.filter.DatatablesFilter datatables /* Read more here about the requirements when using filter-based exports. By default, the datatables-core JAR provides utility classes for XML and CSV formats. If you want to export in PDF, XLS or XLSX formats, other utilities exist, located in different extras. See the new introduction about export feature here. Of course, in order to avoid any other dependency issue, I strongly recommend to use a build tool, such as Maven or Gradle. (Disclaimer required by StackOverflow: I'm the author of Dandelion)
downvote count: 0
answers question: http://stackoverflow.com/q/23991546
has comment: http://stackoverflow.com/comment/36980210

http://stackoverflow.com/comment/36925726
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23967238
type: Comment
has text: @jasonadams - You need to have a thorough look at this code, I have made some edit. You need to compare using ==.

http://stackoverflow.com/comment/37002597
score: 0
type: Comment
type: QuestionComment
has text: reading all of data from file in 1 go will eventually "store all your file data in memory'. Also like EJP said, you cant use `BufferedReader` to read in binary files. `Reader` class of File IO is meant for character based streams. you should use `BufferedInputStream` instead.
comment on: http://stackoverflow.com/q/24007579

http://stackoverflow.com/a/24131143
score: 0
accepted answer of: http://stackoverflow.com/q/24082890
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24082890
type: Answer
has body: Ok, I finally solve this issue. The problem was the file used to populate the database was using INSERT with the indication of the primary key. I remove this reference to let the hibernate handle this, and now all is working fine.

http://stackoverflow.com/a/27611782
has body: Maybe you should consider Forge 2, as Forge 1 is no more developed actively? After you install it and run it on the command line, you can install the picketlink addon (the new term for plugins if Forge 2) with the following command: addon-install --coordinate org.picketlink.tools.forge:picketlink-forge-addon,1.0.0.Final Cheers, Ivan
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24009810
downvote count: 0

http://stackoverflow.com/a/24046411
score: 9
upvote count: 9
has body: The javadoc states Returns the class loader for the class. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader. So the Throwable class was loaded by the bootstrap class loader in your JVM implementation.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24046386
type: Answer
answers question: http://stackoverflow.com/q/24046386

http://stackoverflow.com/q/24005405
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1442493
has title: Error: Could not find or load main class ReadFile recieved when attempting to run code
has answer: http://stackoverflow.com/a/24005500
duplicate of: http://stackoverflow.com/q/1442493
has comment: http://stackoverflow.com/comment/36997322
type: Question
has comment: http://stackoverflow.com/comment/36997176
has comment: http://stackoverflow.com/comment/36997289
has comment: http://stackoverflow.com/comment/36997515
score: 0
tagged with: java
has body: When I run some code I have compiled (with no errors) I receive the following error: Error: Could not find or load main class ReadFile The code I am trying to run is the file ReadFile.java: import java.io.IOException; import java.io.FileReader; import java.io.BufferedReader; public class ReadFile { public static void main(String[] args) throws IOException { String file_name = "hello.txt"; try { ReadFile file = new ReadFile(file_name); String[] aryLines = file.OpenFile(); int i; for (i=0; i&lt;aryLines.length; i++) { System.out.println(aryLines[i]); } } catch (IOException e) { System.out.println(e.getMessage() ); } } private String path; public ReadFile(String file_path) { path = file_path; } public String[] OpenFile() throws IOException { FileReader fr = new FileReader(path); BufferedReader textReader = new BufferedReader(fr); int numberOfLines = readLines(); String[] textData = new String[numberOfLines]; int i; for (i=0;i&lt;numberOfLines;i++) { textData[i] = textReader.readLine(); } textReader.close(); return textData; } int readLines() throws IOException { FileReader file_to_read = new FileReader(path); BufferedReader bf = new BufferedReader(file_to_read); String aLine; int numberOfLines = 0; while (( aLine = bf.readLine()) != null) { numberOfLines++; } bf.close(); return numberOfLines; } } and hello.txt is as follows: Hello World Hello Solar System Hello Galaxy I am a beginner and am not sure why I am returned with this error, can anyone help?
has comment: http://stackoverflow.com/comment/36997233
has comment: http://stackoverflow.com/comment/36997200
accepted answer: http://stackoverflow.com/a/24005500
answer count: 1
has comment: http://stackoverflow.com/comment/36997585

messaging
tags question: http://stackoverflow.com/q/23944595
tag name: messaging
type: Tag

http://stackoverflow.com/comment/37113895
comment on: http://stackoverflow.com/a/24067726
score: 0
type: AnswerComment
has text: Thanks. Yes, param comes from an html form. My bad. But, I used both the methods you gave and i still don't get my list of products. Please help me to fix it.
type: Comment

http://stackoverflow.com/a/56546464
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/120947418
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24104313
has body: I know this is a very old post but this may help someone: You can create a method, so whenever you need to pause you can type pause(1000) or any other millisecond value: public static void pause(int ms) { try { Thread.sleep(ms); } catch (InterruptedException e) { System.err.format("InterruptedException : %s%n", e); } } This is inserted just above the public static void main(String[] args), inside the class. Then, to call on the method, type pause(ms) but replace ms with the number of milliseconds to pause. That way, you don't have to insert the entire try-catch statement whenever you want to pause.

http://stackoverflow.com/comment/36910539
has text: Note that [ZonedDateTime](http://docs.oracle.com/javase/8/docs/api/java/time/ZonedDateTime.html) already *has* the `getEpochSecond` method (via [ChronoZonedDateTime default](http://docs.oracle.com/javase/8/docs/api/java/time/chrono/ChronoZonedDateTime.html#toEpochSecond--)). No need for the `Instant`.
type: AnswerComment
type: Comment
score: 6
comment on: http://stackoverflow.com/a/23945792

http://stackoverflow.com/comment/36922069
comment on: http://stackoverflow.com/a/23964946
has text: A static instance of Property? Good idea. I never thought of that.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/q/24081941
has title: JTable fill data with JComboBox
has answer: http://stackoverflow.com/a/24084696
has answer: http://stackoverflow.com/a/24083888
tagged with: jcombobox
accepted answer: http://stackoverflow.com/a/24083888
has answer: http://stackoverflow.com/a/24081998
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jtable
possible better answer: http://stackoverflow.com/a/24081998
has body: I have a frame with table,combobox, i want to fill the table with data from database by combobox, but if i use with itemlistener i dont see the table, without itemlistener and String sql="select * from Arlista" then i see my table with data (combob=combobox) combob.addItemListener(new ItemListener(){ @Override public void itemStateChanged(ItemEvent e){ tesztvalt=(combob.getSelectedItem()).toString(); if (e.getItem().equals(tesztvalt)) { try { Class.forName( driver ); Connection connection = DriverManager.getConnection( url ); String sql="select * from "+tesztvalt+""; Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery( sql ); ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); while (rs.next()) { Vector row = new Vector(columns); for (int i = 1; i &lt;= columns; i++) { row.addElement( rs.getObject(i) ); } data.addElement( row ); } rs.close(); stmt.close(); connection.close(); }catch(Exception ex) { System.out.println( e ); } JTable table = new JTable(data, columnNames) { public Class getColumnClass(int column) { for (int row = 0; row &lt; getRowCount(); row++) { Object o = getValueAt(row, column); if (o != null) { return o.getClass(); } } return Object.class; } }; JScrollPane scrollPane = new JScrollPane( table ); getContentPane().add( scrollPane ); JPanel buttonPanel = new JPanel(); getContentPane().add( buttonPanel, BorderLayout.SOUTH ); } } });
linked to: http://stackoverflow.com/q/1107911
score: 0
answer count: 3
tagged with: jdbc

http://stackoverflow.com/a/24093524
type: Answer
has comment: http://stackoverflow.com/comment/37161380
answers question: http://stackoverflow.com/q/24093488
score: 2
has comment: http://stackoverflow.com/comment/37161462
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/37161322
has body: The fundamental difference between a for loop and an enhanced-for loop is that the enhanced-for loop actually binds the values of the array to the variable itself. So, your enhanced-for is pulling this on each iteration: i = 1 i = 2 i = 3 i = 4 i = 5 // this is the size of your array Enhanced for loops aren't meant for changing values. You would use a normal for loop for that.

http://stackoverflow.com/comment/37175968
comment on: http://stackoverflow.com/q/24101263
score: 0
type: QuestionComment
type: Comment
has text: `System.out` flushes on newlines by default. Lots of your prints are probably not flushing.

http://stackoverflow.com/q/24009249
answer count: 1
score: -6
favorite count: 0
type: UnansweredQuestion
has title: matrix program using one dimensional array in java
has comment: http://stackoverflow.com/comment/37004374
downvote count: 6
has comment: http://stackoverflow.com/comment/37004340
tagged with: java
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/37004217
has body: I want to write a matrix multiplication program in java using one dimensional array,but using two dimensional array values ? i want to know how to program it ? package group1; import java.util.Scanner; public class multiplication { public static void main(String[] args) { int m,n,p,q,sum=0,c,d,k,s; Scanner scan=new Scanner(System.in); System.out.println("enter the num of rows and columns:"); m=scan.nextInt(); n=scan.nextInt(); int first[] =new int[m*n]; System.out.println("enter the value of first matrix"); for(c=0;c&lt;m*n;c++){ first[c]=scan.nextInt(); } System.out.println("enter the num of rows and columns second matrix"); p=scan.nextInt(); q=scan.nextInt(); int second[] = new int[p*q]; int answer[] = new int[c]; System.out.println("enter the elements of second matrix"); for(c=0;c&lt;p*q;c++){ second[c]=scan.nextInt(); } for(c=0;c&lt;m;c++){ for(d=0;d&lt;n;d++) for(k=0;k&lt;4;k=k+4){ sum=sum+first[d]*second[k]; //sum=sum+first[c]*second[c+3]; } answer[c]=sum; sum=0; } System.out.println("The product is "); for(c=0;c&lt;m*q;c++){ System.out.print(answer[c] +"\t"); System.out.println(""); } } } i tried like this but i am getting error somebody tell me how to do it or the program itself
has answer: http://stackoverflow.com/a/24011421

http://stackoverflow.com/q/23950235
has answer: http://stackoverflow.com/a/23954010
has answer: http://stackoverflow.com/a/23988474
tagged with: sonarqube
has body: I am using SonarQube 4.2 with sonar-java-plugin-2.2.1. I am trying to deploy a custom rule based on the BaseTreeVisitor (https://github.com/SonarSource/sonar-examples/blob/master/plugins/java-custom-rules/src/main/java/org/sonar/samples/java/ExampleCheck.java). I am using gradle(not maven) to create jar (containing ExampleCheck) and than I copy this jar to sonarqube-4.2/extensions/plugins. I expected to see ExampleCheck rule (with key nomethod)in the in/active rules after sonar will get up. But no such rule appears. On the page http://docs.sonarqube.org/display/SONAR/Extending+Coding+Rules is nothing about deployment to the Sonarqube. Is anything on above described deployment wrong? How to deploy ExampleCheck rule to SonarQube 4.2 ?
upvote count: 2
has comment: http://stackoverflow.com/comment/42076427
answer count: 2
has title: SonarQube Java plugin custom rule - deploy
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: gradle
type: Question

http://stackoverflow.com/q/23998751
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: How to use Parcelable for a class which has multiple constructors?
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/36984744
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36985017
type: Question
has answer: http://stackoverflow.com/a/66576652
has answer: http://stackoverflow.com/a/24020753
has body: Well, i was trying to pass arraylist of objects from one activity to another. I have 2 constructors in the class Student. If, i use, Serializable than the code is like below: @SuppressWarnings("serial") public class Student implements Serializable { private int studentdID; private String studentName; private String studentDept; public Student(){} public Student(String name, String dpt) { this.studentName = name; this.studentDept = dpt;} public Student(int id, String name, String dpt) { this.studentdID = id; this.studentName = name; this.studentDept = dpt; } public int getstudentdID() { return studentdID; } public void setstudentdID(int studentdID) {this.studentdID = studentdID;} public String getstudentName() { return studentName;} public void setstudentName(String studentName) {this.studentName = studentName;} public String getstudentDept() { return studentDept; } public void setstudentDept(String studentDept) { this.studentDept = studentDept;} } But the problem i am facing is that how am i going to do this with parcelable? How am i going to set the values of the variables in class-like i did with Serializable? I mean separately using 2 constructors-one without ID another without the ID?
tagged with: parcelable
has answer: http://stackoverflow.com/a/23998934
answer count: 3

http://stackoverflow.com/comment/122134517
type: Comment
comment on: http://stackoverflow.com/a/44950496
score: 0
type: AnswerComment
has text: How is this an answer? It's a comment.

http://stackoverflow.com/a/24096493
upvote count: 28
type: Answer
has comment: http://stackoverflow.com/comment/37172914
answers question: http://stackoverflow.com/q/24096421
has comment: http://stackoverflow.com/comment/93353852
has comment: http://stackoverflow.com/comment/37170244
score: 23
has comment: http://stackoverflow.com/comment/93069976
downvote count: 5
has comment: http://stackoverflow.com/comment/92716920
accepted answer of: http://stackoverflow.com/q/24096421
has comment: http://stackoverflow.com/comment/92441252
has body: C# extension methods are just syntactic sugar for static methods that take the extended type as first argument. Java default methods are something completely different. To mimic C# extension methods, just write usual static methods. You will not have the syntatic sugar, however; Java does not have this feature. Java default methods are real virtual methods. For example, they can be overridden. Consider a class X inheriting from an interface I that declares a default foo() method. If X or any of its super classes declares no own foo() method, then X will get the foo() implementation of I. Now, a subclass Y of X can override X.foo() like a usual method. Thus, default methods are not only syntactic sugar. They are real extensions of the method overriding and inheritance mechanism that cannot be mimicked by other language features. Default methods even require special VM support, so they are not even a compiler only feature: During class loading, the hierarchy of a class has to be checked to determine which default methods it will inherit. Thus, this decision is made at runtime, not at compile time. The cool thing about it is that you do not have to recompile a class when an interface it inherits gets a new default method: The VM will, at class load time, assign that new method to it.
type: AcceptedAnswer

http://stackoverflow.com/comment/36906009
type: QuestionComment
has text: Uppercase letters _are_ ordered before lowercase letters, due to having lower character values. `System.out.println("A".compareTo("a"))` will return a negative value. What is it you are looking for?
score: 2
comment on: http://stackoverflow.com/q/23956618
type: Comment

http://stackoverflow.com/q/24076767
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/24076792
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24076790
score: 1
has answer: http://stackoverflow.com/a/24076790
upvote count: 1
type: Question
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/37130535
accepted answer: http://stackoverflow.com/a/24076792
has body: I try to show listView in fragment. But method setListAdapter - is not resolved. I think, that i must to get id of listView (android.R.id.list); and then : lv.setAdapter(mAdapter);but its dont work too. public class MyEmployeeFragment extends Fragment { private CustomAdapter sAdapter; private List<User> userList; ProgressDialog mProgressDialog; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); userList = new ArrayList<User>(); sAdapter = new CustomAdapter(getActivity(),userList); setListAdapter(sAdapter); new CustomAsync().execute(); } private class CustomAdapter extends ArrayAdapter<User> { private LayoutInflater inflater; public CustomAdapter(Context context, List<User> objects) { super(context, 0, objects); inflater = LayoutInflater.from(context); } class ViewHolder { TextView id; TextView name; TextView lastName; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vH; if (convertView == null) { convertView = inflater.inflate(R.layout.list_item_employee, null); vH = new ViewHolder(); vH.id = (TextView) convertView.findViewById(R.id.tv_employee_id); vH.name = (TextView) convertView.findViewById(R.id.tv_employee_name); vH.lastName = (TextView) convertView.findViewById(R.id.tv_employee_last_name); convertView.setTag(vH); } else vH = (ViewHolder) convertView.getTag(); final User user = getItem(position); vH.id.setText(user.getId()); vH.name.setText(user.getName()); vH.lastName.setText(user.getLastName()); return convertView; } } private class CustomAsync extends AsyncTask<Void,Void,List<User>> {} } XML <?xml version="1.0" encoding="utf-8"?> <ListView android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:divider="#B7B7B7" /> <ProgressBar style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" andr…
has answer: http://stackoverflow.com/a/63205428
has comment: http://stackoverflow.com/comment/37129754
downvote count: 0
has comment: http://stackoverflow.com/comment/37130695
favorite count: 0
has title: Cannot resolve method setListAdapter
has answer: http://stackoverflow.com/a/24076901

http://stackoverflow.com/comment/36921372
comment on: http://stackoverflow.com/a/23964689
has text: I see I'm missing something. I understand the meaning of binary - however - why is it a binary operator? All I've said is stream the divisors and do a sum += operation on them. What does the other input represent exactly?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24057023
has answer: http://stackoverflow.com/a/24057250
downvote count: 0
has title: Spring MVC: autowire ignored in servlets
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/37093152
has body: For some reasons, I can autowire in my controllers but not in a servlet I created. This is the top part of my servlet: @Component public class MyServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { @Autowired private CobiService cobiService; In my web.xml this is the related configuration: convservlet com.gim.servlets.MyServlet convservlet /MyServlet And this is the way I tell spring to scan for components: <context:component-scan base-package="com.gim" /> For some reason my autowired object cobiService is null. Did I forget anything? What should I change?
has answer: http://stackoverflow.com/a/24057157
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/24057355
tagged with: model-view-controller
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24057250
has comment: http://stackoverflow.com/comment/37093214
tagged with: servlets
type: Question
possible better answer: http://stackoverflow.com/a/24057157

http://stackoverflow.com/q/24054031
upvote count: 3
tagged with: nokia-s40
tagged with: java-me
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37978777
has body: While we are trying to access API's through HTTP/HTTPS we are getting exception with the below message. But we are trying the same URL's in other platforms (LUMIA) we are getting proper response and not getting any errors. While we are searching we found this issue is related to SSL but we could not find any more details or solutions to resolve the same. Please help us to resolve this issue. Please find the details below: Tested platform/Device: Nokia Asha Softwate Platform 1.0, 1.1/ Asha 501 **Exception arised while try:** java.io.IOException: Alert (2,40)type:22 at com.sun.midp.ssl.RecordReader.rdRec(), bci=224 at com.sun.midp.ssl.Handshake.getNextMsg(), bci=10 at com.sun.midp.ssl.Handshake.rcvSrvrHello(), bci=2 at com.sun.midp.ssl.Handshake.doHandShake(), bci=25 at com.sun.midp.ssl.SSLStreamConnection.&lt;init&gt;(), bci=163 at com.sun.midp.io.j2me.https.Protocol.connect(), bci=245 at com.sun.midp.io.j2me.http.Protocol.streamConnect(), bci=48 at com.sun.midp.io.j2me.http.Protocol.startRequest(), bci=7 at com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=41 at com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=3 at com.sun.midp.io.j2me.http.Protocol.getResponseCode(), bci=5 - com.ascenso.jumia.network.HttpClient.sendRequest(HttpClient.java:157) - com.ascenso.jumia.network.HttpClient.run(HttpClient.java:415) at java.lang.Thread.run(Thread.java:723)
type: Question
score: 3
tagged with: java
has title: Nokia Asha / J2me SSL Certification Error for Http request
tagged with: ssl
tagged with: nokia
favorite count: 0

lightadmin
tags question: http://stackoverflow.com/q/23996776
type: Tag
tag name: lightadmin

http://stackoverflow.com/comment/37118088
has text: @AndonM.Coleman thank you very much for your answer and voithos for the added help, can you right your reply in an answer and i will accept it. I have tested it and it is now very smooth so i am very happy with that. Almost a bit disapointed at my self for not getting that on my own :-(
score: 0
comment on: http://stackoverflow.com/q/24069880
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23986793
has comment: http://stackoverflow.com/comment/36962165
upvote count: 1
has comment: http://stackoverflow.com/comment/36962198
downvote count: 1
has body: This is my first time posting, and hopefully I'm posting correctly. I'm currently playing a background song for my project, and I'm trying to play a sound effect, when a button is pressed, on top of the background song. However, the sound doesn't play and the bgm just continues. See below for my Audio class (ignore the bad commenting), and thanks in advance for the help. package pro; import java.io.IOException; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; public class Audio { private boolean loop = false; private AudioInputStream ais = null; private static Clip clip = null; //declaration of variables public Audio (String fileName, boolean loop) //Constructor for the class which fileName and accepts whether the clip needs to loop or not { this.loop = loop; //sets the variable within the class as constructor try { clip = AudioSystem.getClip(); ais = AudioSystem.getAudioInputStream(Audio.class.getResource(fileName)); clip.open(ais); } catch (IOException | UnsupportedAudioFileException | LineUnavailableException e) { e.printStackTrace(); } //tries to load file into java's built in audio player, else prints the error to console } public void musicStart () //starts music { if (loop) { clip.loop(Clip.LOOP_CONTINUOUSLY); //starts music on loop if loop is requested } else { clip.start(); //starts music as not on loop } } public void musicStop () //stops the music { clip.stop(); } } EDIT: I found a solution to the problem thanks to MadProgrammer by simply removing static from clip.
has comment: http://stackoverflow.com/comment/36962126
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23986931
favorite count: 0
type: Question
tagged with: javasound
answer count: 1
tagged with: audio
has title: Java - Playing a sound on top of background music
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23986931

http://stackoverflow.com/comment/37147700
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24064598
has text: I might have misused the word "synchronous". I should have said "blocking". What I meant, is that whatever `a.getData()` does, using `Futures.immediateFuture(a.getData())` will block until `getData()` returns. The code inside `getData()` itself might be asynchronous, call a WS on the other side of the planet asynchronously, but if it's not returning a future, it will block. In such a case, using an AsyncFunction is useless.

http://stackoverflow.com/q/24055854
score: 1
favorite count: 0
has title: xercesJ for XSD 1.1: Validator correctly processes assertions, SAXParser apparently does not
has body: I'm building for my java project an xml validator with xerces-2_11_0-xml-schema-1.1-beta libraries, in order to support XSD 1.1 specific features, like assertions. Considering this schema <?xml version="1.1" encoding="UTF-8"?> <assert test="starts-with(@partnumber,../@partnumber)"/> I started using the "javax.xml.validation.Validator" class ... StreamSource xmlSource = new StreamSource(new File("example.xml")); SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1"); Schema s = sf.newSchema(new File("example.xsd")); Validator v = s.newValidator(); v.setErrorHandler(new MyErrorHandler()) v.validate(xmlSource) ... private static class MyErrorHandler extends DefaultHandler { ... public void error(SAXParseException e) throws SAXException { System.out.println("Error: "); System.out.println(" Public ID: "+e.getPublicId()); System.out.println(" System ID: "+e.getSystemId()); System.out.println(" Line number: "+e.getLineNumber()); System.out.println(" Column number: "+e.getColumnNumber()); System.out.println(" Message: "+e.getMessage());; } ... } This solution works: the assertion test in example.xsd is processed correctly and validation of xml files run smoothly (assertion tests are correctly evaluated) Then I replaced the Validator with a SAXParser (reason: to have a better control over the sax parsing stage) ... SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1"); Schema s = sf.newSchema(new File("example.xsd")); SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setSchema(s); spf.setNamespaceAware(true); spf.setValidating(true); spf.setFeature("http://apache.org/xml/features/validation/schema", true); SAXParser parser = spf.newSAXParser(); XMLReader r = parser.getXMLReader(); r.setErrorHandler(new MyErrorHandler()) r.parse("example.xml"); ... In this second case, the parse stage encounters an error on the xsd "assert" clause, with this message: s4s-elt-invalid-content.1: The content of 'NodeType' is i…
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24056386
tagged with: validation
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36974062
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23993157
has text: @user61026 that doesn't tell me how it calls either of the other two methods, or how you ensure that draw() is not called until water() has updated the value.
score: 0

http://stackoverflow.com/comment/37001897
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24008030
has text: Thanks but the output is not in the right form. Eg, it gives -3 instead of 0.001

http://stackoverflow.com/q/24042225
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24044815
type: Question
tagged with: eclipse
tagged with: aspectj
answer count: 1
has title: AspectJ - weaving jdk and non-jdk classes - NoClassDefFoundError
has body: I have three projects setup in eclipse, 1) aspects_project - this AspectJ project contains an aspect 'testaspect' I want to weave into certain JDK classes and also the classes within application_project 2) application_project - this project has aspects_project on its Aspect Path. 3) jdk_project - this project has aspects_project on its Aspect Path and classes.jar on its InPath. It is set to output classes_weaved.jar When I run application_project with classes_weaved.jar preprended to the bootclasspath, the weaved advice in classes of application_project works fine but the advice weaved into the jdk classes gives me the runtime error: Exception in thread "main" java.lang.NoClassDefFoundError: testaspect So the advice weaved into jdk classes cannot find the aspect class that contains the advice.

http://stackoverflow.com/comment/37172322
score: 0
has text: @Pshemo it just returns "2"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24099456

http://stackoverflow.com/q/24002545
favorite count: 0
has body: I'm using Play Framework 2.3 (Java) and MySQL. I'm building a notification system that reads from a "notifications" table in MySQL. I've tried using AJAX polling where a request is sent asynchronously every 30 seconds, the table is read and if any new notifications exist, are sent via JSON back to the client. However, the performance is concerning, especially with many concurrent users. What's the best way to build such a system? Are there any particular Java libraries that would work well for this? Thanks in advance.
upvote count: 1
answer count: 1
has title: HTML Web Application Notification System
tagged with: java
has answer: http://stackoverflow.com/a/24002606
downvote count: 0
tagged with: javascript
type: UnansweredQuestion
score: 1
tagged with: ajax
tagged with: notifications
type: Question
tagged with: web

http://stackoverflow.com/q/24007558
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37001196
has comment: http://stackoverflow.com/comment/37001100
type: Question
has body: I am trying to profile remote JVM using VisualVM. I have a remote production ubuntu machine on which my Java application is running and that's what I need to profile. I was following this tutorial to profile a remote server. I started jstatd on my ubuntu production machine like this - root@productionMachineA:/home/david# /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/jstatd -J-Djava.security.policy=permissions.txt -J-Djava.rmi.server.hostname=100.41.76.19 -J-Djava.rmi.server.logCalls=true -J-Djava.net.preferIPv4Stack=true Here 100.41.76.19 is the IP Address of my production ubuntu machine. After starting jstatd on the ubunut machine, I did - netstat -nlp | grep jstatd And I can see this - root@productionMachineA:~$ netstat -nlp | grep jstatd tcp 0 0 0.0.0.0:1099 0.0.0.0:* LISTEN 32103/jstatd tcp 0 0 0.0.0.0:60707 0.0.0.0:* LISTEN 32103/jstatd which looks to me jstatd is running fine I guess. Now I opened VisualVM on my desktop, right click on Remote and select Add Remote Host, and finally type the IP address of the production machineA. And afterwards I don't see anything happening on VisualVM which makes me think something is wrong for sure. Can anyone tell me what's wrong and what are the things I should try on? If anyone can provide steps by steps what I am supposed to do then it will be of great help. Update:- After adding port 1099 on my remote connection. I got this error. Cannot connect to 100.41.76.19 using service:jmx:rmi..... From my local desktop, I tried telnet on remote machine on port 1099 and this is what I got - david@localDesktop ~ $ telnet 100.41.76.19 1099 david@localDesktop ~ $
has comment: http://stackoverflow.com/comment/37001251
has title: How to profile remote ubuntu JVM using VisualVM?
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/37001213
has comment: http://stackoverflow.com/comment/37001382
tagged with: profiling
downvote count: 0
has comment: http://stackoverflow.com/comment/37001403
favorite count: 0
has comment: http://stackoverflow.com/comment/37001146
tagged with: visualvm
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/24111459
type: Answer
has body: You can override the root element of the XML output using the ObjectWriter.withRootName method. Here is example: public class JacksonXmlMapper { public static void main(String[] args) throws JsonProcessingException { Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("field1", "v1"); map.put("field2", 10); XmlMapper mapper = new XmlMapper(); System.out.println(mapper .writer() .withRootName("root") .writeValueAsString(map)); } } Output: v1 10
upvote count: 27
downvote count: 0
score: 27
answers question: http://stackoverflow.com/q/24070531
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24070531

http://stackoverflow.com/a/23950038
downvote count: 1
has comment: http://stackoverflow.com/comment/36893549
has comment: http://stackoverflow.com/comment/36925151
score: 1
answers question: http://stackoverflow.com/q/23949978
has comment: http://stackoverflow.com/comment/36893466
type: Answer
upvote count: 2
has body: You should start your second loop from i+1, because in every iteration for j loop the i value will be equal to j and it will satisfy the equals condition .... public static void removeDuplicates(ArrayList&lt;String&gt; list) { for(int i = 0; i &lt; list.size(); i++) { String s = list.get(i); for(int j = i+1; j &lt; list.size(); j++) { String s2 = list.get(j); if(s2.equals(s)) { list.remove(j + 1); j--; //Subtract one as j+1 element is removed from list and index changes } } } }

http://stackoverflow.com/comment/37118804
type: Comment
comment on: http://stackoverflow.com/a/24036559
has text: Can I put everything in an Android Dialog? Are there any limitations?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24056118
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24056181
accepted answer: http://stackoverflow.com/a/24056181
has body: I would like to know if there is a way to detect if changes in the selection of a item in a swing JCombobox is done by a user (actively) or is causes by repopulating the Jcombobox. I have to dynamically repopulate the items of the combobox based on other selection, this also invokes the actionPerformed event so actionPerformed is invoked by: selection changed by user repopulating the jcombobox items. how to tell the difference? Thanks of helping !
answer count: 1
downvote count: 0
favorite count: 0
tagged with: events
tagged with: jcombobox
type: AnsweredQuestion
has title: Swing Dynamical JCombobox detect selection change by user
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/23944378
favorite count: 0
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23944731
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23944731
has title: using DeleteLocalRef on references from jni's CallStaticObjectMethod
tagged with: java-native-interface
upvote count: 1
answer count: 1
has body: I get that the NewStringUTF creates a local reference, but I can't seem to find a convincing source online that says otherwise about CallStaticObjectMethod etc. Do these need to be given the DeleteLocalRef treatment? I mean, I saw that it's okay to just leave it until the native function returns to the java caller, but is it wrong to call DeleteLocalRef on these CallStaticObjectMethod return values?

http://stackoverflow.com/a/27451115
has body: sorry for your trouble but I'm with NetBase and can explain what's going on. Our API does not allow the creation of a topic. The topic has to be created through the user interface. From there the API can be called to retrieve the net sentiment, passion intensity, and other metrics about that brand. We like to go over this with developers who use our API, but unfortunately it looks like you didn't get that proper introduction.
score: 0
answers question: http://stackoverflow.com/q/23988212
type: Answer

http://stackoverflow.com/a/24071417
has comment: http://stackoverflow.com/comment/37121005
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37120106
has comment: http://stackoverflow.com/comment/37120250
downvote count: 0
has body: I'd get the 64-bit version. Your client's version is largely immaterial, although it might matter if your application includes an Applet or is stand-alone. But, that's a deployment concern and not a development concern (Windows, Linux or Mac - Java is "Write Once, Run Anywhere"1). 1 Very nearly anyway.
answers question: http://stackoverflow.com/q/24071370
type: Answer

http://stackoverflow.com/q/24044847
accepted answer: http://stackoverflow.com/a/24045522
score: 1
tagged with: java
tagged with: listview
type: Question
has comment: http://stackoverflow.com/comment/37070960
has body: So, right now I have an activity that populates a ListView with dummy entries. I then set an OnScrollListener to the list. This works fine. Code: public class MainActivity extends ActionBarActivity { ListView listView; ArrayList&lt;Location&gt; arrayOfLocations; LocationAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); listView = (ListView) findViewById(R.id.listView1); // progress = (ProgressBar) findViewById(R.id.progressbar_loading); progress = new ProgressDialog(this); // Construct the data source arrayOfLocations = new ArrayList&lt;Location&gt;(); // Create the adapter to convert the array to views adapter = new LocationAdapter(this, arrayOfLocations); adapter.add(new Location(null, "Title", null, null, null)); adapter.add(new Location(null, "Title", null, null, null)); adapter.add(new Location(null, "Title", null, null, null)); adapter.add(new Location(null, "Title", null, null, null)); adapter.add(new Location(null, "Title", null, null, null)); adapter.add(new Location(null, "Title", null, null, null)); adapter.add(new Location(null, "Title", null, null, null)); listView.setAdapter(adapter); listView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { // TODO Auto-generated method stub } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); } } Then, inside of onScroll, I put if (listView.getLastVisiblePosition() == listView.getAdapter().getCount() - 1 &amp;&amp; listView.getChildAt(listView.getChildCount() - 1).getBottom() &lt;= listView.getHeight()) { Toast.makeText(getApplicationContext(), "Bottom!", Toast.LENGTH_LONG).show(); } Here, I am detecting the end of the current displayed entries and then display "Bottom!" but I get an error and my app crashed Any ideas why? Thanks guys **EDIT: ** Here is the logca…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37071592
has answer: http://stackoverflow.com/a/24045522
tagged with: android
has title: Null Pointer Exception when trying to detect end of ListView in Android app
favorite count: 0
has comment: http://stackoverflow.com/comment/37071575
upvote count: 1
has comment: http://stackoverflow.com/comment/37071699
type: AnsweredQuestion

http://stackoverflow.com/q/24055975
answer count: 1
tagged with: multicast
has answer: http://stackoverflow.com/a/24112619
accepted answer: http://stackoverflow.com/a/24112619
tagged with: sockets
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37171728
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37157369
tagged with: multicastsocket
has title: UDP Multicast with Java: Message cannot be received by entire multicast group
has comment: http://stackoverflow.com/comment/37110584
score: 0
has body: I am trying to understand how multicast works, thus I am experimenting with it a bit. Situation I built a simple server which has a MulticastSocket, listening on port 1250. It simply echoes the message it receives. Next I built a simple client, also with a MulticastSocket, listening on port 4711. It sends a String-Message to the server and waits for any message that comes back. Expected behaviour I want two or more clients send their own unique message to the server and receive all responses the server sends back to the multicast group listening on port 4711. Observed behaviour / Problem As soon as I start more than one instance of the client, all responses from the server are only received by the first client that joined the group. All other clients that joined the multicast group on port 4711 do not receive anything. Why is this and how can I solve the problem? The result looks like this (you can see that only the process MulticastEchoClient2 receives the server's response): Code Server-Code public class MulticastEchoServer { public static void main(String[] args) { if (args.length != 2) { System.out.println("Wrong usage of parameters! &lt;MulticastAddress&gt;&lt;id&gt;"); return; } UDPMulticastSocket socket = null; String id = args[1]; try { socket = new UDPMulticastSocket(1250); System.out.println("Socket created..."); socket.join(args[0]); while(true) { String msg = socket.receive(1024); System.out.println("Message received: " + msg + " from " + socket.getSenderAddress() + ":" + socket.getSenderPort()); if (msg.toLowerCase().equals("quit")) { System.out.println("Shutting down..."); break; } socket.reply("Reply from " + id + " -&gt; " + msg); } socket.leave(args[0]); } catch(Exception e) { e.printStackTrace(); } if (socket != null) { socket.close(); System.out.println("Shutting down..."); } } } Client Code public class MulticastEchoClient { public final static int MESSAGES = 10000; public static void main(String[] args) { if (args.length != 3) { System.out.print…
has comment: http://stackoverflow.com/comment/37096081
tagged with: udp

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/24033787
tags question: http://stackoverflow.com/q/23950372
tags question: http://stackoverflow.com/q/24006446
tags question: http://stackoverflow.com/q/23960055
tags question: http://stackoverflow.com/q/24027314
tags question: http://stackoverflow.com/q/23984043
tags question: http://stackoverflow.com/q/23979065
tags question: http://stackoverflow.com/q/23989490
tags question: http://stackoverflow.com/q/24032301
tags question: http://stackoverflow.com/q/24087573
tags question: http://stackoverflow.com/q/23945433
tags question: http://stackoverflow.com/q/24062816
tags question: http://stackoverflow.com/q/24020379
tags question: http://stackoverflow.com/q/23974970
type: Tag
tags question: http://stackoverflow.com/q/24096386
tags question: http://stackoverflow.com/q/23944245
tags question: http://stackoverflow.com/q/24104642
tags question: http://stackoverflow.com/q/23959948

http://stackoverflow.com/comment/37378205
has text: you are right, it should be get, fixed code, as getProperty is only available for ActiveXObject
comment on: http://stackoverflow.com/a/24196805
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24054773
possible better answer: http://stackoverflow.com/a/55305892
answer count: 4
has title: Java 8 Streams: multiple filters vs. complex condition
upvote count: 340
has comment: http://stackoverflow.com/comment/85036431
has comment: http://stackoverflow.com/comment/37109524
downvote count: 0
has answer: http://stackoverflow.com/a/24055107
has answer: http://stackoverflow.com/a/53289360
tagged with: filter
has answer: http://stackoverflow.com/a/36522058
type: AnsweredQuestion
favorite count: 0
score: 340
type: Question
accepted answer: http://stackoverflow.com/a/24055107
tagged with: lambda
tagged with: java-8
has body: Sometimes you want to filter a Stream with more than one condition: myList.stream().filter(x -&gt; x.size() &gt; 10).filter(x -&gt; x.isCool()) ... or you could do the same with a complex condition and a single filter: myList.stream().filter(x -&gt; x.size() &gt; 10 &amp;&amp; x -&gt; x.isCool()) ... My guess is that the second approach has better performance characteristics, but I don't know it. The first approach wins in readability, but what is better for the performance?
has answer: http://stackoverflow.com/a/55305892
tagged with: java-stream
tagged with: java

http://stackoverflow.com/q/24080736
score: 0
has comment: http://stackoverflow.com/comment/37142083
answer count: 1
tagged with: log4j
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24181659
has body: My project is configured to be able to pick up logback.xml automatically if it's located in the same directory as the .jar file. Normally I just run my project with java -jar app.jar and logback picks up logback.xml automatically and configures itself. These are the contents of my MANIFEST.MF file: Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Built-By: Dev Build-Jdk: 1.7.0_45 Main-Class: com.app.middleware.App Class-Path: . However, once I added a new Maven dependency (ActiveMQ client 5.9.1), Logback seems to have become unable to pick up the configuration file from classpath - it simply prints the following: 20:17:58,872 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.xml] 20:17:58,872 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Setting up default configuration. I've extracted the old jar and the new jar alongside each other and both archives have the exact same contents of MANIFEST.MF and .classpath files. Could this be caused by some kind of jar conflict introduced by ActiveMQ? Why would it prevent logback from picking up its configuration file? I am currently getting around this problem by manually specifying the config location (-Dlogback.configurationFile=logback.xml) but I fear that this problem is a result of a deeper underlying issue.
tagged with: activemq-classic
tagged with: java
type: Question
has title: Logback configuration issue, cannot find logback.xml
tagged with: logback
linked to: http://stackoverflow.com/q/20242213
tagged with: slf4j

http://stackoverflow.com/comment/37026675
type: Comment
type: QuestionComment
has text: @dymmeh Sadly, it is still not working. Really weird...
score: 0
comment on: http://stackoverflow.com/q/24021126

http://stackoverflow.com/a/24081998
answers question: http://stackoverflow.com/q/24081941
has comment: http://stackoverflow.com/comment/37139208
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37139280
upvote count: 1
has comment: http://stackoverflow.com/comment/37138889
has body: This is a slightly different way, but it is simple. When you select an item from the combo box, the table changes. It uses a table model: //ComboTableTest.java import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; public class ComboTableTest extends JFrame implements ActionListener { private static final long serialVersionUID = -3898736145211708745L; private JComboBox&lt;String&gt; combo; private MyTableModel tableModel; //constructor public ComboTableTest() { //set up frame setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(600,175); setLayout(new FlowLayout()); //create combo box combo = new JComboBox&lt;String&gt;(new String[]{"one", "two", "three"}); combo.addActionListener(this); add(combo); //create table tableModel = new MyTableModel(); final JTable table = new JTable(tableModel); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); JScrollPane scrollPane = new JScrollPane(table); add(scrollPane); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == combo) { tableModel.setValueAt(0,0,(String)combo.getSelectedItem()); tableModel.setValueAt(1,1,(String)combo.getSelectedItem()); tableModel.setValueAt(2,2,(String)combo.getSelectedItem()); } } /*** MAIN ***/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ComboTableTest frame = new ComboTableTest(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } } class MyTableModel extends AbstractTableModel { private static final long serialVersionUID = -1359557492205432915L; private String[] columnNames = {"Col 1","Col 2","Col 3"}; private Object[][] data = new Object[][]{{"1","2","3"},{"4","5","6"},{"7…

http://stackoverflow.com/q/24075170
answer count: 2
tagged with: websphere
has answer: http://stackoverflow.com/a/24110348
upvote count: 1
has title: Need help in implementing Single Sign On for Java / JEE application which runs on WAS7
favorite count: 0
has comment: http://stackoverflow.com/comment/37127028
has comment: http://stackoverflow.com/comment/37132564
has comment: http://stackoverflow.com/comment/37140911
tagged with: single-sign-on
type: AnsweredQuestion
has body: We have a java / J2EE web application which runs on Websphere Application Server7 and this application is hosted on Solaris10. We are trying to implement Single Sign On (i.e. When users logon to their domain computers / laptops and after that if they try to open the application, it needs to fetch the login credentials from the system login info and the same should be used for application login.) for this application. Could you please suggest how we can proceed..? Any little amount help also will be very useful to us.. Thank you very much in advance..!!!
downvote count: 0
has comment: http://stackoverflow.com/comment/37826660
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24078841
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/24110348
has answer: http://stackoverflow.com/a/24078841
has comment: http://stackoverflow.com/comment/37130227
has comment: http://stackoverflow.com/comment/37132609
tagged with: solaris

http://stackoverflow.com/comment/37077170
comment on: http://stackoverflow.com/a/24047985
score: 0
type: AnswerComment
has text: Can I pass any object that is not of type `Data`?
type: Comment

weblogic8.x
tag name: weblogic8.x
tags question: http://stackoverflow.com/q/24086783
type: Tag

http://stackoverflow.com/comment/37064722
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24023453
type: Comment
has text: Tried it and the project still crashes once continue is pressed

http://stackoverflow.com/comment/37172051
comment on: http://stackoverflow.com/q/24099350
has text: it does `java version "1.7.0_40" Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37028305
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24019476
has text: @user3576336 If this fixes your issue then accept it to mark it as useful to future viewers.
type: AnswerComment

http://stackoverflow.com/comment/36968374
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23988266
score: 0
has text: Based on example found I tried to do: Uri dataUri = data.getData(); but I get NullPointerException. Could you look at my edited question?

http://stackoverflow.com/a/24002892
has comment: http://stackoverflow.com/comment/37010361
upvote count: 9
has comment: http://stackoverflow.com/comment/37015883
score: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/37018801
answers question: http://stackoverflow.com/q/23996149
has body: People frequently confuse the @Column(nullable) and @NotNull annotations. The @Column(nullable) is meant for the generated DDL scripts. But you don't use Hibernate to generate your DDL, so you shouldn't rely on it at all. What you want is @NotNull which is a runtime validation trigger. If you define the Hibernate Validator Annotation (or JPA 2.0 ones) you can get the DDL for those as well: Out of the box, Hibernate (as of version 3.5.x) will translate the constraints you have defined for your entities into mapping metadata. For example, if a property of your entity is annotated @NotNull, its columns will be declared as not null in the DDL schema generated by Hibernate. And make sure you enable validation if you're using JPA with Hibernate. If you are using JPA 2 and Hibernate Validator is in the classpath the JPA2 specification requires that Bean Validation gets enabled. The properties javax.persistence.validation.group.pre-persist, javax.persistence.validation.group.pre-update and javax.persistence.validation.group.pre-remove as described in Section 10.1.2, “Hibernate event-based validation” can in this case be configured in persistence.xml. persistence.xml also defines a node validation-mode which can be set to AUTO, CALLBACK, NONE. The default is AUTO.
type: Answer

http://stackoverflow.com/comment/36961997
score: 1
has text: Well, what's the error?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23986789

http://stackoverflow.com/q/24014807
has title: Apache Camel: Is it possible to configure WMQ without using Spring?
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/24028672
type: Question
linked to: http://stackoverflow.com/q/9329078
has body: currently I am working with apache camel and wmq. For the camel configuration and routing, I am using Java DSL. But I could not find any example about how to configure WMQ by using Java DSL. Here is what I get when I tried to configure WMQ: config.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" default-init-method="init" xmlns:util="http://www.springframework.org/schema/util" xmlns:osgi="http://www.springframework.org/schema/osgi" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xs http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> <import resource="classpath:/META-INF/spring/components.xml"/> <from uri="jms:LQ.SERVICEPROVIDER.CAMEL.SERVICEBUS"/> //id //vorname //nachname <to uri="sql:insert into USERS (ID, FIRSTNAME, LASTNAME, BEARBEITET) values (:#ID, :#FIRSTNAME, :#LASTNAME, TRUE)"/> </beans> component.xml <?xml version="1.0" encoding="UTF-8"?> <beans…
score: 2
downvote count: 0
answer count: 1
favorite count: 0
tagged with: ibm-mq
accepted answer: http://stackoverflow.com/a/24028672
tagged with: jms
tagged with: dsl
upvote count: 2

http://stackoverflow.com/a/24086393
upvote count: 2
type: Answer
has body: Well, if you have C experience, then the thing to know about Java is that it doesn't use pointers, but it does use references. So if I'm understanding your problem correctly, you are already using the Image attribute of a Presenter instance elsewhere and then you want to fill it in later. Assigning pres.Image = new (Bitmap) DownloadedImageFromImageRef; would not work in this case because other objects are looking at a different Bitmap object reference. What you might need to do is use an observer pattern -- it depends on the details of your problem. Here's an example: Somewhere in the code I have a class Foo that wants to use the Image property from a Presenter instance. But, since that property isn't set until later, this class wants to be notified when it is ready (it is an observer). public class Presenter { String Name; String ImageRef; // Filename to be downloaded private Bitmap Image; private PresenterImageObserver observer; public void setImageObeserver(PresenterImageObserver pio) { this.observer = pio; } public void setImage(Bitmap b) { this.Image = b; this.observer.imageLoaded(b); } } public interface PresenterImageObserver { public void imageLoaded(Bitmap b); } public class Foo implements PresenterImageObserver { //Foo's constructor. It wants the image from presenter p, when it is ready public Foo(Presenter p) { p.setImageObserver(this); } public void imageLoaded(Bitmap b) { //b contains the loaded image and this Foo instance can use it now! } } You'd need to set the image using pres.setImage(new (Bitmap) downloadedImageFromImageRef);.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24085675

http://stackoverflow.com/a/24102761
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24101565
upvote count: 1
has body: There is no standardized way to distribute a standalone JVM application, but dependencies are almost always bundled. A good option for Gradle is to use the gradle-one-jar plugin, which will produce a single executable Jar (java -jar path/to/the.jar) containing your code and its dependencies. Another option is to use Gradle's built-in distribution plugin, which will produce a Zip containing your code, its dependencies, start scripts for *nix and Windows, and anything else you want to ship along with your application (e.g documentation).

http://stackoverflow.com/comment/37174796
comment on: http://stackoverflow.com/q/24096532
score: 0
type: QuestionComment
has text: This seems to be a [common problem](https://groups.google.com/forum/#!msg/powermock/o5vBVYwccac/Fg3jE8gRhlIJ). You didn't specify whether your method is overloaded, but because the stack trace is the same down to the same line numbers, I'm marking it as a duplicate of [this other question](http://stackoverflow.com/q/17695356/1426891). Hope that answer helps you!
type: Comment

http://stackoverflow.com/comment/36989224
type: Comment
type: QuestionComment
has text: possible duplicate of [How to run JUnit test cases from the command line](http://stackoverflow.com/questions/2235276/how-to-run-junit-test-cases-from-the-command-line)
comment on: http://stackoverflow.com/q/24001032
score: 0

http://stackoverflow.com/q/24029988
tagged with: https
tagged with: browser
has answer: http://stackoverflow.com/a/24093893
type: Question
type: AnsweredQuestion
tagged with: url
has body: I've been trying to pass cookies from an HttpsURLConnection to my browser. Unfortunately, I haven't found... Well, anything at all on the topic besides Android, which is not what I want. The cookies are session-specific, so I have to download them from the webpage every time. Is there any way to open a webpage from Java in a browser (Firefox, Chrome, etc) and send cookies over? Code so far: (Yes, I know putting "throws Exception" on the main method is not smart in any way. Please just ignore it, it won't be there when this is working.) public static void main(String[] args) throws Exception { String httpsURL = "https://www.link.com"; URL myurl = new URL(httpsURL); HttpsURLConnection con; CookieManager cManager = new CookieManager(); CookieHandler.setDefault(cManager); /* Start by connecting to website so CookieManager can grab cookies */ con = (HttpsURLConnection) myurl.openConnection(); /*COOKIES*/ CookieStore cookieJar = cManager.getCookieStore(); List&lt;HttpCookie&gt; cookies = cookieJar.getCookies(); System.out.println("COOKIES:"); String list = null; for (HttpCookie cookie : cookies) { if (list != null) { list += "; "; } list += cookie.getName()+"="+cookie.getValue(); System.out.println(cookie.getName() + " : " + cookie.getValue()); } con.disconnect(); // Here is where I want the cookies to transfer to the browser... }
accepted answer: http://stackoverflow.com/a/24093893
answer count: 1
tagged with: cookies
score: 0
tagged with: java
has title: Passing Cookies from Java to Browser

http://stackoverflow.com/comment/37017943
type: QuestionComment
comment on: http://stackoverflow.com/q/24009733
has text: @GaryRussell I've been struggling today all day, I don't know why but the messaging system hangs out somewhere. I'm trying to catch a http exception and wrap it in my custom exception. When I throw the custom exception it doesn't get back in the gateway.. the process hangs somewhere. Can you please take a look at the stack trace ? http://www.pastebucket.com/40573 plus is the current spring-integration set up http://www.pastebucket.com/40575
score: 0
type: Comment

http://stackoverflow.com/a/24074896
score: 1
has comment: http://stackoverflow.com/comment/37126093
type: Answer
has comment: http://stackoverflow.com/comment/37126892
has body: In general, to check if a sentence contains rob or robbery or robbed, you can add a lookehead after the beginning of string anchor, before the rest of your regex pattern: (?=.*(?:rob|robbery|robbed)) In this case, it is more efficient to group the rob then check for potential suffixes: (?=.*(?:rob(?:ery|ed)?)) In your Java code, we can (for instance) modify your loop like this: while (match.find()) { sentenceString=match.group(0); if (sentenceString.matches("(?=.*(?:rob(?:ery|ed)?))")) { System.out.println(sentenceString); } } Explain Regex (?= # look ahead to see if there is: .* # any character except \n (0 or more times # (matching the most amount possible)) (?: # group, but do not capture: rob # 'rob' (?: # group, but do not capture (optional # (matching the most amount possible)): ery # 'ery' | # OR ed # 'ed' )? # end of grouping ) # end of grouping ) # end of look-ahead
upvote count: 1
has comment: http://stackoverflow.com/comment/37126747
has comment: http://stackoverflow.com/comment/37130266
downvote count: 0
has comment: http://stackoverflow.com/comment/37126323
answers question: http://stackoverflow.com/q/24074650
has comment: http://stackoverflow.com/comment/37127008
has comment: http://stackoverflow.com/comment/37126466

http://stackoverflow.com/comment/37018746
comment on: http://stackoverflow.com/q/24017257
type: Comment
type: QuestionComment
has text: String instances don't have a `length` field. However, they have a `length()` method.
score: 0

http://stackoverflow.com/comment/37149220
has text: You mean I have to push it do an action first? I really need to solve this problem now because I'm doing my project and I don't have to must time left :(
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24058603
type: AnswerComment

http://stackoverflow.com/comment/37137901
type: QuestionComment
comment on: http://stackoverflow.com/q/24057425
score: 0
has text: I see. Did you pulled any benchmark? And... Why do you disassemble classes?
type: Comment

http://stackoverflow.com/q/23992884
score: 4
possible better answer: http://stackoverflow.com/a/23992931
answer count: 2
accepted answer: http://stackoverflow.com/a/23992983
favorite count: 0
tagged with: synchronization
tagged with: static
has title: Synchronization with static block
type: AnsweredQuestion
has body: I have a question: can we use the static keyword with a synchronized method? As we all know that static is related to class and synchronization is used to block an object, using synchronized with static doesn't make any sense to me. So why and in which situation would I use synchronization with the static keyword?
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23992983
has answer: http://stackoverflow.com/a/23992931
upvote count: 5

http://stackoverflow.com/comment/37156081
comment on: http://stackoverflow.com/q/24090357
has text: @Braj GWT doesn't support java style regular expressions.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37115249
score: 0
has text: @Jens I surrounded the whole function in a try block and now when I scroll up the list view some "image" layouts are getting swapped with "text" layouts. Still getting the same error in logcat.
type: Comment
comment on: http://stackoverflow.com/q/24068025
type: QuestionComment

http://stackoverflow.com/q/24071298
has answer: http://stackoverflow.com/a/24071735
tagged with: java
type: Question
tagged with: stanford-nlp
has body: I am working with the Stanford Parser and NLP software for the first time. In my project, I would like to find all adverbs (such as "not" and "very") and determine they modify in a sentence. For example, for the sentence "The book is not interesting", I can find the vertex for "not" in the parse tree. I would then like to find that "not" is modifying "interesting". Can the parser (or other Stanford corenlp software) provide that information?
has title: Finding adverbs and what they modify using Stanford Parser
score: 0
answer count: 1
tagged with: nlp
type: UnansweredQuestion

http://stackoverflow.com/comment/36968682
comment on: http://stackoverflow.com/q/23990510
has text: Why `extends`? Just use composition
score: 12
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24052315
has comment: http://stackoverflow.com/comment/37084621
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24052258
has body: Or if your app is primitive you just can use WebView
has comment: http://stackoverflow.com/comment/37084556

http://stackoverflow.com/comment/37070997
score: 0
has text: A quick debug step is to remove the `produces` from your request mapping, and see if you still get the error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24044553

http://stackoverflow.com/q/23966914
has comment: http://stackoverflow.com/comment/36925656
tagged with: awt
has body: I'm currently trying to implement a 2D shadow casting method in Java by following this tutorial: http://ncase.me/sight-and-light/ I want to stick to Line2D and Polygon objects. Here is the main part of my code so far: for (Polygon p : Quads.polygons) { for (int i = 0; i &lt; p.npoints; i++) { osgCtx.setStroke(new BasicStroke(0.1f)); Line2D line = new Line2D.Double(mousePos.getX(), mousePos.getY(), p.xpoints[i], p.ypoints[i]); osgCtx.draw(line); } osgCtx.setStroke(new BasicStroke(1.0f)); osgCtx.draw(p); } Which gives a result of this: I get confused when it comes down to building the parametric form of the lines. I don't know how to implement the math with Java's methods. Could someone point me in the right direction, code-wise, for implementing this?
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/23971327
tagged with: graphics2d
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: raycasting
score: 2
tagged with: java
has title: How to do 2D shadow casting in Java?
tagged with: shadow
type: Question
has answer: http://stackoverflow.com/a/24949344

http://stackoverflow.com/comment/37066266
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24042347
has text: @RaNdoM_PoWneD: This is not any school work , it was asked in an interview.

http://stackoverflow.com/q/24097892
has title: Declaring objects name using some loop
has answer: http://stackoverflow.com/a/24097939
downvote count: 5
linked to: http://stackoverflow.com/q/7478833
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24097945
favorite count: 0
has body: How to create several objects of given class whose instances are pre known without manually declaring each object name.Means can i use some loop to declare those objects name from some other data type like (int,string etc.) which i can easily handle.
has comment: http://stackoverflow.com/comment/37169267
tagged with: c++
type: AnsweredQuestion
score: -5
accepted answer: http://stackoverflow.com/a/24097945
tagged with: java
has comment: http://stackoverflow.com/comment/37169271
type: Question
possible better answer: http://stackoverflow.com/a/24097939

http://stackoverflow.com/comment/37105025
comment on: http://stackoverflow.com/a/24063489
has text: @Unihedron Not quite, but close. A `Parent` object is, by definition, not a `Child` object. But a _reference_ of type `Parent` can also reference an object of type `Child`. The distinction between reference and object is important, especially for this question.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/24022925
upvote count: 0
has comment: http://stackoverflow.com/comment/37030031
has comment: http://stackoverflow.com/comment/37029830
tagged with: listview
answer count: 3
has body: Right now, I have an Activity that displays 10 listings from a JSON array. Next, on the swipe of an ImageView, I want to clear the ListView and display the next 10 (as a "next page" type thing). So, right now I do this view.setOnTouchListener(new OnSwipeTouchListener(getBaseContext()) { @Override public void onSwipeLeft() { //clear adapter adapter.clear(); //get listings 10-20 startLoop = 10; endLoop = 20; //call asynctask to display locations FillLocations myFill = new FillLocations(); myFill.execute(); Toast.makeText(getApplicationContext(), "Left", Toast.LENGTH_LONG).show(); } and when I swipe it diisplays ONE item and I get this error Error Parsing Data android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. What am I doing wrong? Thanks! Full code: public class MainActivity extends ActionBarActivity { ListView listView; int startLoop, endLoop; TextView test; ArrayList&lt;Location&gt; arrayOfLocations; LocationAdapter adapter; ImageView view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startLoop = 0; endLoop = 10; listView = (ListView) findViewById(R.id.listView1); // Construct the data source arrayOfLocations = new ArrayList&lt;Location&gt;(); // Create the adapter to convert the array to views adapter = new LocationAdapter(this, arrayOfLocations); FillLocations myFill = new FillLocations(); myFill.execute(); view = (ImageView) findViewById(R.id.imageView1); view.setOnTouchListener(new OnSwipeTouchListener(getBaseContext()) { @Override public void onSwipeLeft() { adapter.clear(); startLoop = 10; endLoop = 20; FillLocations myFill = new FillLocations(); myFill.execute(); Toast.makeText(getApplicationContext(), "Left", Toast.LENGTH_LONG).show(); } }); } private class FillLocations extends AsyncTask&lt;Integer, Void, String&gt; { String msg = "Done"; protected void onPreExecute() { progress.sho…
possible better answer: http://stackoverflow.com/a/24023299
tagged with: android
accepted answer: http://stackoverflow.com/a/24023587
has answer: http://stackoverflow.com/a/24023299
has title: Error while calling AsyncTask within a gesture listener
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/37031090
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: gesture
has answer: http://stackoverflow.com/a/24023415
score: -1
has answer: http://stackoverflow.com/a/24023587
type: Question
has comment: http://stackoverflow.com/comment/37029869

http://stackoverflow.com/comment/58986384
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23968960
type: Comment
has text: is that helped you or not? if yes please mark answer as correct.

http://stackoverflow.com/comment/36900093
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23953599
score: 1
has text: How about setting android:layout_height="match_parent" on a `venue_container` `FrameLayout`?

datetime
tags question: http://stackoverflow.com/q/24034253
tags question: http://stackoverflow.com/q/23975205
tags question: http://stackoverflow.com/q/23973097
tags question: http://stackoverflow.com/q/24047531
tags question: http://stackoverflow.com/q/24069108
tags question: http://stackoverflow.com/q/24069723
tag name: datetime
tags question: http://stackoverflow.com/q/23944370
tags question: http://stackoverflow.com/q/24026747
tags question: http://stackoverflow.com/q/24005272
type: Tag
tags question: http://stackoverflow.com/q/23950228
tags question: http://stackoverflow.com/q/23987332
tags question: http://stackoverflow.com/q/24093414

http://stackoverflow.com/a/24064829
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24064759
upvote count: 2
score: 2
has body: Use integer division by 60 to turn seconds in to whole minutes. The Modulus(%) of seconds by 60 will give the "leftover" seconds. Then use a string conversion to check for the necessity of 0 padding. int minutes = (total / 60); int seconds = (total % 60); String secs = Integer.toString(seconds); if (seconds &lt; 10) { secs = "0" + seconds; } String time = minutes + ":" + secs;
has comment: http://stackoverflow.com/comment/37107611
has comment: http://stackoverflow.com/comment/37107643

http://stackoverflow.com/a/24006592
score: -1
type: Answer
has body: The getBookByAuthor could return null. Then you will trigger null.getTitle(); that is the cause of NullPointerException. //The exception occurs when i call the method here (in another class): Inventory lib = new Inventory(); jTextField12.setText(lib.getBookByAuthor(authorSearch).getTitle()); Try null object design pattern - http://www.cs.oberlin.edu/~jwalker/nullObjPattern/ or return a new Book object with a default title like "BOOK NOT FOUND".
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/24006297

http://stackoverflow.com/q/24056128
linked to: http://stackoverflow.com/q/10414622
tagged with: java
type: Question
type: AnsweredQuestion
score: 3
has body: We have been using string template in java for a while and have just upgraded to String Template 4.0.7. In string template 3.2 (The version we were previously using), I had a string template file called stringtemplate.st in src/main/resources, and we just had a group called anything we liked as it didn't seem to make a difference, and loaded the template like so: final StringTemplateGroup group = new StringTemplateGroup("groupName"); final StringTemplate xmlMessage = group.getInstanceOf("stringtemplate"); After updating to 4.0.7, if you wish to load individual files, my understanding is that you need to have a STGroupDir object with the name of a folder where the templates are located. So, I moved the stringtemplate file to src/main/resources/templates and changed the above code to this: final URL url = Thread.currentThread().getContextClassLoader().getResource("templates"); final STGroup group = new STGroupDir(url.getPath(), '$', '$'); final ST xmlMessage = group.getInstanceOf("stringtemplate"); When I then try to populate the string template, this causes a null pointer to be thrown, and it appears that no templates are found. My understanding was that the String passed to the STGroupDir constructor should be the directory that the template files are located, and that if the template files are not found there, the classpath would be searched anyway. Am I fundamentally misunderstanding something? Any suggestions as to what I am doing wrong?
answer count: 1
downvote count: 0
has title: String Template 4 Problems with STGroupDir
accepted answer: http://stackoverflow.com/a/24056717
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/24056717
tagged with: stringtemplate-4

http://stackoverflow.com/comment/37171014
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24098617
has text: What is `Debugger`? If it's your own class, please show us the `debug` method.
score: 0

http://stackoverflow.com/comment/36960119
comment on: http://stackoverflow.com/q/23985694
has text: Use an interface when it is appropriate to do so. Use an abstract class when appropriate. And use both where appropriate (and I often do the last option).
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37004374
has text: Learn how to debug, you will know how to program. [Here's a good guide to start java debugging](http://www.vogella.com/tutorials/EclipseDebugging/article.html).
comment on: http://stackoverflow.com/q/24009249
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24100922
has comment: http://stackoverflow.com/comment/37179943
has comment: http://stackoverflow.com/comment/37180357
score: 0
has comment: http://stackoverflow.com/comment/37179892
has body: You can use the jvisualvm.exe program to look at your memory consumption and see where its being allocated. jvisualvm is located in the bin folder of your jdk installation. Heres what I would do to change your code: Get rid of the BufferedInput/BufferedOutput streams. These buffered streams are unnecessary in your program and are just adding in an additional memory allocation (of 32kb per buffered stream) but arent needed. Dont use 8 threads, I've build file download application to transfer very large files across networks and I have found the optimal amount of threads is 2 or 3. You cant download the file faster than your internet connection therefore adding in extra thread doesnt do anything but waste memory and time. Use a smaller buffer, a 32kb buffer is quite large, I would test using a smaller buffer like 1kb. Dont confuse wammp memory/cpu usage with your Java applications memory/cpu usage. Use the 'Processes' tab of the Windows Task Manager instead of the Performance tab. With that said I dont have your entire program and cant test and debug performance for you but these are the things I would do. Below is your code that I have modified as much as possible. private void downloadFile() { try { this.response = this.con.getInputStream(); this.responseContentSize = this.con.getContentLength(); if (this.responseContentSize == (this.end_range - this.start_range) + 1) { int MAX_BUFFER_SIZE = 1024; byte buffer[] = new byte[MAX_BUFFER_SIZE]; makeTmpFile(); out = new FileOutputStream(this.tmpdir + this.tmpFilename); int r = 0; while ((r = response.read(buffer)) != -1) { out.write(buffer, 0, r); downloadedBytes = r; } } } catch (IOException e) { sharedDownloadStatus.setCell(this.threadIndex, STATUS, 0);//error log.setLog("func : downloadFile =&gt;\n couldnt download file\n" + e.getMessage()); } finally { if (out != null) out.close(); if (response != null) response.close(); } }
type: Answer
has comment: http://stackoverflow.com/comment/37180505
has comment: http://stackoverflow.com/comment/37179962
answers question: http://stackoverflow.com/q/24094920
has comment: http://stackoverflow.com/comment/37179741

http://stackoverflow.com/q/24006937
has title: Lombok annotations do not compile under Intellij idea
has answer: http://stackoverflow.com/a/42057067
linked to: http://stackoverflow.com/q/70775068
has answer: http://stackoverflow.com/a/37840148
has comment: http://stackoverflow.com/comment/37005663
has answer: http://stackoverflow.com/a/35907529
has comment: http://stackoverflow.com/comment/102842380
has answer: http://stackoverflow.com/a/48022609
has answer: http://stackoverflow.com/a/27430992
has comment: http://stackoverflow.com/comment/140207524
type: Question
tagged with: lombok
has answer: http://stackoverflow.com/a/33330486
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/48016609
has comment: http://stackoverflow.com/comment/139358103
answer count: 11
has body: I've installed the plugin for intellij idea(lombok-plugin-0.8.6-13). Added lombok.jar into classpath I can find getters and setters in the window of structure. And Intellij shows no error. Setting - Lombok plugin - Verified Intellij configuration for lombok, it shows that "configuration of IntelliJ seems to be ok". It seems everything is OK. But when I compile a test, errors come: can not find the methods getXXX and setXXX. I opened the .class file with IntelliJ and find out that there is no setXXX and getXXX methods. Could somebody tell me why? plugin:lombok-plugin-0.8.6-13 lombok.jar:1.14.0 idea:13.0.2 for linux jdk:1.7.0_21
linked to: http://stackoverflow.com/q/9424364
downvote count: 0
duplicate of: http://stackoverflow.com/q/9424364
upvote count: 286
has answer: http://stackoverflow.com/a/52392862
has comment: http://stackoverflow.com/comment/115701781
has answer: http://stackoverflow.com/a/53335955
favorite count: 0
has answer: http://stackoverflow.com/a/39841342
has answer: http://stackoverflow.com/a/30125507
type: UnansweredQuestion
score: 286
has answer: http://stackoverflow.com/a/38317411
linked to: http://stackoverflow.com/q/28325297
has comment: http://stackoverflow.com/comment/139811861
tagged with: java

http://stackoverflow.com/comment/77106490
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/32329482
has text: This solved my issue of being unable to sample CPU whilst profiling a local Wildfly instance, but I'm curious as to why it's *these* parameters that cause the issue. We're maintaining a multi-language system with containers dependent on these properties and it just doesn't make much sense to change the parameters so that we can profile some function call.

http://stackoverflow.com/comment/36905618
type: QuestionComment
has text: Log them into your app with their GA account wouldn't be an option? So you could query their granted profiles and they could choose among them.
score: 1
comment on: http://stackoverflow.com/q/23956639
type: Comment

http://stackoverflow.com/comment/37011275
type: AnswerComment
score: 0
type: Comment
has text: output is `start index1 18 end index1 22 -1` i think it does solve most part of the problem.
comment on: http://stackoverflow.com/a/24012891

http://stackoverflow.com/a/24056463
has comment: http://stackoverflow.com/comment/37092217
downvote count: 1
has comment: http://stackoverflow.com/comment/37093960
has comment: http://stackoverflow.com/comment/37093649
has body: Using Jackson: ObjectMapper mapper = new ObjectMapper(); String listAsJson = mapper.writeValueAsString(oldList); List&lt;Object&gt; newList= mapper.readValue(listAsJson ,new TypeReference&lt;List&lt;Object&gt;&gt;() {});
answers question: http://stackoverflow.com/q/24056275
score: 0
has comment: http://stackoverflow.com/comment/37092946
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37093017
has comment: http://stackoverflow.com/comment/37092924

http://stackoverflow.com/comment/37178814
type: Comment
comment on: http://stackoverflow.com/a/24092749
type: AnswerComment
score: 0
has text: Hi Paul, I would love to, but I'm new and don't have the rep to vote up yet. But I will once I hit my 15pts. Thanks for all your help!

http://stackoverflow.com/q/24082422
tagged with: object
tagged with: arrays
tagged with: hazelcast
upvote count: 1
answer count: 1
has title: hazelcast dataSerializable - serialize array of objects
favorite count: 0
tagged with: serialization
has body: I've read through the documentation on DataSerialization at http://hazelcast.org/docs/latest/manual/html/dataserialization.html and have successfully written my writeData and readData methods for primitives and custom objects however I am stumped as to how to serialize/deserialize an array of condition objects. Condition object being a class I have written. private NEConditionInfo[] m_arryConditions @Override public void writeData(ObjectDataOutput aOut) throws IOException { ? } @Override public void readData(ObjectDataInput aIn) throws IOException { ? } Do I traverse the array if not null calling writeObject/readObject on every element? Does my condition object need to be DataSerializable to be able to be used? The condition object is currently java.io.Serializable. Any help much appreciated!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24140933
downvote count: 0
accepted answer: http://stackoverflow.com/a/24140933
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/37085162
has text: I'm not saying that your answer is "well-cooked", I'm only saying that the **OP** want a "well-cooked" code.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24052639
type: Comment

http://stackoverflow.com/a/24000430
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24000071
type: Answer
answers question: http://stackoverflow.com/q/24000071
downvote count: 0
score: 1
has body: Two things: Your JSON was in an invalid format (even after unescaping). Your Triplet class is an object, not a JSON array. I've made a few modifications to your code, in order to make it work. Here you have a working example public class Q24000071 { public static void main(String[] args) { //the 'r' attribute, corresponding to 'ViewsHistoric' class, was missing String jsonExample = "{\"r\": [" + "{&amp;#34;c&amp;#34;:[{&amp;#34;v&amp;#34;:&amp;#34;03/10/2013&amp;#34;},{&amp;#34;v&amp;#34;:23},{&amp;#34;v&amp;#34;:112}]}," + "{&amp;#34;c&amp;#34;:[{&amp;#34;v&amp;#34;:&amp;#34;04/10/2013&amp;#34;},{&amp;#34;v&amp;#34;:14},{&amp;#34;v&amp;#34;:232}]}," + "{&amp;#34;c&amp;#34;:[{&amp;#34;v&amp;#34;:&amp;#34;05/10/2013&amp;#34;},{&amp;#34;v&amp;#34;:18},{&amp;#34;v&amp;#34;:145}]}," + "{&amp;#34;c&amp;#34;:[{&amp;#34;v&amp;#34;:&amp;#34;06/10/2013&amp;#34;},{&amp;#34;v&amp;#34;:22},{&amp;#34;v&amp;#34;:211}]}," + "{&amp;#34;c&amp;#34;:[{&amp;#34;v&amp;#34;:&amp;#34;07/10/2013&amp;#34;},{&amp;#34;v&amp;#34;:18},{&amp;#34;v&amp;#34;:198}]}," + "{&amp;#34;c&amp;#34;:[{&amp;#34;v&amp;#34;:&amp;#34;08/10/2013&amp;#34;},{&amp;#34;v&amp;#34;:15},{&amp;#34;v&amp;#34;:215}]}" + "]}"; String unescape = StringEscapeUtils.unescapeHtml4(jsonExample); System.out.println(unescape); Gson gson = new GsonBuilder().setPrettyPrinting().create(); ViewsHistoric viewHistoric = gson.fromJson(unescape, ViewsHistoric.class); System.out.println(gson.toJson(viewHistoric)); } public static class ViewsHistoric { private List&lt;Row&gt; r; public List&lt;Row&gt; getR() { return r; } public ViewsHistoric() { } } public static class Row { // Triplet is an array in the original JSON // of three elements, but an array. private Triplet[] c; public Triplet[] getC() { return c; } public Row() { } } public static class Triplet { private String v; public String getV() { return v; } public Triplet() { } } }
upvote count: 1

spring-aop
tags question: http://stackoverflow.com/q/24100740
tags question: http://stackoverflow.com/q/24099666
tags question: http://stackoverflow.com/q/24099961
tags question: http://stackoverflow.com/q/24065975
tags question: http://stackoverflow.com/q/24069484
tags question: http://stackoverflow.com/q/24033419
tag name: spring-aop
type: Tag

http://stackoverflow.com/q/24032839
has comment: http://stackoverflow.com/comment/37077144
favorite count: 0
has comment: http://stackoverflow.com/comment/37048300
has comment: http://stackoverflow.com/comment/37048651
has comment: http://stackoverflow.com/comment/37048172
has comment: http://stackoverflow.com/comment/37048290
has comment: http://stackoverflow.com/comment/37048904
has comment: http://stackoverflow.com/comment/37048782
has body: I'm trying to concatenate a series of ByteArrayOutputStream objects into a single one and I'm having trouble capturing all the data. For some reason only the first write() operation works (see code below), and the resulting ByteArrayOutputStream has a trimmed version of the data. I checked that the input list is intact (for instance if I reverse the order of concatenation the resulting object has data from the last element in the list). Are there other function calls I need to make between the write() operations to make sure the byte arrays are actually copied? Thanks in advance! ArrayList&lt;ByteArrayOutputStream&gt; outputStreams = new ArrayList&lt;ByteArrayOutputStream&gt;(); ByteArrayOutputStream outputStreamAggregate = new ByteArrayOutputStream(); // ... add data to outputStreams ... for(int i = 0; i &lt; outputStreams.size(); i++) { outputStreamAggregate.write(outputStreams.get(i).toByteArray()); }
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37048103
tagged with: java
has title: Data missing from ByteArrayOutputStream after write operations
has comment: http://stackoverflow.com/comment/37048036
type: Question
tagged with: concatenation
tagged with: bytearrayoutputstream
has comment: http://stackoverflow.com/comment/37048328
downvote count: 0

http://stackoverflow.com/a/66841861
answers question: http://stackoverflow.com/q/23962796
has body: I meet the same problem and finally solve it. In my case, I use protobuf object in Spark job. Spark kryo serializer couldn't serialize/deserialize protobuf object very well. We can use two methods to solve this problem. Use protobuf default serialize/deserialize method instead of kryo serialize method. For example, you can convert your Spark rdd[YourProtobufObject] to rdd[ByteString], use pb.toByteString() do the serialize and use .parseFrom(xxByteString) do the deserialize. Actually, this method is not elegant, but it works. Register your own protobuf class to kryo. The details as follows. First, add config to SparkConf. For example conf.set("spark.serializer","org.apache.spark.serializer.KryoSerializer") .set("spark.kryo.registrator","your.own.registrator.implement.MyKryoRegistrator") Second, create your own registrator implement. You can use Twitter opensource Chill project ProtobufSerializer dependency or mvnrepository, and use ProtobufSerializer directly. The maven dependency looks like this. com.twitter chill_2.11 0.9.3 com.twitter chill-protobuf 0.9.3 com.twitter chill-java create your own kryo registrator implement named MyKryoRegistrator class MyKryoRegistrator extends KryoRegistrator { override def registerClasses(kryo: Kryo): Unit = { kryo.register(classOf[YourProtobufObject], new ProtobufSerializer()) } } Third, run again your Spark job, it will be ok.
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/24003489
has comment: http://stackoverflow.com/comment/36997426
has body: Have you considered doing some simple periodic ajax polling? Here is a small example using jQuery that posts to some jsp and then calls another javascript function to update your textArea: function doPoll(){ $.post('ajax/log.jsp', function(data) { updateTextArea(data); // process results here setTimeout(doPoll,5000); }); } A simple but maybe quite blut possibility would be to have your controller read the produced logfile when ajax posts to it and return the latest changes (or the whole log). EDIT: developerwjk was a bit faster :) If the log is important, keep it somewhere in your database. Then in the post retrieve the log messages and pass them back to the ajax.
answers question: http://stackoverflow.com/q/23998949
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37005423
has comment: http://stackoverflow.com/comment/37000869
upvote count: 1

http://stackoverflow.com/comment/37182779
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24097764
has text: using loop or any thing

http://stackoverflow.com/q/24098494
tagged with: gradle
type: Question
score: 278
has answer: http://stackoverflow.com/a/59439925
has answer: http://stackoverflow.com/a/53252151
has answer: http://stackoverflow.com/a/42312888
has comment: http://stackoverflow.com/comment/98689581
has comment: http://stackoverflow.com/comment/86862128
has answer: http://stackoverflow.com/a/53127560
has comment: http://stackoverflow.com/comment/89415116
has answer: http://stackoverflow.com/a/45501043
has answer: http://stackoverflow.com/a/50327773
has answer: http://stackoverflow.com/a/24336042
has title: ':app:lintVitalRelease' error when generating signed apk
has answer: http://stackoverflow.com/a/55151273
tagged with: android
has answer: http://stackoverflow.com/a/50038853
downvote count: 1
has answer: http://stackoverflow.com/a/52140460
has answer: http://stackoverflow.com/a/63223341
has answer: http://stackoverflow.com/a/50239165
has answer: http://stackoverflow.com/a/24098575
accepted answer: http://stackoverflow.com/a/50239165
has body: I've tried to upload my apk on google play and encountered an error message: "You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs." Then I wrote android:debuggable="false" in my manifest and tried again. I've encountered the same error, so I've set the build variant from my module to release and tried generated an apk again, but this time, this error is generated: Error:Gradle: Execution failed for task ':app:lintVitalRelease'. Lint found fatal errors while assembling a release target. To proceed, either fix the issues identified by lint, or modify your build script as follows: ... android { lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors are found: abortOnError false } } ...
has answer: http://stackoverflow.com/a/56023139
upvote count: 279
has answer: http://stackoverflow.com/a/28358963
favorite count: 0
has comment: http://stackoverflow.com/comment/89881675
has answer: http://stackoverflow.com/a/51545577
has answer: http://stackoverflow.com/a/52403664
has answer: http://stackoverflow.com/a/54386047
has answer: http://stackoverflow.com/a/52624305
has answer: http://stackoverflow.com/a/53435973
has answer: http://stackoverflow.com/a/53058386
has answer: http://stackoverflow.com/a/47550232
has comment: http://stackoverflow.com/comment/92026782
answer count: 28
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/100604647
has answer: http://stackoverflow.com/a/70323388
has answer: http://stackoverflow.com/a/30436088
possible better answer: http://stackoverflow.com/a/24336042
has answer: http://stackoverflow.com/a/60292847
has answer: http://stackoverflow.com/a/52907167
tagged with: java
linked to: http://stackoverflow.com/q/43203415
has answer: http://stackoverflow.com/a/58240282
has comment: http://stackoverflow.com/comment/91084431
has answer: http://stackoverflow.com/a/67121177

http://stackoverflow.com/comment/37125849
comment on: http://stackoverflow.com/a/24074639
score: 1
type: AnswerComment
has text: This was a design choice, yes I know, I do this all the time do, this is something you will learn to see with experience. Based on the information you've provided, generics is the best option, whether you're starting out or retrofitting the code...
type: Comment

http://stackoverflow.com/comment/37064089
has text: Try this... `private static String URL = "https://myapp-mydemain.rhcloud.com/TNAService/services/TNAService?WSDL"; ` or `private static String URL = "https://myapp-mydemain.rhcloud.com/TNAService?WSDL";`
score: 0
comment on: http://stackoverflow.com/a/24035985
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/74165952
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24097425
has text: (* Chrome browser) I solved by adding @OPTIONS method returning Ok. Not elegant...
score: 0

http://stackoverflow.com/a/24045651
type: Answer
accepted answer of: http://stackoverflow.com/q/24004597
answers question: http://stackoverflow.com/q/24004597
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: So far the following solution has worked well. It is not a complete solution because it causes the tests to only be ran by maven when maven is invoked from the command line. For now though, it works. When maven is invoked, the maven command line arguments are placed in the environment map (System.getenv()). When the tests are run through jUnit in eclipse, there is no entry in System.getenv() for the maven command line arguments. So, I am using jUnits Assume class to check that this property is not null for the tests that I want eclipse to skip. Code: Assume.assumeNotNull(System.getenv("MAVEN_CMD_LINE_ARGS")); FYI, one downside of this solution is that eclipse marks the tests as passed instead of skipped.

http://stackoverflow.com/comment/36915298
type: AnswerComment
score: 0
has text: @user2610135 How are you checking if the edit text is empty or not? Update the question with code of button click listener.
type: Comment
comment on: http://stackoverflow.com/a/23961532

http://stackoverflow.com/q/23958028
has body: I've recently updated my GWT project to 2.6.1, and started to make use of Java 7 syntax since 2.6 now supports Java 7. However, when I attempt to compile, I'm receiving compiler errors such as [ERROR] Line 42: '<>' operator is not allowed for source level below 1.7 Full output Compiling module com.Project Validating units: Ignored 85 units with compilation errors in first pass. Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. Computing all possible rebind results for 'com.google.gwt.useragent.client.UserAgentAsserter' Rebinding com.google.gwt.useragent.client.UserAgentAsserter Checking rule <generate-with class='com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator'/> [WARN] Detected warnings related to 'com.google.gwt.editor.client.SimpleBeanEditorDriver'. Are validation-api-<version>.jar and validation-api-<version>-sources.jar on the classpath? Specify -logLevel DEBUG to see all errors. [WARN] Unknown type 'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in deferred binding rule [ERROR] Errors in 'file:/C:/workspace/Project/src/com/project/ProjectFile.java' [ERROR] Line 42: '<>' operator is not allowed for source level below 1.7 [ERROR] Errors in 'file:/C:/workspace/Project/src/com/project/AnotherProjectFile.java' [ERROR] Line 188: Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted C:\workspace\Project\build.xml:51: Java returned: 1 at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 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.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.t…
linked to: http://stackoverflow.com/q/2235491
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36911577
has comment: http://stackoverflow.com/comment/36911657
has comment: http://stackoverflow.com/comment/36913091
has comment: http://stackoverflow.com/comment/36911748
has comment: http://stackoverflow.com/comment/36912170
tagged with: java
has answer: http://stackoverflow.com/a/23963811
type: Question
score: 5
possible better answer: http://stackoverflow.com/a/23963811
tagged with: ant
upvote count: 5
has comment: http://stackoverflow.com/comment/36913192
downvote count: 0
has answer: http://stackoverflow.com/a/24036341
answer count: 3
has answer: http://stackoverflow.com/a/24030876
has comment: http://stackoverflow.com/comment/36912890
has comment: http://stackoverflow.com/comment/36913056
favorite count: 0
has title: Compiling GWT 2.6.1 at Java 7 source level
accepted answer: http://stackoverflow.com/a/24036341

http://stackoverflow.com/q/24042560
accepted answer: http://stackoverflow.com/a/24276989
favorite count: 0
upvote count: 2
tagged with: google-app-engine
score: 2
type: AnsweredQuestion
has body: I am facing a problem in GCS. In my application, I am trying to upload an image on GCS from application hosted on Google App Engine using BlobstoreService.generateUploadUrl() with appengine sdk 1.9.0. I am generating the upload url using below code: public Status getUploadURL(@Named("uploadUrl") String uploadUrl, @Named("bucket") String bucket){ BlobstoreService blobStoreService = BlobstoreServiceFactory.getBlobstoreService(); UploadOptions uploadOptions = UploadOptions.Builder.withGoogleStorageBucketName(bucket); return new Status(blobStoreService.createUploadUrl(uploadUrl, uploadOptions)); } After getting the upload URL using the above code, I am setting this url in my upload form action: &lt;form id="uploadForm" action="https://vibhoretest.appspot.com/_ah/upload/AMmfu6aV-O5cQ_eotQksnMP8NybW8Rei7ZYx2nQxpLN3Aph5-hnxriBHb2BRdfjYqusLER41UWvLp48KxaNiJJFwokpY-ClnmXZgNLuKgKvGgf4Cr-G-YomXmxJ_2055M-PUDmhnfuZOmw6BveexJHQh4oibwA5c5g/ALBNUaYAAAAAU4YMDlvwZRO4XLFDZbTwRrg9MuGI5ygJ/" method="post" enctype="multipart/form-data"&gt; &lt;input type="hidden" name="key" value="${filename}" /&gt; &lt;input type="hidden" name="success_action_status" value="201" /&gt; &lt;input type="hidden" name="x-goog-acl" value="public-read" /&gt; &lt;input type="file" name="file"&gt; &lt;input type="submit" value="Upload"&gt; &lt;/form&gt; When, submitting this form getting the below error: When I am submitting the form then image is getting uploaded and able to find in the bucket but also getting 404 in firefox firbug console as below: "NetworkError: 404 Not Found - https://vibhoretest.appspot.com/_ah/upload/AMmfu6aV-O5cQ_eotQksnMP8NybW8Rei7ZYx2nQxpLN3Aph5-hnxriBHb2BRdfjYqusLER41UWvLp48KxaNiJJFwokpY-ClnmXZgNLuKgKvGgf4Cr-G-YomXmxJ_2055M-PUDmhnfuZOmw6BveexJHQh4oibwA5c5g/ALBNUaYAAAAAU4YMDlvwZRO4XLFDZbTwRrg9MuGI5ygJ/"
tagged with: java
tagged with: google-cloud-storage
has answer: http://stackoverflow.com/a/24276989
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24042810
has answer: http://stackoverflow.com/a/24042810
downvote count: 0
has title: Google Cloud Storage returns 404 even file is uploaded from GAE hosted application using BlobstoreService

http://stackoverflow.com/comment/36940309
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23975406
has text: Use modulo base two and check if the remainder is zero or 1
score: 0

grouplayout
type: Tag
tag name: grouplayout
tags question: http://stackoverflow.com/q/23971709

http://stackoverflow.com/q/24088094
linked to: http://stackoverflow.com/q/14085757
has comment: http://stackoverflow.com/comment/37151020
has comment: http://stackoverflow.com/comment/37152473
possible better answer: http://stackoverflow.com/a/24088831
tagged with: mouselistener
tagged with: java
has answer: http://stackoverflow.com/a/24088831
upvote count: 1
tagged with: swing
downvote count: 1
has body: I have an applet which subclasses JFrame. The code is as follows: package complexviewer; import java.awt.*; import java.awt.event.*; import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.*; import javax.swing.*; public class Applet extends JFrame { // Window and applet stats public static final int windowSize = 400; public static final int updateDelay = 20; // Instance variables private ScheduledExecutorService timer = Executors.newScheduledThreadPool(1); public static void main(String[] args) { new Applet(); } public Applet() { // Set up window super("Complex Viewing Frame"); setSize(windowSize, windowSize); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); // Add listeners JPanel panel = new JPanel(); panel.setFocusable(true); panel.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent key) { System.out.println("Key pressed."); } public void keyReleased(KeyEvent key) {} public void keyTyped(KeyEvent key) {} }); panel.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent mouse) {} public void mouseClicked(MouseEvent mouse) {} public void mousePressed(MouseEvent mouse) { System.out.println("Mouse clicked."); } public void mouseEntered(MouseEvent mouse) {} public void mouseExited(MouseEvent mouse) {} }); panel.addMouseMotionListener(new MouseMotionListener() { public void mouseDragged(MouseEvent mouse) { System.out.println("Mouse dragged."); } public void mouseMoved(MouseEvent mouse) {} }); add(panel); panel.requestFocus(); timer.scheduleAtFixedRate(() -&gt; repaint(), 0, 200, MILLISECONDS); } public void paint(Graphics G) { // Drawing } } When I run it, the "Key pressed" event works just fine, but none of the mouse events work. What am I missing here? I looked at other answers like Problems With MouseListener Why isn&#39;t mouselistener working? MouseListener on JFrame MouseListener/KeyListener not working (JPanel) Unresponsive KeyListener for JFrame Also, picking different components like getCo…
type: Question
linked to: http://stackoverflow.com/q/1586984
linked to: http://stackoverflow.com/q/17934661
linked to: http://stackoverflow.com/q/10134477
score: 0
has comment: http://stackoverflow.com/comment/37151071
answer count: 2
has answer: http://stackoverflow.com/a/24088563
has title: JFrame MouseListener does not work
linked to: http://stackoverflow.com/q/286727
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/37151195
has comment: http://stackoverflow.com/comment/37152065
linked to: http://stackoverflow.com/q/1408080
has comment: http://stackoverflow.com/comment/37152137
has comment: http://stackoverflow.com/comment/37150973
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24088563

http://stackoverflow.com/comment/37177891
comment on: http://stackoverflow.com/a/24101796
type: AnswerComment
score: 0
type: Comment
has text: @MattCoubrough He asked what *unreachable code* means. How he wants to solve the problem (change while condition, change variable type, other) is up to OP. But yes, valid point.

http://stackoverflow.com/a/24099745
type: Answer
has body: This String s = (String)PropertiesLoaderUtils.loadProperties(new ClassPathResource("app.properties")).getProperty("login.url"); doesn't apply any property resolution while the RequestMappingHandlerMapping that processes @RequestMapping annotations does.
answers question: http://stackoverflow.com/q/24099691
score: 0

http://stackoverflow.com/comment/37114965
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24068025
has text: @Jens How can I do that?
score: 0

http://stackoverflow.com/q/23957521
upvote count: 1
type: Question
tagged with: facebook-like
accepted answer: http://stackoverflow.com/a/23960191
has title: what is the different ways to require FB like permissions?
has body: Can someone explain what is the difference in getting permissions in one of the two: 1) via code, on first Fb login: setContentView(R.layout.facebook_login); LoginButton authButton = (LoginButton) findViewById(R.id.authButton); // authButton.setReadPermissions(Arrays.asList("user_status")); authButton.setReadPermissions(Arrays.asList("basic_info", "user_birthday", "user_interests", "user_likes", "email", "user_location", "publish_actions")); 2) via Facebook developer page: if there is none, what is the duplication? App Details --&gt; Configure App Center Permissions
answer count: 1
downvote count: 0
score: 1
tagged with: facebook-graph-api
favorite count: 0
tagged with: android
tagged with: facebook
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23960191
tagged with: java

http://stackoverflow.com/q/23992078
tagged with: java
upvote count: 1
type: Question
has body: I have a question about the browser Locale. In pricipal, the request.getLocale retrieve the locale from the user's OS. I would like to retrieve the browser Locale independent of user's OS. The web site has multiable languages (german, italy, english), so that user can switch language manually. In the html page, there are meta element which show the difference. &lt;meta http-equiv="content-language" content="de" /&gt; "de" will be changed to en or other language due to user's click. The question is whether there is a way to retieve this info in java servlet. Update: In my LogoutServlet doPost method, I have a logout method which should retrieve the current language from html page of browser. String locale =request.getLocale().getDisplayLanguage(); It doesn't change to Fr or IT based on the content-language.
tagged with: servlets
answer count: 2
has title: get browser Locale
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23992206
possible better answer: http://stackoverflow.com/a/23992163
has answer: http://stackoverflow.com/a/23992163
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23992206

http://stackoverflow.com/comment/36927986
score: 0
has text: What do you mean by *I can't save my script*? It is a `String` after all, and it is `Serializable`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23968371

http://stackoverflow.com/q/24072518
has comment: http://stackoverflow.com/comment/38730235
has comment: http://stackoverflow.com/comment/38730411
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38730213
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24925749
tagged with: android
tagged with: java
has body: Hello I am fresher in android. but execute some project in eclipse. But today when I open eclipse then my old (Which I already run one day before) show error in left side panel of eclipse screen. I thoroughly checked all script but there are no error. but when I execute message shown YOUR PROJECT CONTAIN ERROR(S), PLEASE FIX THEM BEFORE RUNNING YOUR APPLICATION. Here is screen shoot of eclipse screen where error displayed Please help me.
type: Question
has comment: http://stackoverflow.com/comment/38730211
has title: android There are no error in project script but but no execute

http://stackoverflow.com/comment/36978894
comment on: http://stackoverflow.com/q/23957246
score: 0
type: Comment
type: QuestionComment
has text: Certainly, Derby by itself works fine on Ubuntu 14.04.

http://stackoverflow.com/q/24054888
upvote count: 1
has comment: http://stackoverflow.com/comment/37090758
tagged with: audio
tagged with: java
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37090926
favorite count: 0
has comment: http://stackoverflow.com/comment/37090641
has comment: http://stackoverflow.com/comment/37091442
type: Question
has comment: http://stackoverflow.com/comment/37090293
has comment: http://stackoverflow.com/comment/37090463
has comment: http://stackoverflow.com/comment/37090107
score: 1
has title: Playback the output of recorded Audio using javax.sound.sampled
has body: i have a problem verifying the output I´ve captured. My program should capture Audio from a mic and then save it as a WAVE file. It does that, but listening to the file only results in crumbling noises, no actual voice recorded. My code is this import java.io.IOException; import javax.sound.sampled.*; import java.io.File; public class Main { public static void main(String[] args) throws IOException, InterruptedException, LineUnavailableException { TargetDataLine line = null; DataLine.Info info = new DataLine.Info(TargetDataLine.class, getAudioFormat()); try { line = (TargetDataLine) AudioSystem.getLine(info); line.open(getAudioFormat()); } catch (LineUnavailableException e) { e.printStackTrace(); } line.start(); AudioInputStream stream = new AudioInputStream(line); Stopper stopper = new Stopper(line, stream); stopper.start(); File file = new File("C:/Users/Martin/Documents/soundfile.wav"); AudioSystem.write(stream, AudioFileFormat.Type.WAVE, file); System.out.println("Stopped..."); System.in.read(); } public static AudioFormat getAudioFormat() { AudioFormat.Encoding encoding = AudioFormat.Encoding.PCM_SIGNED; float sampleRate = 8000.0f; int sampleSizeInBits = 16; int channels = 2; int frameSize = 4; int frameRate = 8000; boolean bigEndian = true; return new AudioFormat(encoding, sampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian); } } The stopper thread is just this: import java.io.IOException; import javax.sound.sampled.*; public class Stopper extends Thread { TargetDataLine line = null; AudioInputStream stream = null; public Stopper(TargetDataLine line, AudioInputStream stream) { this.line = line; this.stream = stream; } public void run() { System.out.println("Press [RETURN] to stop capturing..."); try { System.in.read(); } catch (IOException e) {} line.stop(); try { stream.close(); } catch (IOException e) {} } } The Audioformat I´m using is accepted by my mic: Supported SourceDataLines of default mixer (Mikrofon (Creative SB X-Fi)): interface…

http://stackoverflow.com/comment/37067505
type: QuestionComment
has text: This question looks familiar. Didn't you ask this same thing recently? And why in the world would you start a new `CountDownTimer` each time through the `loop`?
comment on: http://stackoverflow.com/q/24043207
score: 0
type: Comment

http://stackoverflow.com/comment/36958009
type: AnswerComment
comment on: http://stackoverflow.com/a/23984318
type: Comment
has text: That is necessary but I don't think that is sufficient.
score: 1

http://stackoverflow.com/a/23950904
has body: To get your JSON sent with a POST request, you have to read the body of the request in a doPost method. Here's one way to do it : protected void doPost(HttpServletRequest hreq, HttpServletResponse hres) throws ServletException, IOException { StringWriter sw = new StringWriter(); IOUtils.copy(hreq.getInputStream(), sw, "UTF-8"); String json = sw.toString(); And then you'll have to parse the JSON. This may be done for example using Google gson. Supposing you have a class Thing with public parameters id and title, this would be Gson gson = new GsonBuilder().create(); Thing thing = gson.fromJson(json, Thing.class); int id = thing.id; String title = thing.title; Of course there are other solutions than gson to parse JSON but you have to parse it.
score: 1
has comment: http://stackoverflow.com/comment/36895192
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23950867
type: Answer

hibernate-search
tags question: http://stackoverflow.com/q/24011607
tags question: http://stackoverflow.com/q/24061561
type: Tag
tag name: hibernate-search
tags question: http://stackoverflow.com/q/24036224

http://stackoverflow.com/q/23994265
has answer: http://stackoverflow.com/a/23994436
answer count: 4
has answer: http://stackoverflow.com/a/23994361
type: UnansweredQuestion
downvote count: 1
tagged with: tile
upvote count: 3
tagged with: java
has body: I'm coding a Java tile based game, and I am interested in the best way to store a really big tile map in a database. (The entire map is divided into chunks.) I can store tiles data as a 2D array, or an array of strings (for each chunk), e.g.: ["1100111223333", "3130111213333", "1300311233333", .............................] where each number represents a concrete tile. This approach is the easiest, but when I use a really big map such as 20000x20000 tiles, it takes an indecent lot of memory! According to my calculations: if the array is 20000x20000 and each tile uses 3 bytes (I don't know exactly how much space a character in a string uses) then 20000*20000*3 = 1200000000 bytes or 1.14GB! That's too much space I think. Maybe I can also store data in the form of: ["G18W3S23G12W3", ["W13G3S5G12W3", .................................] which means 18 tiles of Grass then 3 tiles of Water then 2 tiles of Sand and so on... But I think it's a bad approach. Probably I can create images for every chunk and get tiles from it, but it is quite difficult to use images in a database, isn't it? So how can I do this most effectively? P.S: I use an array of strings, because I have no idea how to create a 2d array in SQL (is it possible?)
has answer: http://stackoverflow.com/a/23996447
has answer: http://stackoverflow.com/a/25201432
type: Question
has comment: http://stackoverflow.com/comment/36976709
score: 2
tagged with: arrays
tagged with: database
has comment: http://stackoverflow.com/comment/36976156
favorite count: 0
tagged with: sql
has title: How to store huge tile map?

jython-2.5
tag name: jython-2.5
type: Tag
tags question: http://stackoverflow.com/q/24057255

http://stackoverflow.com/a/24031944
answers question: http://stackoverflow.com/q/24019262
has comment: http://stackoverflow.com/comment/37063459
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/37053437
has comment: http://stackoverflow.com/comment/37066554
type: Answer
has body: The MediaPlayer class is actually a frontend for a subsystem within android known as the media player service. It's likely that the devices this is failing on lack vendor support for h264. In my experience with various set top android devices, for example, this system varies in its vendor implementations. As an aside, chromium for android uses the MediaPlayer class via a series of generated Jni bindings, so if your device does support h264, it should work in chromium. Unfortunately I don't think there's an easy fix, as h264 support isn't guaranteed everywhere. You could try switching to webm, if you have control of the media itself.
score: 2
has comment: http://stackoverflow.com/comment/37063895

http://stackoverflow.com/q/23987085
upvote count: 0
answer count: 1
has body: scene.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent ke) { if (ke.getCode() == KeyCode.SPACE) { System.out.println("space pressed"); } } }); scene.setOnKeyReleased(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent ke) { if (ke.getCode() == KeyCode.SPACE) { System.out.println("space released"); } } }); scene.setOnKeyTyped(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent ke) { if (ke.getCode() != KeyCode.SPACE) { System.out.println("typed"); } } }); JavaFX KeyTypedEvent conflit with KeyPressed and KeyReleasedEvent. Why I press SPACE key, also print "Typed", It's strange. Thanks!
favorite count: 0
tagged with: typed
has title: JavaFX KeyTypedEvent conflit with KeyPressed and KeyReleasedEvent
has answer: http://stackoverflow.com/a/23987106
type: AnsweredQuestion
tagged with: keyevent
accepted answer: http://stackoverflow.com/a/23987106
tagged with: javafx
downvote count: 1
type: Question
tagged with: java
score: -1

file-io
tags question: http://stackoverflow.com/q/23985733
tags question: http://stackoverflow.com/q/23987495
tags question: http://stackoverflow.com/q/23959072
tags question: http://stackoverflow.com/q/24083437
tags question: http://stackoverflow.com/q/24093549
tags question: http://stackoverflow.com/q/24038438
type: Tag
tags question: http://stackoverflow.com/q/24001535
tags question: http://stackoverflow.com/q/23965037
tags question: http://stackoverflow.com/q/24051538
tags question: http://stackoverflow.com/q/23964343
tags question: http://stackoverflow.com/q/24041576
tags question: http://stackoverflow.com/q/23970868
tags question: http://stackoverflow.com/q/23975398
tags question: http://stackoverflow.com/q/24029893
tags question: http://stackoverflow.com/q/24042095
tags question: http://stackoverflow.com/q/24005223
tags question: http://stackoverflow.com/q/24076612
tags question: http://stackoverflow.com/q/23977204
tag name: file-io
tags question: http://stackoverflow.com/q/24075352
tags question: http://stackoverflow.com/q/23983847
tags question: http://stackoverflow.com/q/23955836

http://stackoverflow.com/a/23982046
downvote count: 1
score: -1
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23981460
has body: Yes, JFileChooser is a Swing class, located in the JDK. See this excellent article by Vogella on how to work with dialogs in Eclipse

http://stackoverflow.com/comment/37023761
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24019195
has text: I guess I didnt, I didnt even think of looking in paint, just saw that as my colour :P

http://stackoverflow.com/a/23975616
answers question: http://stackoverflow.com/q/23975528
has comment: http://stackoverflow.com/comment/36940779
type: Answer
has body: Variable names are only known at compile time. You cannot create a variable name from the value of a String at run time.
has comment: http://stackoverflow.com/comment/36940800
score: 0

http://stackoverflow.com/q/23977485
has body: I have developed a Webservice client application using jaxrpc. Within eclipse the application runs fine, however after I have exported the jar file, I get the following runtime error D:\&gt;java -jar Myclient2.jar Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service Exception at Mynet.MyScheduler.&lt;init&gt;(MyScheduler.java:47) at Mynet.MyScheduler.&lt;init&gt;(MyScheduler.java:36) at Mynet.MyNetMain.main(MyNetMain.java:11) Caused by: java.lang.ClassNotFoundException: javax.xml.rpc.ServiceException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more I have tried to set the CLASSPATH variable but no changes. set CLASSPATH=%CLASSPATH%;D:\eclipse\plugins\javax.xml.rpc_1.1.0.v201209140446\lib\jaxrpc.jar set CLASSPATH=%CLASSPATH%;D:\eclipse\plugins\org.apache.axis_1.4.0.v201005080400\lib\axis.jar echo %CLASSPATH% java -jar Myclient2.jar I am rather new to java so definitely a newbie question KR
type: Question
answer count: 2
has title: NoClassDefFoundError executing jar using jaxrpc
has answer: http://stackoverflow.com/a/36297703
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23977535
tagged with: java
tagged with: eclipse
tagged with: classpath

http://stackoverflow.com/q/24035760
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: spring-security
has answer: http://stackoverflow.com/a/24062659
has body: In my spring project, I recently added to my jsp pages this tag: <sec:authorize access="hasPermission(#user, 'altera_usuario')"> col.append(' Editar '); </sec:authorize> <sec:authorize access="hasPermission(#user, 'remove_usuario')"> col.append(' Remover '); </sec:authorize> to allow me controll what is displayed to user. But the eclipse is displaying an error related to this tags (they are marked with a red underline), which don't prevent the project be built. When I run the project and open the page, the elment inside tag isn't displayed, despite the user had the permission. Anyone knos what's wrong here? ps.: the complete code for this page: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ include file="../../include/include.jsp" %> Lista de usuários <c:url value="/usuario/cadastra" var="cadastro"/> <c:url value="/usuario/altera" var="alteracao"/> <c:url value="/usuario/remove" var="remocao"/> <c:url value="/permissao/altera" var="permissao"/> <sec:authorize access="hasPermission(#user, 'cadastra_usuario')"> cadastrar novo usuário </sec:authorize> # Login Nome Sobrenome E-Mail # <c:url value="/usuario/listagem.json" var="lista"/>
has comment: http://stackoverflow.com/comment/37055430
accepted answer: http://stackoverflow.com/a/24062659
favorite count: 0
has comment: http://stackoverflow.com/comment/37068369
tagged with: spring
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/23974926
upvote count: 3
has comment: http://stackoverflow.com/comment/37067923
tagged with: java
has title: use of tag <sec:authorize> in the jsp pages displaying an error in eclipse
has comment: http://stackoverflow.com/comment/37059843
type: Question
has comment: http://stackoverflow.com/comment/37078378

http://stackoverflow.com/comment/36971138
has text: Question was just a theory, I never before seen Robot libs in use, I just want to know some opinion before I start develop something. Thanks for Your time.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23981421

http://stackoverflow.com/comment/37120947
comment on: http://stackoverflow.com/a/24071546
has text: Hello Etienne I think we have crossed the bridge already with Observer/Observable in that we all ready use it in another part of the system. So we might as well use it in this instance too. I understand what you are saying that you could probably build a better more OO version by implementing the observer pattern yourself but I prefer to use pre-existing components rather than do my own for reasons of speed and quality. So I take your answer to mean android doesn't provide a mechanism but Observer/Observable is one way to implement this scheme. As such you have provided a valid answer.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37123666
comment on: http://stackoverflow.com/a/24073449
type: AnswerComment
score: 0
type: Comment
has text: That's correct they will always come in the same order, but unfortunately I don't always know that they are both going to be there. It's a url string, so they can exist independently.

http://stackoverflow.com/comment/36974911
has text: what is your problem in doing?? there is many samples in goolge, check all and ask if you feel any specific problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23993844
score: 0

http://stackoverflow.com/comment/37126229
type: Comment
type: QuestionComment
has text: @BetaRide, please see output and unique user names means if one user name is repeated then it should store only once in excel sheet
comment on: http://stackoverflow.com/q/24074798
score: 0

http://stackoverflow.com/comment/37143714
type: AnswerComment
has text: @Boann Maybe add an example of using your `Accumulator` in a stream, for example `IntStream.rangeClosed (1,3).forEach (accumulator::apply)`? Up to you.
type: Comment
comment on: http://stackoverflow.com/a/24083215
score: 0

http://stackoverflow.com/q/23966950
has title: How to get a list of specific dates between two dates(start and end) in Android?
tagged with: calendar
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36925248
tagged with: java
tagged with: date
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/23967958
linked to: http://stackoverflow.com/q/39176755
has answer: http://stackoverflow.com/a/23967179
tagged with: android
has body: I have a requirement to show a list of dates between the start and end dates in my app. I have a list of checkboxes which have the days of the week beside them ie; Monday to Sunday and two date pickers which helps the user to select a start and end date. If a user doesn't select any checkbox containing the days of the week, I need to display all the dates alongwith the days of the week coming in between the start and end date. If a user selects some checkboxes ie; Monday, Wednesday, Friday I need to show only those dates and days of the week between the start and end date. Could you please let me know if there is any way in which this can be achieved? Thank you.
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/23953553
tagged with: security
score: 0
tagged with: char
linked to: http://stackoverflow.com/q/8881291
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23953554
upvote count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/8881291
has title: Why returns getPassword() from the Object JPasswordField an char[]?
tagged with: java
type: Question
has body: I'm writing a little Program to test the security of Java in general. public char[] getPW(){ return pwField.getPassword(); } This method return an char array. But why is that so? Is there any concrete idea behind? Why doesn't it returns a String?
answer count: 1
tagged with: string
favorite count: 0

http://stackoverflow.com/q/24033871
has comment: http://stackoverflow.com/comment/37092788
has comment: http://stackoverflow.com/comment/37095802
type: Question
has body: I am reading a csv file line by line and delimiting each line on the basis of tab delimiter.There is a line in file like :- "\"255U-2968RYE\" \"Organization\" \"ＳＭＢＣ日興証券 株式会社\" \"2968RYE\" I used split function format split("\t(?=([^\"]\"[^\"]\")[^\"]$)",-1). In my view split function should return a String array of size 4. But it is not working as I am expecting. I tried to change encoding type in eclipse and used different-2 like utf-8, ISO-8859-1 But did not work. File is of csv format. I am reading it using CSV open source api. as shown below. String read[]; int row = 0; int columns = 0; int totalElement = 0; String msg = null; int cols = (int) Double. parseDouble(totalColumns); try { CSVReader reader = new CSVReader(new FileReader(filePath),'\n'); if(titleAllowed.equalsIgnoreCase("yes")) reader.readNext(); while((read=(reader.readNext()))!=null) { row++; if(row==1) { columns = (read[0].split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)",-1)).length; if(cols !=columns) { JOptionPane.showMessageDialog(null, "Columns not matched as mentioned in checkList"); return false; } } if((columns!=0)&amp;&amp;(columns!=read[0].split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)",-1).length)) { msg = "Error exists in line "+row; return false; } if(!read[0].equals("")) totalElement+=(read[0].split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)",-1)).length; } reader.close(); }catch(Exception e) { e.printStackTrace(); } if(null!=msg) { JOptionPane.showMessageDialog(null, msg); } return (totalElement==row*columns); Correct answer is highly appreciated. Thanks in advance
tagged with: java
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/37074542
has comment: http://stackoverflow.com/comment/37101960
has comment: http://stackoverflow.com/comment/37085103
has title: How to deal with cp1252 encoding while Spliting a String contains Japanese Characters
score: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37198475
type: QuestionComment
comment on: http://stackoverflow.com/q/24041700
type: Comment
has text: I am using axis2 code generator in eclipse... I solved my problem by manually changing the type of the fields that I was expecting to be different in the generated code, and it worked... but my question is, is there a problem with using wrapper classes with wsdl? like wsdl doesn't support it or something like that? or is the problem in axis2?
score: 0

http://stackoverflow.com/a/24042701
type: Answer
has comment: http://stackoverflow.com/comment/37067172
has comment: http://stackoverflow.com/comment/37066566
upvote count: 0
has comment: http://stackoverflow.com/comment/37066887
has comment: http://stackoverflow.com/comment/37066602
has body: Try to not use regular expressions at all. In java, that is mostly: replaceAll split Pattern and Matcher classes If you can use the substring method or indexOf methods instead, do that!
score: -2
answers question: http://stackoverflow.com/q/24042516
downvote count: 2
has comment: http://stackoverflow.com/comment/37066636

http://stackoverflow.com/comment/120101794
comment on: http://stackoverflow.com/a/24045012
score: 0
type: Comment
has text: Using the Writer variant of the method using StringWriter and removing the first line before writing to the file (check for startsWith # if paranoid!), would be a relatively ok workaround if the file is not huge.
type: AnswerComment

http://stackoverflow.com/q/24085074
upvote count: 5
has body: I have an XML file that I open and edit few attributes in the node and then save it back, but due to some reason whatsoever the saved XML's are not indented properly as the one before. Here my code through which I save the XML file: TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(Path)); transformer.transform(source, result); Although I have specified transformer.setOutputProperty(OutputKeys.INDENT, "yes"); the XML is not indented properly, I would like to have the XML in the state as it was before (except the changes that were made) Any help will be really appreciated. Thanks a lot in advance.
answer count: 2
tagged with: xml-formatting
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24834482
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24085116
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question
score: 5
has title: XML formatting in java - Mainting the state indent

http://stackoverflow.com/comment/36925532
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23966579
has text: @kasdega can you update the example in your question to include the above case? So in this case what will H5 parent be if there are no previous H4's?

http://stackoverflow.com/a/24040495
has body: i am trying to change the row color based on the last column's value See Table Row Rendering for one solution that works by overriding the prepareRenderer(...) method of the JTable, so you don't need to provide a custom renderer for each data type in the table. I need to check the last value of the "data" Arraylist No, you should NOT be referencing the ArrayList. You should only ever reference the data in the TableModel. and did most of the things suggested therein Then it should work. The problem is with your code. Post your SSCCE that demonstrates your problem if the above solution doesn't help.
type: Answer
answers question: http://stackoverflow.com/q/24038676
score: 0

http://stackoverflow.com/a/23969807
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23969635
upvote count: 2
downvote count: 0
has body: If you're not going to return a ResultSet or Object object, then you should define your return type. You could create your own Post object for each row in the ResultSet, put those objects in a list, and return the list.

http://stackoverflow.com/comment/36994995
type: Comment
type: QuestionComment
has text: @Onik use the `Context` to do what?
comment on: http://stackoverflow.com/q/24003831
score: 0

http://stackoverflow.com/q/23996602
has comment: http://stackoverflow.com/comment/36987476
has answer: http://stackoverflow.com/a/29301894
type: UnansweredQuestion
has title: How to extend the Weblogic domain template?
type: Question
tagged with: jakarta-ee
tagged with: weblogic
tagged with: weblogic12c
tagged with: java
answer count: 1
score: 0
has body: I want to develop the Weblogic custom domain template for my application, the template should include the standalone WLS + JRF template and integrate with my application configuration. As we know, standalone WLS + JRF template are shipped in Weblogic installation folder, the JRF is depended upon lots of other templates, Can I create my own one only to extend them? or I have to create the one which includes all of them, that is, the template jar need includes all files copying from WLS + JRF templates and also plus my configuration, I tried it was unable to do with Weblogic domain template builder wizard. it seems I need firstly create workable domain then according it to build my domain template. Please guide me.
tagged with: templates

http://stackoverflow.com/comment/36973735
comment on: http://stackoverflow.com/q/23992957
type: Comment
type: QuestionComment
has text: Have you read the documentation? Seems like you just pass the wrong kind of data into the function
score: 0

http://stackoverflow.com/comment/37117532
has text: @eternay i solve it but still problem exist leme post my logcat
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24069912

http://stackoverflow.com/a/24075967
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24074772
accepted answer of: http://stackoverflow.com/q/24074772
has body: I found the answer! As I understand the answer is only in one place in entire internet. It's here: https://java.net/jira/browse/GLASSFISH-11700 This is an initial version of the fix which only supports one virtual server to be set while deploying a WAB. Like Web-ContextPath, user has to supply this information in MANIFEST.MF of the WAB. The header name is "Virtual-Servers." When the header is absent or the header name is empty, we only deploy to default virtual server. If user tries to set multiple virtual server in the manifest header Virtual-Servers, a runtime exception is raised at this point of time indicating that we don't yet support multiple virtual servers. We will fix it when I have some more time.
upvote count: 1

http://stackoverflow.com/a/24052747
answers question: http://stackoverflow.com/q/24052595
has body: You can do something like below. Put it in a map with count as value. Then simply count strings with count &gt; 1. String [] someArray = new String[]{"A", "B", "C", "A", "B", "C"}; Map&lt;String,Integer&gt; repeatationMap= new HashMap&lt;String,Integer&gt;(); for(String str : someArray){ if(repeatationMap.containsKey(str)) { repeatationMap.put(str,repeatationMap.get(str) + 1); } else { repeatationMap.put(str, 1); } } int count = 0; for(int repatCount : repeatationMap.values()){ if(repatCount &gt; 1) { count++; } } System.out.println("Number of Strings repeated : " + count);
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24052595
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24025846
score: 1
tagged with: java
has body: I'm using libgdx 1.1. Is it possible set the orthographic camera for the Stage in scene2d? I need it to add button in my app and at the same time to support different screen resolution. I've tried this code to adapt the screen: camera = new OrthographicCamera(); camera.setToOrtho(false, x, y); batch = new SpriteBatch();
has title: Orthographic camera and Stage
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24029963
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24029963
type: AnsweredQuestion
tagged with: libgdx

http://stackoverflow.com/comment/88093459
comment on: http://stackoverflow.com/a/50239165
type: AnswerComment
type: Comment
score: 3
has text: yes, rright direction. Moreover errors report in that html was well described and the errors were addressed ok, so I just corrected them with ease!

http://stackoverflow.com/a/24027567
has comment: http://stackoverflow.com/comment/63156578
has comment: http://stackoverflow.com/comment/63157913
type: Answer
upvote count: 7
has body: Basically, you need to create you own Caret and paint what ever you want... import java.awt.EventQueue; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.GridBagLayout; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.TextUI; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultCaret; import javax.swing.text.Document; import javax.swing.text.Element; import javax.swing.text.JTextComponent; import javax.swing.text.Position; public class CaretExample { public static void main(String[] args) { new CaretExample(); } public CaretExample() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JTextField field = new JTextField(10); field.setCaret(new MyCaret()); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); frame.add(field); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class MyCaret extends DefaultCaret { private String mark = "&lt;"; public MyCaret() { setBlinkRate(500); } @Override protected synchronized void damage(Rectangle r) { if (r == null) { return; } JTextComponent comp = getComponent(); FontMetrics fm = comp.getFontMetrics(comp.getFont()); int textWidth = fm.stringWidth("&gt;"); int textHeight = fm.getHeight(); x = r.x; y = r.y; width = textWidth; height = textHeight; repaint(); // calls getComponent().repaint(x, y, width, height) } @Override public void paint(Graphics g) { JTextComponent comp = getComponent(); if (comp == null) { return; } int dot …
score: 7
downvote count: 0
answers question: http://stackoverflow.com/q/24026774

http://stackoverflow.com/comment/37048934
type: Comment
type: QuestionComment
has text: As I know the .jar is already compiled and ready to run.
score: 0
comment on: http://stackoverflow.com/q/24033212

http://stackoverflow.com/comment/36983814
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23997815
has text: I'm not sure, but I have added an example which can be useful for resolving the problem
score: 0

http://stackoverflow.com/comment/37062473
comment on: http://stackoverflow.com/a/24040367
type: Comment
score: 0
type: AnswerComment
has text: but in my test, i still get an error like "cannot find symbol symbol: method SetInsert(<null>,<null>) location: variable test of type ConnectionSql"

http://stackoverflow.com/comment/36947636
type: QuestionComment
comment on: http://stackoverflow.com/q/23978887
has text: *"How to remove the JLabels from JPanel dynamically and add them again with a new ImageIcon?"* Don't do that. Either call `setIcon` or use a `CardLayout`.
score: 0
type: Comment

http://stackoverflow.com/comment/37066202
comment on: http://stackoverflow.com/q/24042161
has text: What will be the exact parameter input to your XPath expression? The String e.g. `"str"`? What about the block structure and scoping? In principle you will have to restrict your search to the innermost block containing the declaration of the variable.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24012196
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37074332
accepted answer of: http://stackoverflow.com/q/24003612
type: Answer
answers question: http://stackoverflow.com/q/24003612
score: 1
upvote count: 1
has body: You can always do a JNDI lookup in your code, you can use the JndiDataSourceLookup for that and call the getDataSource() method. public class MyService { @Autowired private JndiDataSourceLookup lookup; public void myMethod(String jndiName) { DataSource myDataSource = lookup.getDataSourcejndiName); } } Another option would be to make your bean aware of the BeanFactory and retrieve the DataSource from there. public class MyService { @Autowired private BeanFactory factory; public void myMethod(String jndiName) { DataSource myDataSource = factory.getBean(jndiName, DataSource.class); } }

http://stackoverflow.com/q/24079023
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24164752
score: 1
tagged with: java
type: Question
tagged with: unboundid-ldap-sdk
answer count: 1
downvote count: 0
tagged with: active-directory
favorite count: 0
has answer: http://stackoverflow.com/a/24095352
has title: Change account expiration date in "active directory" using Unbound Id?
tagged with: ldap
has body: I am trying to change the account expiration date in windows active directory. I can able to change the Never option in account expiry using the below code . final Modification mod = new Modification(ModificationType.REPLACE, "accountExpires", "9223372036854775807");//Can change the required date with milliseconds LDAPResult result=connection.modify(userDN, mod); But , If I tried to change the account expiry date means , the code executed successfully and success was printed in console . But the date is not changed in the AD. Here is my code to change or extend the account expiry date. public class AccountExpireSetting { public void ChangeAccountExpires(String userDN,String password , String dateToChange) throws LDAPException { LDAPConnection connection=null; String someDate = null; try { connection = new LDAPConnectionObject().getConnection(); } catch (LDAPException e1) { e1.printStackTrace(); } try{ SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy"); Date date = sdf.parse(dateToChange); System.out.println("Date to MillSeconds : "+date.getTime()); someDate = String.valueOf(date.getTime()); Date date1=new Date(date.getTime()); System.out.println("MillSeconds to Date : "+date1); } catch(Exception e){ e.printStackTrace(); } try{ System.out.println("Going to replace account expires to never"); final Modification mod = new Modification(ModificationType.REPLACE, "accountExpires", someDate);// 9223372036854775807 milliseconds can change the password to never expire // 9223372036854775807 LDAPResult result=connection.modify(userDN, mod); System.out.println("Account expires status : " + result); // Password status : LDAPResult(resultCode=0 (success), messageID=2, opType='modify') }catch(LDAPException e) { // TODO Auto-generated catch block System.out.println("Error in replacing account expires to never"); e.printStackTrace(); }finally { System.out.println("Closing the connection."); connection.close(); } } public static void main(String[] args) { // TODO Auto-generat…
accepted answer: http://stackoverflow.com/a/24095352
upvote count: 1

http://stackoverflow.com/q/23957958
tagged with: android
score: 1
has comment: http://stackoverflow.com/comment/36908599
has comment: http://stackoverflow.com/comment/36913586
has comment: http://stackoverflow.com/comment/36913494
linked to: http://stackoverflow.com/q/16056940
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36908704
upvote count: 1
has comment: http://stackoverflow.com/comment/36908624
linked to: http://stackoverflow.com/q/20987469
has body: android-numberpicker can be initiated with startActivity to launch an Activity: startActivity(new Intent(MainActivity.this, LightThemeActivity.class)); Can it be initiated as the view of an AlertDialog? That is, can it be instantiated as a View, which can then be provided as input to setView? E.g., something like: AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); View view = ... //instantiate android-numberpicker as a view builder.setView(view); where the ... is filled in. EDIT AndroidManifest.xml contains &lt;activity android:name="com.example.LightThemeActivity" android:theme="@style/SampleTheme.Light" /&gt; I think this must be relevant, since removing it means that startActivity(new Intent(MainActivity.this, LightThemeActivity.class)) doesn't work. SOLUTION The following code (in MainActivity.java) initiates NumberPicker as the view of an AlertDialog: NumberPicker np = new NumberPicker(MainActivity.this); np.setMaxValue(20); np.setMinValue(0); AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setView(np); builder.show(); You'll also need the following in your (in AndroidManifest.xml) &lt;activity android:name="example.MainActivity" android:theme="@style/SampleTheme"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; I was missing android:theme="@style/SampleTheme". QUESTION Why does getActivity().getLayoutInflater().inflate(R.layout.activity_light, null) produce an inflation exception? ANSWER Given that the style issue has been fixed, the above no longer throws an exception. Accordingly, an alternative solution is as follows: AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.activity_light, null); NumberPicker numberPicker = (NumberPicker) view.findViewById(R.id.numberPicker); …
has comment: http://stackoverflow.com/comment/36913284
tagged with: java
has answer: http://stackoverflow.com/a/23958488
type: Question
has comment: http://stackoverflow.com/comment/36908905
has comment: http://stackoverflow.com/comment/36911688
has comment: http://stackoverflow.com/comment/36915162
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36908862
has comment: http://stackoverflow.com/comment/36915172
favorite count: 0
has title: Can android-numberpicker be instantiated as a View?

http://stackoverflow.com/q/23974207
favorite count: 0
type: Question
score: 3
has answer: http://stackoverflow.com/a/23974236
upvote count: 3
tagged with: maven
tagged with: spring
answer count: 1
has title: The prefix "jpa" for element "jpa:repositories" is not bound
has body: When I try to do mvn clean install I get this error: [INFO] Caused by: org.xml.sax.SAXParseException; lineNumber: 38; columnNumber: 64; The prefix "jpa" for element "jpa:repositories" is not bound. The spring context xml I have is: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:task="http://www.springframework.org/schema/task" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> What could be missing in the context XML? Also h…
accepted answer: http://stackoverflow.com/a/23974236
tagged with: java
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/37008922
score: 0
comment on: http://stackoverflow.com/q/24011843
type: Comment
has text: @R.J I'm on the basics (chapter 4). Passing and returning types comes much later.
type: QuestionComment

http://stackoverflow.com/comment/37144142
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24081105
type: Comment
has text: @ksascha you basically have to do it in two passes, at least for forward jumps.

http://stackoverflow.com/comment/36971063
has text: the join will block completely the UI thread until your thread dies, and nobody can assure you that the Runnable you posted on the blocked ui thread, is going to be processed before or after `mTextView.setText("MainThread");`
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/23991746

http://stackoverflow.com/comment/36896388
comment on: http://stackoverflow.com/q/23951001
score: 0
type: Comment
type: QuestionComment
has text: dude posting witty comments won't help.... i am new to this language so help would be appreciated

http://stackoverflow.com/comment/45631675
type: Comment
has text: I can see that some are saying their usb flash drive is accessible thru usbdisk path and not UsbDriveA : if you want to cover all cases you can test both : if with /storage/UsbDriveA/ your usbManager is still null, then try with /storage/usbdisk/ etc... (and maybe a few others if you can find a list of different paths, although there shouldn't be a huge number of different paths here)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/28652419

http://stackoverflow.com/a/23948951
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36891557
type: Answer
score: 2
upvote count: 2
has body: android.R - resources from Android SDK. R. - resources created in your project.
has comment: http://stackoverflow.com/comment/36893499
accepted answer of: http://stackoverflow.com/q/23948914
answers question: http://stackoverflow.com/q/23948914

http://stackoverflow.com/q/24010377
has title: Change ASP to Java technology?
tagged with: servlets
type: Question
tagged with: asp-classic
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/37045721
score: 0
has comment: http://stackoverflow.com/comment/37031263
has comment: http://stackoverflow.com/comment/37019969
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24025506
has comment: http://stackoverflow.com/comment/37006277
tagged with: graphics
has body: I need help on how to propose a new website. I don’t know how to start and I hope you can guide me( if it is better to make an applet , a servlet, use other technology, etc. ) . I have a website in ASP, it reads text files that are on the server in the same directory as the web . There are n files (may be about 300 plain text files generated by an external application ) . The website only read them, generates a menu with the data they contain . Depending on the selected menu options , read a specific files and pass this information to Flash movies which generate statistical graphs. Flash movies are very old and actually cause problems in browsers. They can’t be loaded on all platforms for example. And the ASP technology is also obsolete. We want to change the technology and create a web that reads a series of text files hosted on the server and pass these parameters to a graphic (we would use javascript libraries, for example Morris). We are interested for JAVA. What you recommend?. if its JAVA , this can be done with Applets ? or Should we use servlets?? or Is there an easier way to do it?
tagged with: java

http://stackoverflow.com/comment/36986500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23999334
has text: I have never used a CallBack but it does kind of make sense. The thing I don't know how to do is how will I know when the ListView is done loading?
score: 0

http://stackoverflow.com/a/24012679
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24012576
type: AcceptedAnswer
downvote count: 0
has body: Use JDK 7. The version numbering was changed a while ago and 1.7 is actually the same as 7.
type: Answer
accepted answer of: http://stackoverflow.com/q/24012576

http://stackoverflow.com/comment/113506186
has text: @RamKowsu Yeah, I was just referring to the fact that this this interface, the `public abstract` is actually written out. It usually isn't, since it's implied in interfaces. It was meant as a lighthearted comment, not anything to be taken very seriously. :-)
score: 0
comment on: http://stackoverflow.com/a/23958916
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24122277
score: 4
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23983298
has body: I tried RUDP and found that i was not printing my output, i know this is a silly mistake. UDP Client package UDPClient; import java.io.IOException; import java.io.InputStream; import java.net.InetSocketAddress; import net.rudp.ReliableSocket; /** * * @author Nika */ public class UDPtestc { ReliableSocket server; public UDPtestc() throws IOException { server = new ReliableSocket(); server.connect(new InetSocketAddress("127.0.0.1", 9876)); byte[] buffer = new byte[1024]; int count,progress=0; InputStream in = server.getInputStream(); while((count=in.read(buffer)) &gt;0){ progress+=count; System.out.println(""+progress); } server.close(); } public static void main(String[] args) throws IOException { new UDPtestc(); } } UDPserver package UDPServer; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.io.RandomAccessFile; import java.net.Socket; import java.util.logging.Level; import java.util.logging.Logger; import net.rudp.ReliableServerSocket; import net.rudp.ReliableSocket; /** * * @author Nika */ public class UDPtests implements Runnable { ReliableServerSocket rss; ReliableSocket rs; String file; FileInputStream bin; public UDPtests() throws IOException { rss = new ReliableServerSocket(9876); Thread serverthread = new Thread(this); serverthread.start(); } public void run() { while (true) { try { rs = (ReliableSocket)rss.accept(); System.out.println("Connection Accepted"); System.out.println("" + rs.getRemoteSocketAddress()); file = ""; Long size=0L; file += "10MB.txt"; size+=10*1024*1024; RandomAccessFile r1= new RandomAccessFile(file,"rw"); r1.setLength(size); byte[] sendData = new byte[1024]; OutputStream os = rs.getOutputStream(); //FileOutputStream wr = new FileOutputStream(new File(file)); bin= new FileInputStream(file); int bytesReceived = 0; int progress = 0; while ((bytesReceived = bin.read(sendData)) &gt; 0) { /* Write to the file */ os.write(sendData, 0, bytesReceived); progress += bytesReceived; System.out.p…
upvote count: 4
answers question: http://stackoverflow.com/q/23983298
downvote count: 0
has comment: http://stackoverflow.com/comment/135791693

http://stackoverflow.com/comment/37096746
score: 0
type: QuestionComment
has text: Questions on Stack Overflow are publicly available and feature high up in the search results on Google. So it won't be "just for your own knowledge" in practice - it will be to the knowledge of everyone that searches for it. Which in this case would be a **Bad Thing**.
type: Comment
comment on: http://stackoverflow.com/q/24058899

http://stackoverflow.com/comment/36921554
type: QuestionComment
comment on: http://stackoverflow.com/q/23964792
score: 0
has text: "Am I correct in assuming that the properties file should be read by a listener" - no.
type: Comment

http://stackoverflow.com/comment/36950528
comment on: http://stackoverflow.com/a/23980847
type: Comment
type: AnswerComment
has text: Oooh I didn't know about this. I'm so noob lol. thanks :D
score: 0

http://stackoverflow.com/comment/36914135
score: 0
type: Comment
type: QuestionComment
has text: I need to know the context, there are many other lines in the file
comment on: http://stackoverflow.com/q/23960959

http://stackoverflow.com/comment/37026922
has text: first type starts with figures like 1h,2h,5k etc. and second type starts with alphabets like fsh,ggk,nas, ilk etc.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24021228

http://stackoverflow.com/a/25157447
has comment: http://stackoverflow.com/comment/39574198
accepted answer of: http://stackoverflow.com/q/23996575
answers question: http://stackoverflow.com/q/23996575
type: AcceptedAnswer
downvote count: 0
has body: We have a TextField (username), a PasswordField (password) and a Button on a UI: public class MyUI extends UI { @Override protected void init( VaadinRequest request ) { setContent( VaadinSession.getCurrent().getAttribute("userId") == null ? getNewLoginLayout() : getNewMainLayout() ); } private VerticalLayout getNewLoginLayout() { TextField username = ... TextField password = ... Button login = ... return new VerticalLayout(username, password, login); } } When the button pushed we do a simple LDAP search like this on the server side (for example pass these parameters to a Spring bean). If it is successful we set a VaadinSession attribute (userId) and change the UI content to the main layout. Spring security need not necessarily.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/39547611
upvote count: 1

http://stackoverflow.com/comment/96502860
type: Comment
type: QuestionComment
score: 0
has text: Hi @Bharanikumar, Did you got the solution. if yes then please suggest me i am having same problem.
comment on: http://stackoverflow.com/q/23951571

http://stackoverflow.com/q/24060747
upvote count: 1
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: gridview
type: UnansweredQuestion
tagged with: android
tagged with: animation
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24082002
has title: How to divide a View into equal size of rows and column (cells) from xml in android?
type: Question
has body: I am creating a Snakes and ladder game on android. For the board, I am using a background image. When that background is loaded, I get the height and width of this image, and according to it resize the tokens(player 1 and 2 token), and place them at appropriate position. For calculating position, I divide the height and width with number of rows and columns. For moving each token I am changing there x and y position appropriately in the OnDraw method. This solution is working but this is not efficient and it have some problems like tokens move with different speeds on different resolution screens, and the code has also become complex. So is there a way in which I can divide the View into given numbers of rows and columns and then move the tokens using animation class. Or any other efficient solution. I have tried using GridView in xml but it doesn't divide the cells into equal size. Also in onCreate method I am not getting the Height and width of the background image. Thanks in advance. Sorry if question is not formated correctly.

http://stackoverflow.com/comment/36944814
comment on: http://stackoverflow.com/q/23977654
has text: `contentPane.setLayout(new GridLayout(4, 4)); .. contentPane.add(Labels.Main_MENU,BorderLayout.NORTH);` Makes no sense. We cannot use `BorderLayout` constraints effectively if the layout is `GridLayout`!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24043320
score: 0
has comment: http://stackoverflow.com/comment/37068162
type: Answer
has comment: http://stackoverflow.com/comment/37068424
has body: You are probably using a GridLayout to prescribe the size of the elements in your panel. Consider using a different layout within your JPanel such as a GridBagLayout. For example: import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.GridBagLayout; import javax.swing.JLabel; import java.awt.GridBagConstraints; import javax.swing.JComboBox; import java.awt.Insets; public class IsotopeDetails extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { IsotopeDetails frame = new IsotopeDetails(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public IsotopeDetails() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); contentPane.add(panel, BorderLayout.CENTER); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 0, 0}; gbl_panel.rowHeights = new int[]{0, 0}; gbl_panel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); JLabel lblIsotopeDetails = new JLabel("Isotope Details"); GridBagConstraints gbc_lblIsotopeDetails = new GridBagConstraints(); gbc_lblIsotopeDetails.insets = new Insets(0, 0, 0, 5); gbc_lblIsotopeDetails.anchor = GridBagConstraints.EAST; gbc_lblIsotopeDetails.gridx = 0; gbc_lblIsotopeDetails.gridy = 0; panel.add(lblIsotopeDetails, gbc_lblIsotopeDetails); JComboBox comboBox = new JComboBox(); GridBagConstraints gbc_comboBox = new GridBagConstraints(); gbc_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox.gridx = 1; gbc_comboBox.gridy = 0; panel.add(comboBox, gb…
has comment: http://stackoverflow.com/comment/37067940
answers question: http://stackoverflow.com/q/24043163

http://stackoverflow.com/comment/36967892
comment on: http://stackoverflow.com/q/23989625
score: 0
has text: Wouldn't you mind to show StackTrace when soTimeout is exhausted ? I'll try to find the code from there, where you can wedge
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24013139
answers question: http://stackoverflow.com/q/24012560
score: 0
accepted answer of: http://stackoverflow.com/q/24012560
type: Answer
has body: Please, check in the Database options, if the db have the auto-commit option selected. If auto-commit isnt possible, make a db.commit() after each transaction and make your transaction class synchcronized (for safe reasons).
type: AcceptedAnswer

http://stackoverflow.com/a/24051207
answers question: http://stackoverflow.com/q/24033829
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: If you plan to use map instead, here is something as well (without using as) which can be implemented: class TestObject { private int a = 1 protected int b = 2 public int c = 3 int d = 4 String s = "s" } TestObject obj = [a: 1, b: 2, c: 3, d: 6, s: 's'] assert obj.a == 1 &amp;&amp; obj.b == 2 &amp;&amp; obj.c == 3 &amp;&amp; obj.d == 6 &amp;&amp; obj.s == 's'

http://stackoverflow.com/comment/37126251
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24074868
has text: @SotiriosDelimanolis What you mean by network console ?
score: 0

http://stackoverflow.com/a/24027721
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24027629
has body: You could try using a BoxLayout instead of a FlowLayout. In that case, you could have: JPanel centerPanel = new JPanel(new BoxLayout()); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); // Y_AXIS will cause the components to be added vertically centerPanel.add(openReportSelection); centerPanel.add(closeButton); centerPanel.setMaximumSize(new Dimension(100, 60)); // Set the maximum horizontal and vertical distances used, as BoxLayouts expand to fill the provided area Or as Hovercraft said, you could use a GridLayout, in which case you would specify it as follows: JPanel centerPanel = new JPanel(new GridLayout(1,0); // The "0" parameter specifies as many rows as needed, but only one column centerPanel.add(openReportSelection); centerPanel.add(closeButton); centerPanel.setMaximumSize(new Dimension(100, 60)); // GridLayouts will also expand to fill the entire area, so you'll probably want some size parameters. You could also see this link for more on BoxLayouts, or this link for more on GridLayouts.
upvote count: 1

jsp
tags question: http://stackoverflow.com/q/23993942
tags question: http://stackoverflow.com/q/24035910
tags question: http://stackoverflow.com/q/24096768
tags question: http://stackoverflow.com/q/24103824
tags question: http://stackoverflow.com/q/24017544
tags question: http://stackoverflow.com/q/23979602
tags question: http://stackoverflow.com/q/24042313
tags question: http://stackoverflow.com/q/24039570
tags question: http://stackoverflow.com/q/24016500
tags question: http://stackoverflow.com/q/24049291
tags question: http://stackoverflow.com/q/23947701
tags question: http://stackoverflow.com/q/24060592
tags question: http://stackoverflow.com/q/24015198
tags question: http://stackoverflow.com/q/23970135
tags question: http://stackoverflow.com/q/24055314
tags question: http://stackoverflow.com/q/24028314
tags question: http://stackoverflow.com/q/24079031
tags question: http://stackoverflow.com/q/24035760
tags question: http://stackoverflow.com/q/24008146
tags question: http://stackoverflow.com/q/24075726
tags question: http://stackoverflow.com/q/24063808
tags question: http://stackoverflow.com/q/23948487
tags question: http://stackoverflow.com/q/23981731
tags question: http://stackoverflow.com/q/24000459
tags question: http://stackoverflow.com/q/23975804
tags question: http://stackoverflow.com/q/24096448
tags question: http://stackoverflow.com/q/23977417
tags question: http://stackoverflow.com/q/24074221
tags question: http://stackoverflow.com/q/24095418
tags question: http://stackoverflow.com/q/23947297
tags question: http://stackoverflow.com/q/24067571
tags question: http://stackoverflow.com/q/23994966
tags question: http://stackoverflow.com/q/24035128
tags question: http://stackoverflow.com/q/23983895
tags question: http://stackoverflow.com/q/24088836
tags question: http://stackoverflow.com/q/23967323
tags question: http://stackoverflow.com/q/24036013
tags question: http://stackoverflow.com/q/24070917
tags question: http://stackoverflow.com/q/24102859
tags question: http://stackoverflow.com/q/24032545
tags question: http://stackoverflow.com/q/23993440
type: Tag
tags question: http://stackoverflow.com/q/24088936
tags question: http://stackoverflow.com/q/24042889
tags question: http://stackoverflow.com/q/24050371
tags question: http://stackoverflow.com/q/24056713
tags question: http://stackoverflow.com/q/23955391
tags question: http://stackoverflow.com/q/24074376
tags question: http://stackoverflow.com/q/23976844
tags question: http://stackoverflow.com/q/23989299
tags question: http://stackoverflow.com/q/24005607
tags question: http://stackoverflow.com/q/24012325
tags question: http://stackoverflow.com/q/23980683
tags question: http://stackoverflow.com/q/23952229
tags question: http://stackoverflow.com/q/24073864
tag name: jsp
tags question: http://stackoverflow.com/q/24057649
tags question: http://stackoverflow.com/q/24093242
tags question: http://stackoverflow.com/q/24084864
tags question: http://stackoverflow.com/q/23977256
tags question: http://stackoverflow.com/q/23989743
tags question: http://stackoverflow.com/q/24066367
tags question: http://stackoverflow.com/q/24021858
tags question: http://stackoverflow.com/q/24028155
tags question: http://stackoverflow.com/q/24069293
tags question: http://stackoverflow.com/q/24011963
tags question: http://stackoverflow.com/q/23952848
tags question: http://stackoverflow.com/q/23970960
tags question: http://stackoverflow.com/q/23971641
tags question: http://stackoverflow.com/q/23949625
tags question: http://stackoverflow.com/q/24064436
tags question: http://stackoverflow.com/q/24073693
tags question: http://stackoverflow.com/q/24004668
tags question: http://stackoverflow.com/q/23952708
tags question: http://stackoverflow.com/q/24034458
tags question: http://stackoverflow.com/q/24078964
tags question: http://stackoverflow.com/q/23999851
tags question: http://stackoverflow.com/q/24045540
tags question: http://stackoverflow.com/q/24059618
tags question: http://stackoverflow.com/q/23998949

http://stackoverflow.com/a/23993052
has comment: http://stackoverflow.com/comment/37017411
type: Answer
upvote count: 2
has body: I'll give you an example in pseudocode: listA = [1, 2, 3] listB = [a, b, c] listA x listB = [(1, a), (1, b), (1, c), ...] # excluded listAe = [1, 3] listBe = [a, b] listAe x listBe = [(1, a), (1, b), ...] # result listA x listB - listAe x listBe = [(1, c), (2, a), (2, b), (2, c), (3, c)] Now you should only iterate over result pairs.
answers question: http://stackoverflow.com/q/23992700
has comment: http://stackoverflow.com/comment/36995432
accepted answer of: http://stackoverflow.com/q/23992700
has comment: http://stackoverflow.com/comment/37010720
score: 2
type: AcceptedAnswer
downvote count: 0

gatt
tags question: http://stackoverflow.com/q/24070968
tag name: gatt
type: Tag

http://stackoverflow.com/q/24095418
has answer: http://stackoverflow.com/a/24095757
tagged with: jsp
has title: JSP - Get Add result in the same form/same page
tagged with: servlets
downvote count: 0
has body: I am trying to figure out how to add two nubers and have the result on the same page using Java/jsp (in this case - in the "result" area in the jsp. I tried with session attribute, but there is still something wrong with my code... I do not want to use javascript etc, but "pure java" only :) Could you help: Servlet: package wprowadzenie; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @WebServlet("/AddServlet.html") public class AddServlet extends HttpServlet { private static final long serialVersionUID = 1L; private Integer getInt(String s) { try { Integer a = new Integer(s); return a; } catch (NumberFormatException e) { return null; } } public void serviceRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher rd = request.getRequestDispatcher("/add.jsp"); rd.forward(request, response); String no1 = request.getParameter("a"); String no2 = request.getParameter("b"); Integer one = getInt(no1); Integer two = getInt(no2); if (one != null && two != null) { int result = one + two; System.out.println(result); HttpSession session = request.getSession(); session.setAttribute("result", result); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("get"); serviceRequest(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("post"); serviceRequest(request, response); } } JSP: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> Insert title here B A Result:
favorite count: 0
has comment: http://stackoverflow.com/comment/37164837
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37165087
has answer: http://stackoverflow.com/a/24095744
score: 2
tagged with: java
tagged with: http
type: Question
answer count: 2

http://stackoverflow.com/comment/113027552
type: Comment
has text: @santhanam Beware that indexOf will return the index of the first occurance of the element
type: AnswerComment
comment on: http://stackoverflow.com/a/23981032
score: 0

http://stackoverflow.com/comment/37188275
type: QuestionComment
has text: Any luck skiwi?... Did you try running a small example like what I've shown above?
type: Comment
comment on: http://stackoverflow.com/q/24025995
score: 0

http://stackoverflow.com/comment/37052977
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24035478
has text: Try it this way 'public void DrawerListItem(){ RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.test); relativeLayout .setBackgroundResource(R.drawable.blue_gradient_background); }'

http://stackoverflow.com/q/23978464
tagged with: webdriver
has answer: http://stackoverflow.com/a/46275911
type: Question
score: 6
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23978503
favorite count: 0
type: UnansweredQuestion
upvote count: 6
has title: ChromeDriver: Custom Chrome Executable Path
tagged with: selenium-webdriver
tagged with: selenium-chromedriver
tagged with: java
has body: I'm using the portable version of Google Chrome. Since WebDriver expects the default installation path, it does not find the portable one which obviously is at another location: Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 11.13 seconds Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19' System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05' Driver info: org.openqa.selenium.chrome.ChromeDriver How do I set a custom path to the chrome.exe file?
tagged with: google-chrome

http://stackoverflow.com/comment/36982327
type: Comment
has text: The Retargeting Output Stream would simply have to be synchronized to allow setting a new target without perturbing the write process. Any block synchronized on it would delay any write, allowing the file switch.
comment on: http://stackoverflow.com/a/23997117
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37162823
has text: For some reason some of the jars aren't being included in your WEB-INF/lib. I'm missing `spring-beans`, `spring-orm`, `spring-jdbc` and `spring-td`.
comment on: http://stackoverflow.com/q/24086675
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24009149
has comment: http://stackoverflow.com/comment/37087298
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24061051
has comment: http://stackoverflow.com/comment/37004538
possible better answer: http://stackoverflow.com/a/24181632
has comment: http://stackoverflow.com/comment/37012635
has comment: http://stackoverflow.com/comment/37012525
has body: I am streaming mic input from a C Server via socket. I know the stream works because it does with a C client and I am getting the right values on my Android client. I am streaming a 1024 floatarray. One float are 4 bytes. So I got a incoming stream with 4096 bytes per frame. I am getting the floats out of this bytes and I know this floats are the ones I sent, so that part should work. Now I want to get that stream directly to the phones speakers by using AudioTrack. I tried to input the bytes I received directly: just noise. I tried to cast it back to a byte array, still the same. I tried to cast that float into short (because AudioTrack takes bytes or short). I could get something that could have been my mic input (knocking), but very scratchy and and extremely laggy. I would understand if there was a lag between the frames, but I can't even get one clear sound. I can, however, output a sin sound clearly that I produce locally and put into that shortarray. Now I wonder if I got some issues in my code anyone of you can see, because I don't see them. What I am doing is: I put 4 bytes in a byte array. I get the float out of it. As soon as I got one Frame in my float array (I am controlling that with a bool, not nice, but it should work) I put it in my shortarray and let audiotrack play it. This double casting might be slow, but I do it because its the closest I got to playing the actual input. Edit: I checked the endianess by comparing the floats, they have the proper values between -1 and 1 and are the same ones I send. Since I don't change the endianess when casting to float, I don't get why forwarding a 4096 byte array to AudioTrack directly doesn't work neither. There might be something wrong with the multithreading, but I don't see what it could be. Edit 2: I discovered a minor problem - I reset j at 1023. But that missing float should not have been the problem. What I did other than that was to put the method that took the stream from the socket in another threa…
tagged with: java
score: 16
type: Question
has comment: http://stackoverflow.com/comment/37012202
tagged with: audio-streaming
has comment: http://stackoverflow.com/comment/37100475
has comment: http://stackoverflow.com/comment/37012572
upvote count: 18
has comment: http://stackoverflow.com/comment/37004269
has comment: http://stackoverflow.com/comment/37070502
tagged with: audiotrack
answer count: 2
has answer: http://stackoverflow.com/a/24181632
has comment: http://stackoverflow.com/comment/37094393
has comment: http://stackoverflow.com/comment/37013010
has comment: http://stackoverflow.com/comment/37011877
has comment: http://stackoverflow.com/comment/37012019
favorite count: 0
has comment: http://stackoverflow.com/comment/37004387
has comment: http://stackoverflow.com/comment/37004163
has title: Audio streaming via TCP socket on Android
accepted answer: http://stackoverflow.com/a/24061051
tagged with: sockets
tagged with: android
downvote count: 2
has comment: http://stackoverflow.com/comment/37094573

http://stackoverflow.com/a/24531713
type: Answer
has body: After googling and research, I found Socket.io better option for Our case Socket.IO is a WebSocket API created by Guillermo Rauch, CTO of LearnBoost and lead scientist of LearnBoost Labs. Socket.IO will use feature detection to decide if the connection will be established with WebSocket, AJAX long polling, Flash, etc., making creating realtime apps that work everywhere a snap. Socket.IO also provides an API for Node.js which looks very much like the client side API.
answers question: http://stackoverflow.com/q/23991376
score: 0

http://stackoverflow.com/comment/37040365
score: 1
type: Comment
type: AnswerComment
has text: @maaartinus Sorry, last paragraph I was referring to regular arrays, not `ArrayList`s, because OP was talking about that in his/her last paragraph. I'll make that clear.
comment on: http://stackoverflow.com/a/24026992

http://stackoverflow.com/a/23976888
answers question: http://stackoverflow.com/q/23976804
type: Answer
downvote count: 0
score: 1
has body: Next to means either before or after. Loop through each number and check the values before and after to see if there's an adjacent 2. The special cases are when you're checking the 1st and last element because there won't be an element before or after to check. public boolean twoTwo(int[] nums) { if(nums.length == 1 &amp;&amp; nums[0] == 2) return false; for(int i = 0; i &lt; nums.length; i++) { if(nums[i] == 2) { if(i == 0) { // check the next element if(nums[i+1] != 2) return false; } else if(i == (nums.length - 1)) { // check the previous element if(nums[i-1] != 2) return false; } else { // check both if(nums[i+1] != 2 &amp;&amp; nums[i-1] != 2) return false; } } } return true; }
upvote count: 1

http://stackoverflow.com/q/24037673
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37092819
has body: What is the ORA-17162 error (unsupported holdability value) in jdbc? we are getting this when using ojdbc7 with jboss 6.2 GA. The application was working fine when we were using ojdbc14. Once we switched to ojdbc7 the problems started arising.
has title: ORA-17162 error in jdbc
tagged with: java
has comment: http://stackoverflow.com/comment/37069853
tagged with: jboss
type: Question
tagged with: sql
downvote count: 0
favorite count: 0
tagged with: oracle-database
tagged with: jdbc

http://stackoverflow.com/comment/37155401
comment on: http://stackoverflow.com/a/24069131
type: AnswerComment
has text: This is interesting but I need to stay away from the XML because after this project I will no longer be using TestNG. I will be converting from Java to C# and will be using Nunit which I dont believe has the XML functionality.
score: 0
type: Comment

http://stackoverflow.com/comment/37032769
type: AnswerComment
comment on: http://stackoverflow.com/a/24024453
has text: +1 for adding the scroll pane to the content pane. A Swing component can only have a single parent, so you add the text area to the viewport of the scroll pane and then add the scroll pane to the frame.
type: Comment
score: 1

http://stackoverflow.com/q/23977417
linked to: http://stackoverflow.com/q/21115009
has title: error in transaction in Sparql and jena tdb?
type: UnansweredQuestion
tagged with: tdb
has comment: http://stackoverflow.com/comment/41887607
answer count: 0
linked to: http://stackoverflow.com/q/24349035
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/45637040
type: Question
has body: This is my jena code: package neww; import static com.hp.hpl.jena.query.ReadWrite.READ ; import static com.hp.hpl.jena.query.ReadWrite.WRITE ; import com.hp.hpl.jena.query.ReadWrite ; import com.hp.hpl.jena.query.Dataset ; import com.hp.hpl.jena.query.Query ; import com.hp.hpl.jena.query.QueryExecution ; import com.hp.hpl.jena.query.QueryExecutionFactory ; import com.hp.hpl.jena.query.QueryFactory ; import com.hp.hpl.jena.query.QuerySolution ; import com.hp.hpl.jena.query.ResultSet ; import com.hp.hpl.jena.tdb.TDBFactory ; import com.hp.hpl.jena.query.ResultSetFormatter; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.vocabulary.*; import java.util.Iterator; import java.util.Scanner; import com.hp.hpl.jena.sparql.sse.SSE ; import com.hp.hpl.jena.update.* ; import java.util.*; public class Si{ public String retur(){ String query1; query1="hjcooljohny75@gmail.com"; //query1 = (String)(subjectentry.getText()); String s="SELECT ?x WHERE { ?x &lt;TO:&gt; '"+query1+"'}"; // subjectoutput.setText(s); String directory = "/usr/local/apache-tomcat-8.0.8/webapps/examples/WEB-INF/classes/neww/MYDATABASES/DATA2" ; Dataset ds = TDBFactory.createDataset(directory) ; Model model = ds.getDefaultModel() ; ds.begin(ReadWrite.READ) ; QueryExecution qExec = QueryExecutionFactory.create(s, ds) ; ResultSet rs = qExec.execSelect() ; String x=rs.toString(); String[] arr = null; while (rs.hasNext()) { QuerySolution qs = rs.next(); String rds = qs.get("x").toString(); // String em = (String)rs.getString(0); //arr = em.split("\n"); //for (int i =0; i &lt; arr.length; i++){ return rds; } //if(rs==null) //subjectoutput.setText("sorry!!"); String f="h"; return x; and this is giving error: com.hp.hpl.jena.tdb.transaction.TDBTransactionException: Not in a transaction com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.get(DatasetGraphTransaction.java:106) com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction.get(DatasetGraphTransaction.java:4…
downvote count: 0
tagged with: jsp
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/a/23988904
has comment: http://stackoverflow.com/comment/36966056
upvote count: 3
has comment: http://stackoverflow.com/comment/36965906
score: 3
type: AcceptedAnswer
downvote count: 0
has body: I believe this could work for you, if you are targeting API17 +. If not you should take a look at ViewContainers, and swipeable views. import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTabHost; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class TabHostParentFragment extends Fragment { private FragmentTabHost tabHost; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { tabHost = new FragmentTabHost(getActivity()); tabHost.setup(getActivity(), getChildFragmentManager(), R.layout.my_parent_fragment); Bundle arg1 = new Bundle(); arg1.putInt("Arg for Frag1", 1); tabHost.addTab(tabHost.newTabSpec("Tab1").setIndicator("Frag Tab1"), NewsFragment.class, arg1); Bundle arg2 = new Bundle(); arg2.putInt("Arg for Frag2", 2); tabHost.addTab(tabHost.newTabSpec("Tab2").setIndicator("Frag Tab2"), MyNestedFragment2.class, arg2); return tabHost; }
has comment: http://stackoverflow.com/comment/50907067
accepted answer of: http://stackoverflow.com/q/23988654
type: Answer
answers question: http://stackoverflow.com/q/23988654

http://stackoverflow.com/a/32395326
has body: You can append custom query parameters to your request, so you should be able to pass in security credentials that way. You should of course be sure to use HTTPS in that case. https://help.nexmo.com/hc/en-us/articles/203806548-Can-I-Append-Custom-Parameters-to-the-Callback-URL-
type: Answer
answers question: http://stackoverflow.com/q/24025988
score: 0

http://stackoverflow.com/q/24003518
tagged with: swing
has answer: http://stackoverflow.com/a/24003555
tagged with: java
has comment: http://stackoverflow.com/comment/36994783
type: Question
tagged with: cardlayout
tagged with: layout-manager
has title: Java CardLayout not displaying
score: 0
has body: I have a game that already runs and works and I want to add a title screen to it. I'm trying to add a CardLayout for easy switching between game and titlescreen. My current issue is that nothing is being displayed. Here is an image: https://i.sstatic.net/AooMO.png . I simply get a blank JPanel when I run it. What am I doing wrong? public class UI { private static JPanel cards; private static CardLayout cardLayout; public static void main(String args[]) {new UI();} public UI() { JFrame frame = new JFrame("Scrolling Shooter"); frame.setResizable(false); Toolkit tk = Toolkit.getDefaultToolkit(); int width = ((int) tk.getScreenSize().getWidth()); int height = ((int) tk.getScreenSize().getHeight()); frame.setSize(width, height); TitleScreen title = new TitleScreen(frame); ScrollingShooter game = new ScrollingShooter(frame); cards = new JPanel(new CardLayout()); cards.add(title, "title"); cards.add(game, "game"); cards.setOpaque(true); frame.getContentPane().add(cards); cardLayout = (CardLayout) cards.getLayout(); cardLayout.first(cards); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } /** * Switches to the next screen */ public static void nextScreen() {cardLayout.next(cards);} /** * Returns to the first screen */ public static void firstScreen() {cardLayout.first(cards);} }
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/24029670
answers question: http://stackoverflow.com/q/24029618
score: 5
has comment: http://stackoverflow.com/comment/37042471
type: AcceptedAnswer
upvote count: 5
type: Answer
has body: Object retObject = myMethod.invoke(null); That would only work for a static method. For an instance method, you need to pass in the instance that you want to invoke the method on. Object retObject = myMethod.invoke(instanceOfFoo); Also, the method may need to be public (or be made accessible separately).
accepted answer of: http://stackoverflow.com/q/24029618
downvote count: 0

http://stackoverflow.com/a/24077218
upvote count: 1
type: Answer
has body: Finally I am able to remove that bug using idea by @kailas Here I am posting my method: public void showkeyword() { int counter = 0; int screenWidth = getResources().getDisplayMetrics().widthPixels; final RelativeLayout contactWrapper = (RelativeLayout)findViewById(R.id.key_layout); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); RelativeLayout.LayoutParams buttonparams = new RelativeLayout.LayoutParams( 150, 80); int i = 0; contactWrapper.removeAllViews(); // contact wrapper is a linear Layout // use LinearLayout contactWrapper = (LinearLayout) mView // .findViewById(R.id.yourLinearLayout); int currCounter = 0; int currWidth = 0; boolean isNewLine = false; boolean firstLine = true; for(final String s : alist) { TextView textview = new TextView(this); RelativeLayout.LayoutParams rlp1 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); rlp1.setMargins(7, 5, 7, 0); textview.setText(s); textview.setId(2000 + i); textview.setBackgroundColor(Color.DKGRAY); textview.setTextColor(Color.CYAN); textview.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub contactWrapper.removeView(v); alist.remove(s); } }); int width = s.length()*15; if((currWidth+width+150)&lt;=screenWidth) { currWidth += width+10; isNewLine = false; currCounter++; } else{ currWidth = width+14; firstLine = false ; isNewLine = true; currCounter=1; } if(i==0) { rlp1.addRule(RelativeLayout.ALIGN_START); textview.setLayoutParams(rlp1); contactWrapper.addView(textview); } else if(isNewLine){ rlp1.addRule(RelativeLayout.ALIGN_LEFT); rlp1.addRule(RelativeLayout.BELOW,2000-1+i ); textview.setLayoutParams(rlp1); contactWrapper.addView(textview); } else if(firstLine) { rlp1.addRule(RelativeLayout.RIGHT_OF,2000-1+i ); textview.setLayoutParams(rlp1); contactWrapper.addView(textview); } else{ rlp1.addRule(RelativeLayout.RIGHT_OF,2000-1+i ); rlp1…
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24055289

http://stackoverflow.com/q/24069259
upvote count: 1
type: Question
has body: I am trying to validate if a String has a number associated with it, and rejecting the value if it has a number. It is my first time using Spring Validation, and I have struggled for days with getting it all set up properly. I want the string to print out if it doesn't contain a number, but be rejected by the validator if it does. I am also unsure about the paramater being the value of target. I am unsure of how all of that works. Here is what I have so far: @Component public class StringValidator implements Validator { public boolean supports(Class&lt;?&gt; clazz) { return Main.class.isAssignableFrom(clazz); } @Autowired public void validate(Object target, Errors errors) { //the 2nd parameter in ValidationUtils needs to be the string the validator takes in, which should be a set value from Main...? Main main = (Main) target; ValidationUtils.rejectIfEmptyOrWhitespace(errors, String.valueOf(main), AppConstants.NULL_ERROR_MSG); if(!errors.hasErrors()) { boolean containsNbr = false; for(char c : String.valueOf(main).toCharArray()) { if(Character.isDigit(c)) { containsNbr = true; break; } } if(containsNbr) { errors.rejectValue(String.valueOf(main), AppConstants.NUMBERS_ERROR_MSG); } else { System.out.println(String.valueOf(main)); } } } } applicationContext.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt; &lt;context:component-scan base-package="com.imports.validationexample"/&gt; &lt;bean id="main" class="com.imports.validationexample.application" /&gt; &lt;bean id ="springValidator" class="co…
tagged with: target
has comment: http://stackoverflow.com/comment/37134614
has title: How would I display this in main(String[] args) and how do I hook up these classes and/or constructors in xml?
tagged with: validation
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24080600
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
score: 1
tagged with: java

http://stackoverflow.com/comment/36937647
type: QuestionComment
has text: 10 questions is 9 too many for this format. They're also *questions*, not doubts.
comment on: http://stackoverflow.com/q/23974035
score: 0
type: Comment

http://stackoverflow.com/a/23977668
answers question: http://stackoverflow.com/q/23977607
downvote count: 0
upvote count: 2
has body: If you have logic in a class outside of the Activity, and based on this logic you want to show an AlertDialog, you can do either of the following: Pass the Activity instance into your other class' method so that you can use this in the AlertDialog.Builder constructor (not recommended) Send a BroadcastIntent to be received by your activity, and in the activity's BroadcastReceiver you can then construct your AlertDialog from there. Option 2 is cleaner as it is pretty bad practice to pass Activity instances around through your code. You mentioned in your question that you're new to Android, so if you're not familiar with BroadcastIntent, BroadcastReceiver, and AlertDialog.Builder, do some Googling and/or leave a comment with specific questions and I'll update my answer. EDIT IN RESPONSE TO COMMENT You shouldn't expose public methods from your Activity in the way you described. The logic inside your activity should be deciding when to show an alert box and shouldn't be told to do so from elsewhere in your application. The better question is: where are you calling this from? Also, a very important thing to note: When asking questions on StackOverflow about a crash in your application, ALWAYS post the error and stack trace from LogCat.
has comment: http://stackoverflow.com/comment/36945461
type: Answer
score: 2

http://stackoverflow.com/a/23954848
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23954284
score: 2
upvote count: 2
has body: Please read Concurrency in Swing. What you are doing is using up all resources of the EDT by sleeping and updating, not leaving any time for it to actually redraw your GUI. The EDT is meant for small operations on the GUI. You should never call Thread.sleep() on the EDT. What you could do is make a Timer that would run your check every second until the check passes. That way the EDT would be free to not freeze. A much better way of doing this is by using a SwingWorker. It has methods that do your specific thing: A task to do in the background (In your case - unzip) A method to publish a partial result to the GUI (in your case % done) A method to react to partial results (In your case - update progress) A method to invoke when done (Not shown in your case, but useful anyway).
answers question: http://stackoverflow.com/q/23954284

http://stackoverflow.com/q/23978946
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24490467
has comment: http://stackoverflow.com/comment/36947192
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36947568
has comment: http://stackoverflow.com/comment/36947657
type: Question
accepted answer: http://stackoverflow.com/a/24490467
has comment: http://stackoverflow.com/comment/36947340
tagged with: fileparsing
has comment: http://stackoverflow.com/comment/36947142
has title: Process huge text file in java web application via UI upload or read from directory
has comment: http://stackoverflow.com/comment/36947841
has body: My web application needs to process a text file (size close to 200MB) for reading some relevant data. This text file needs to be processed monthly once, which means the contents of this text file varies monthly. I would like to know what is the best practice to implement the processing of this text file. Shall i allow the user to upload this 200mb file via the application itself and then process it? Configure the java webapplication to read the file from a predefined directory in the tomcat server.(Still i will present a UI to the user to initiate the processing, say e.g.'Start Processing') I will be using JSaPAR library for processing my text file as it is a flat file with fixed positions.
answer count: 1

http://stackoverflow.com/q/24082862
has title: How to get Statement.getGeneratedKeys working
tagged with: jdbc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24083159
has body: I have a problem with the method getGeneratedKeys() of java.sql.Statement First of all my code: create.sql: (HSQLDB) create table Ticket ( ticketID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, persID INTEGER NOT NULL REFERENCES Mitarbeiter(persID), zeitpunkt TIMESTAMP(0) NOT NULL, betreff VARCHAR(100) NOT NULL, text VARCHAR(1000) NOT NULL, wichtig BOOLEAN NOT NULL, istGeloest BOOLEAN NOT NULL ); The create Method from the DAO: @Override public Ticket create(Ticket t) throws PersistenceException { if( t == null ) { log.error("PersistenceTicket.create(Ticket t) wurde ein null parameter übergeben"); throw new PersistenceException("TicketParameter ist null"); } PreparedStatement pst = null; try { pst = con.prepareStatement("INSERT INTO ticket(persID, zeitpunkt, betreff, text, wichtig, istGeloest) VALUES (?,?,?,?,?,?)"); pst.setInt(1, t.getPersID()); pst.setTimestamp(2, t.getZeitpunkt()); pst.setString(3, t.getBetreff()); pst.setString(4, t.getText()); pst.setBoolean(5, t.isWichtig()); pst.setBoolean(6, t.istGeloest()); int result = pst.executeUpdate(); if( result &gt; 1 ) { return null; } ResultSet rs = pst.getGeneratedKeys(); if( rs.next() ) { t.setTicketID(rs.getInt(1)); } else { log.debug("No keys generated"); } log.info("Ticket mit Betreff " + t.getBetreff() + " in die Datenbank gespeichert" ); pst.close(); } catch (SQLException e) { log.error("Error beim create: " + e.getMessage()); } return t; } Then I have a Unit Test testing the generated keys: @Test public void specialCreateTest() throws PersistenceException { Ticket a = this.persT.create(this.testTicket); Ticket b = this.persT.create(this.testTicket); log.debug(a.getTicketID() + " &lt; " + b.getTicketID()); assertTrue(a.getTicketID() &lt; b.getTicketID()); } When I run the test I get an Failure and the following logs: DEBUG at.ac.tuwien.sepm.persistence.PersistenceTicketImpl - No keys generated DEBUG at.ac.tuwien.sepm.persistence.PersistenceTicketImpl - No keys generated DEBUG at.ac.tuwien.sepm.unitte…
tagged with: java
type: Question
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/24083159
answer count: 1
tagged with: hsqldb

http://stackoverflow.com/q/23948146
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: thread-safety
has title: Is there a threadsafe or visibility issue using "private static" field instead of "private final static" field
type: Question
answer count: 2
downvote count: 0
has body: about static initialzers which are threadsafe and carried out by a single thread at class load time, why should I use a "private final static field" in the singleton if a "private static field" makes to my understanding the same threadsafe and visibility guarantees - provided that the static field will not be touched after the static initialization. Simply, I do say the following two examples below are behaving identical in a multithreaded environment: Any time any client will get returned the same instance - there is not even the faintest difference - do you agree ? Please let me know in either way. Example static field: public class Singleton { private static Singleton instance = new Singleton(); public static Singleton getInstance() { return instance; } private Singleton() { } } Example final static field: public class Singleton_final { private final static Singleton instance = new Singleton(); public static Singleton getInstance() { return instance; } private Singleton() { } } Kind regards, Hermann
accepted answer: http://stackoverflow.com/a/23948293
favorite count: 0
has comment: http://stackoverflow.com/comment/36890055
tagged with: visibility
tagged with: singleton
linked to: http://stackoverflow.com/q/6457109
has answer: http://stackoverflow.com/a/23948169
linked to: http://stackoverflow.com/q/70689
possible better answer: http://stackoverflow.com/a/23948169
has comment: http://stackoverflow.com/comment/36890088
upvote count: 1
has comment: http://stackoverflow.com/comment/36890068
has answer: http://stackoverflow.com/a/23948293

http://stackoverflow.com/comment/37037424
has text: so does that mean the sort method is only running the mergesort method once?
comment on: http://stackoverflow.com/q/24026838
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24102039
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: facebook
upvote count: 1
has comment: http://stackoverflow.com/comment/37330672
has title: Retrieve all photos in facebook post with graph api
score: 1
tagged with: java
has body: Hey all I am trying to use Rest FB to retrieve all photos from a post on facebook. However I am only ever able to pull back the first image of the post. I have tried various JSON fields to pull this data but to no avail. Any help would be greatly appreciated. Post posts = facebookClient.fetchObject(post.getId(), Post.class, Parameter.with("fields", "object_id"));
tagged with: restfb
type: Question
downvote count: 0
tagged with: facebook-graph-api
linked to: http://stackoverflow.com/q/14371424

http://stackoverflow.com/q/24012430
has answer: http://stackoverflow.com/a/24012676
has comment: http://stackoverflow.com/comment/37009838
has body: I can only get correct output for decimal less than five. the output for five is 110 when it should be 101. the output for six is 101 and the output for ten is 1100. //while loop divides each digit while (decimal &gt; 0) { //divides and digit becomes the remainder int digit = decimal % 2; //makes the digit into a string builder so it can be reversed binaryresult.append(digit); decimal = decimal / 2; display.setText(binaryresult.reverse()); }
favorite count: 0
tagged with: binary
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/24012540
upvote count: 0
has title: decimal to binary output is incorrect
tagged with: java
has answer: http://stackoverflow.com/a/24013193
type: Question
has answer: http://stackoverflow.com/a/24013300
score: -1
linked to: http://stackoverflow.com/q/5203974
tagged with: decimal
downvote count: 1

http://stackoverflow.com/comment/36985903
type: Comment
has text: @DanielPryden I never said the code was thread safe ;) Map is not thread safe for that matter
comment on: http://stackoverflow.com/a/23990661
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37214243
score: 1
type: AnswerComment
has text: It occurred to me that you really don't even need to write the MyTag class. You can just configure your .tld file to point directly at org.apache.taglibs.standard.tag.rt.core.SetTag.
type: Comment
comment on: http://stackoverflow.com/a/24083747

http://stackoverflow.com/a/23981128
has comment: http://stackoverflow.com/comment/36952878
type: Answer
has comment: http://stackoverflow.com/comment/36952760
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37024061
accepted answer of: http://stackoverflow.com/q/23980384
downvote count: 0
has comment: http://stackoverflow.com/comment/36993972
has body: If you want to redirect / to /ent-app, then you need to configure that. There is no magic provided by the ROOT web application: you need to configure it yourself to perform the redirect. You can either write your own servlet/filter that maps to /* and just redirects everything to /ent-app, or you can use something like url-rewrite and simply configure it to your liking.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37075714
answers question: http://stackoverflow.com/q/23980384

http://stackoverflow.com/a/24029372
answers question: http://stackoverflow.com/q/24029316
type: AcceptedAnswer
score: 0
has body: You need to add following permissomn in your manifest file. &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; or try with https instead of http in url.
type: Answer
has comment: http://stackoverflow.com/comment/37041896
accepted answer of: http://stackoverflow.com/q/24029316

http://stackoverflow.com/a/24053125
has comment: http://stackoverflow.com/comment/37111072
has body: Use this String[] str = s.split(" "); instead of String[] str = s.split("\t"); I think you are not getting the values as you want.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24046075
accepted answer of: http://stackoverflow.com/q/24046075
score: 1

http://stackoverflow.com/comment/37088698
has text: curl -X POST -d @value.txt [url] gives me the NotEnoughDataDecoderException too. I haven't tried the non-fluent HttpClient API, but I don't believe that's the issue particularly as curl fails similarly.
comment on: http://stackoverflow.com/q/23989217
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/a/24009038
has comment: http://stackoverflow.com/comment/37003993
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/24008946
has body: You can try using this regex: String x = "9.8.7"; boolean matches = x.matches("\\d\\.\\d\\.\\d"); // true Notice that the dot . is being escaped \\., because it has a special meaning in regex. Here some input/output samples: "99.8.7" -&gt; false "9.9.7." -&gt; false "9.97" -&gt; false
score: 8
answers question: http://stackoverflow.com/q/24008946

http://stackoverflow.com/q/23964639
type: AnsweredQuestion
has body: I have the following methods: static IntStream streamedDivisors(final int n) { return IntStream.range(2, n).parallel().filter(input -&gt; n % input == 0); } static int streamedPhi(final int n) { return streamedDivisors(n).reduce(0, x -&gt; x * x); } and I'm getting a compilation error in streamedPhi indicating that I have incompatible parameter types in my lambda expression. Can someone help me make sense of this? I'm essentially trying to take the divisors of a given number n, and aggregate a number on some function I defined (in this case, squaring the number).
downvote count: 0
tagged with: java-stream
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36935728
accepted answer: http://stackoverflow.com/a/23964689
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23964689
favorite count: 0
has title: Java8 reducing a stream
has comment: http://stackoverflow.com/comment/36932993
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/q/24043241
favorite count: 0
has body: Spring has the BeanPropertyRowMapper to pull from SQL on a select and map to a POJO object without having to make a custom row mapper. I'm hoping for the same but for an insert statement. But I'm unable to find an equivalent. public boolean addRenewalQuote(Quote quote) { String sql = "INSERT INTO Customers (internal_order_number, b_email, s_email, b_firstname) VALUES (?, ?, ?, ?);"; if(getTemplate().update(sql, quote) &gt; 0) { return true; }else { return false; } } The quote string names match the columns in the DB already. The actual insert is quite large and I'm hoping there is a faster method than grabbing each quote getter individually and passing it to the update method.
has comment: http://stackoverflow.com/comment/114572109
type: Question
has title: Is it possible to use a instanced pojo to insert with a JDBC template?
tagged with: spring
tagged with: spring-jdbc
has comment: http://stackoverflow.com/comment/114571547
has comment: http://stackoverflow.com/comment/114571444
upvote count: 3
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37069592
has comment: http://stackoverflow.com/comment/37069824
has comment: http://stackoverflow.com/comment/37069784
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24044382
score: 3
downvote count: 0

http://stackoverflow.com/comment/36893363
score: 0
type: Comment
has text: I actually just have one last question. If I not set any other variable like birthplace but I don't add that to the toString method. It won't get printed correct?
type: AnswerComment
comment on: http://stackoverflow.com/a/23949493

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/23985256
tags question: http://stackoverflow.com/q/23943524
type: Tag

http://stackoverflow.com/comment/36961126
comment on: http://stackoverflow.com/a/23986060
score: 0
type: AnswerComment
has text: Thanks @Bohemian . I should have realized the "transitive" issue. I'll then define a new method to compare this class rather than overwriting equals() .
type: Comment

http://stackoverflow.com/a/24063511
has comment: http://stackoverflow.com/comment/39122929
type: AcceptedAnswer
score: 28
answers question: http://stackoverflow.com/q/24059837
has body: static &lt;A, B&gt; Stream&lt;Pair&lt;A, B&gt;&gt; zip(Stream&lt;A&gt; as, Stream&lt;B&gt; bs) { Iterator&lt;A&gt; i=as.iterator(); return bs.filter(x-&gt;i.hasNext()).map(b-&gt;new Pair&lt;&gt;(i.next(), b)); } This does not offer parallel execution but neither did the original zip implementation. And as F. Böller has pointed out it doesn’t work if bs is infinite and as is not. For a solution which works for all possible combinations of infinite and finite streams, an intermediate Iterator which checks both sources within the hasNext method seems unavoidable¹: static &lt;A, B&gt; Stream&lt;Pair&lt;A,B&gt;&gt; zip(Stream&lt;A&gt; as, Stream&lt;B&gt; bs) { Iterator&lt;A&gt; i1 = as.iterator(); Iterator&lt;B&gt; i2 = bs.iterator(); Iterable&lt;Pair&lt;A,B&gt;&gt; i=()-&gt;new Iterator&lt;Pair&lt;A,B&gt;&gt;() { public boolean hasNext() { return i1.hasNext() &amp;&amp; i2.hasNext(); } public Pair&lt;A,B&gt; next() { return new Pair&lt;A,B&gt;(i1.next(), i2.next()); } }; return StreamSupport.stream(i.spliterator(), false); } If you want parallel capable zipping you should consider the source of the Stream. E.g. you can zip two ArrayLists (or any RandomAccessList) like ArrayList&lt;Foo&gt; l1=new ArrayList&lt;&gt;(); ArrayList&lt;Bar&gt; l2=new ArrayList&lt;&gt;(); IntStream.range(0, Math.min(l1.size(), l2.size())) .mapToObj(i-&gt;new Pair(l1.get(i), l2.get(i))) . … ¹(unless you implement a Spliterator directly)
type: Answer
accepted answer of: http://stackoverflow.com/q/24059837
has comment: http://stackoverflow.com/comment/39119022
downvote count: 0
upvote count: 28

http://stackoverflow.com/q/23982200
tagged with: gridbaglayout
score: 0
tagged with: layout
answer count: 1
tagged with: layout-manager
favorite count: 0
has body: I'm tring to wrinte an java application that disposes in a gridBagLayout one jlabel and one JtextFiel. I don't understand why my first jLabel is not aligned with the other. This is my code: public class FinestraSceltaIntervalli extends JFrame { private final String stringa="Modifica Parametri"; private int numeroIntervalli; private JScrollPane scrollPanel; private SingletonFinestra singleton; private JButton conferma; private JButton pulisci; private JButton indietro; private JTextField campo; private JLabel label; public FinestraSceltaIntervalli(int numeroIntervalli){ this.numeroIntervalli=numeroIntervalli; singleton=SingletonFinestra.getSingleton(); conferma=new JButton("dfsd"); pulisci=new JButton("Pulisci"); campo=new JTextField(); setSize(singleton.getFinestra().getWidth(),singleton.getFinestra().getHeight()); setLocation((int)singleton.getFinestra().getLocation().getX(),(int)singleton.getFinestra().getLocation().getY()); setTitle(stringa); setLayout(new BorderLayout()); JPanel container=new JPanel(); GridBagLayout layout=new GridBagLayout(); container.setLayout(layout); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; for(int i=0;i&lt;numeroIntervalli;i++){ label=new JLabel("ciao"); c.gridx=0; c.gridy=i; c.anchor=GridBagConstraints.CENTER; layout.setConstraints(label, c); container.add(label); campo=new JTextField(); c.gridx=1; c.insets.right=0; c.ipadx=100; c.anchor=GridBagConstraints.CENTER; layout.setConstraints(campo, c); container.add(campo); } scrollPanel=new JScrollPane(container); add(scrollPanel); } } This is the output: Anyone can help me?
has title: Wrong Visualitation in a GridBagLayout
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23982335
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36953526

http://stackoverflow.com/a/23961335
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23961154
answers question: http://stackoverflow.com/q/23961154
has body: Take each phone number from remote server and pass to the following method: public boolean contactExists(Context context, String number) { /// number is the phone number Uri lookupUri = Uri.withAppendedPath( PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)); String[] mPhoneNumberProjection = { PhoneLookup._ID, PhoneLookup.NUMBER, PhoneLookup.DISPLAY_NAME }; Cursor cur = context.getContentResolver().query(lookupUri,mPhoneNumberProjection, null, null, null); try { if (cur.moveToFirst()) { return true; } } finally { if (cur != null) cur.close(); } return false; } If the method returns true, store the relevant data to display in ListView Original answer Android : Check phone number present in Contact List ? (Phone number retrieve from phone call)
type: Answer

http://stackoverflow.com/q/24031236
tagged with: android
has comment: http://stackoverflow.com/comment/37046010
tagged with: logout
has comment: http://stackoverflow.com/comment/37045310
has answer: http://stackoverflow.com/a/24031718
has title: Clear all SharedPreferences android
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/37045111
has comment: http://stackoverflow.com/comment/37046630
type: Question
has comment: http://stackoverflow.com/comment/37045127
has body: Iam saving my user login details into my SharedPreferences file. The problem is when I try to clear the ShredPreferences, the details dont clear. When the next user logs in his details are not shown. Here is my code:- Save.java sessionManager.createLoginSession(username, deviceId, name ); SessionManagement.java SharedPreferences pref; // Editor for Shared preferences Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "UserDetails"; public SessionManagement(Context context) { this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } public void createLoginSession(String emailId, String deviceid,String usersname) { // Storing login value as TRUE editor.putBoolean(IS_LOGIN, true); editor.putBoolean(KEY_DEVICEREGISTERED, true); editor.putString(KEY_EMAILID, emailId); editor.putString(KEY_DEVICEiD, deviceid); editor.putString(KEY_USERSNAME, usersname); // commit changes editor.commit(); } /** * Get stored session data * */ public HashMap&lt;String, String&gt; getUserDetails() { HashMap&lt;String, String&gt; user = new HashMap&lt;String, String&gt;(); user.put(KEY_EMAILID, pref.getString(KEY_EMAILID, null)); user.put(KEY_DEVICEiD, pref.getString(KEY_DEVICEiD, null)); user.put(KEY_USERSNAME, pref.getString(KEY_USERSNAME, null)); // return user return user; } /** * Check login method wil check user login status * If false it will redirect user to login page * Else won't do anything * */ public void checkLogin() { // Check login status if(!this.isLoggedIn()) { // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, Login.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } // This function clears all session data and redirect the…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24031313
has comment: http://stackoverflow.com/comment/37045303
type: UnansweredQuestion

http://stackoverflow.com/a/23983611
type: Answer
has body: I would go one step further: Why should anyone know how you store your data? Information hiding is the keyword. In your example details about the datatype leak to the outside. The keyword list leaks details about the implementation, which is 1) unnecessary information - you could even name it treasurechest 2) does a possible user of your class make assumptions about the implementation, which is a bad thing. Give your class a domain-name like goodies and name the methods like put / pull. If you want to add multiple elements I would use a more generic Interface like Iterable.
score: 0
answers question: http://stackoverflow.com/q/23983415

http://stackoverflow.com/q/24053957
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37087676
has comment: http://stackoverflow.com/comment/37087541
has answer: http://stackoverflow.com/a/24054122
type: Question
has title: Unable to pass String value from one java class to other
tagged with: java
has comment: http://stackoverflow.com/comment/37087613
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/24054076
tagged with: sqlite
has comment: http://stackoverflow.com/comment/37087475
has answer: http://stackoverflow.com/a/24054076
has comment: http://stackoverflow.com/comment/37087581
has comment: http://stackoverflow.com/comment/37088004
has body: i am trying to send the value of string which is accessed from a spinner and send it to data helper class to run a query and insert value in another spinner which is running on another activity Method inside class which fetches value of string NewTask.java @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // On selecting a spinner item label = spinnerComp.getSelectedItem().toString(); //storing value of spinner in string label System.out.println("NewTask label="+label); toRetDeptString(); //it will call return string method // Showing selected spinner item Toast.makeText(spinnerComp.getContext(), "You selected: " + label, Toast.LENGTH_LONG).show(); } now the return string method is which is also declared inside NewTask.java public String toRetDeptString() { System.out.println("NewTask String label="+label); return label; } and now i am trying to access the value of label string dataHelper class which runs the query on basis of value inside the string label Inside DataHelper.java and in that inside DatabaseHelper class public List&lt;String&gt; getAllLabelsDept(){ NewTask a = new NewTask(); String n1= a.toRetDeptString(); //this one doesn't worked // String n1 = a.label; //this one doesn't worked // String n1="umbrella"; //this method worked by directly assiging string value System.out.println("a="+n1); List&lt;String&gt; labels = new ArrayList&lt;String&gt;(); // Query String selectQuery = "select " + Dept + " from "+TABLE_NAME +" where " + Comp + " = '" + n1 +"'"; SQLiteDatabase db1 = this.getReadableDatabase(); Cursor cursor = db1.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { labels.add(cursor.getString(cursor.getColumnIndex(Dept))); } while (cursor.moveToNext()); } // closing connection cursor.close(); db1.close(); // returning lables return labels; } Select_Dept.java public class Select_Dept extends Activity implements OnItemSelectedListener{ Spinner sp…
tagged with: android
has comment: http://stackoverflow.com/comment/37087643
tagged with: android-activity
has answer: http://stackoverflow.com/a/24056403
accepted answer: http://stackoverflow.com/a/24056403
has comment: http://stackoverflow.com/comment/37088434

http://stackoverflow.com/a/23969455
type: AcceptedAnswer
has body: A few things to note before posting my solution: there is no easy way to replace the contents of a file while reading it, you have to create a new one and output what you need there if you want to replace values, then this is good place use a Map your code implies that the look.csv file contains only 2 lines The following would achieve what you are looking for, but again, the output is in a different file (you can rename afterwards if you wish to do so) : public class Main { public static void main(String[] args) throws Exception { //1. create Scanners that will look through the CSV files Scanner main = new Scanner(new File("main.csv")); Scanner look = new Scanner(new File("look.csv")); //2. create the final CSV file that will contain both the replaced words and non-replaced words from main.csv FileWriter replaced = new FileWriter(createReplacedCsv()); //3. store contents of look.csv in a Map Map&lt;String, String&gt; lookCsvWords = storeLookCsvInSet(look); //4. Store the contents of the file in a StringBuilder, so you can use the StringBuilder.deleteCharAt(int) // and .lastIndexOf(String) to delete the last comma StringBuilder builder = new StringBuilder(); //5. keep track of the line we are on int line = 0; //6. iterate through main.csv and search for replaceable words, and write them to replaced.csv if they are found while (main.hasNext()) { //search the first line for replaceable chars String[] wordsInLine = main.nextLine().split(","); for (String word : wordsInLine) { if (lookCsvWords.containsKey(word) &amp;&amp; line == 0) { word = lookCsvWords.get(word); } builder.append(word).append(","); } line ++; builder.deleteCharAt(builder.lastIndexOf(",")); builder.append("\n"); } //7. write the contents of the StringBuilder to the file replaced.write(builder.toString()); replaced.close(); } /* * Creates the replaced.csv file if it doesn't exist */ private static File createReplacedCsv() throws Exception { File replacedCsv = new File("replaced.csv"); replacedCsv.create…
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/36930945
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23969007
answers question: http://stackoverflow.com/q/23969007

http://stackoverflow.com/q/23989299
has body: I have a table that sends a form post of 5 input text with values to servlet. In servlet I get the values and set them into bean class, and the sum that I set it too to bean class as sum.Then I get the values and the sum on the jsp table.The problem, is that now Im creating a button that when I click, I insert a row after the last row, and I want to keep the values too with the sum, How can I do it? This is my jsp that send the form to Servlet: Test.jsp <jsp:useBean id="helloBean" scope="request" class="user.HelloBean" /> Test Total 1 2 3 4 5 <c:forEach items="${helloBean.values}" var="item"> </c:forEach> Now I got the values on servlet, calculate the sum and send them to java bean: Servlet.java HelloBean hello = new HelloBean(); String[] values = request.getParameterValues("values"); if (values == null) { values = new String[5]; for(int i = 0; i < 5; i++) { values[i]= "0"; } } Integer sum = 0; for (int i = 0; i < values.length; i++) { hello.setSum(sum = sum + Integer.valueOf(values[i])); hello.setValues(values); } request.setAttribute("helloBean", hello); request.getRequestDispatcher("/Test.jsp").forward(request, response); And this is my Bean Class: HelloBean.java public class HelloBean { String[] values; Integer sum; public Integer getSuma() {return sum;} public void setSum(Integer integer) {this.sum = integer;} public String[] getValues() {return values;} public void setValues(String[] val) {this.values = val;} } This is how I add a new row: $("#btnAdd").click(function () { var row = $("#sum_table tbody > tr:last"), newRow = row.clone(true); newRow.find("input").each(function () { var num = +(this.id.match(/\d+$/) || [0])[0] + 1; this.id = this.id.replace(/\d+$/, "") + num; this.name = this.id; }); newRow.insertAfter(row); return false; }); Thank You in Advance!
downvote count: 0
tagged with: jsp
tagged with: javabeans
favorite count: 0
has comment: http://stackoverflow.com/comment/37088601
accepted answer: http://stackoverflow.com/a/23989433
has title: Working with Java beans and Servlet values dynamically
score: 3
answer count: 4
has answer: http://stackoverflow.com/a/24121730
tagged with: dynamic
upvote count: 3
has comment: http://stackoverflow.com/comment/37088699
possible better answer: http://stackoverflow.com/a/24121730
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23989433
has comment: http://stackoverflow.com/comment/37087317
has comment: http://stackoverflow.com/comment/37088454
has comment: http://stackoverflow.com/comment/37279438
tagged with: java
has answer: http://stackoverflow.com/a/24156174
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/24133274

http://stackoverflow.com/q/24100970
answer count: 2
has comment: http://stackoverflow.com/comment/37175380
upvote count: 0
has comment: http://stackoverflow.com/comment/37175507
has comment: http://stackoverflow.com/comment/37175769
favorite count: 0
possible better answer: http://stackoverflow.com/a/24101036
has answer: http://stackoverflow.com/a/24101036
has comment: http://stackoverflow.com/comment/37175438
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37175417
has comment: http://stackoverflow.com/comment/37175366
has answer: http://stackoverflow.com/a/24101100
downvote count: 2
tagged with: multithreading
type: Question
has title: Using Multiple Threads in Java
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/37175363
has body: I've been trying to understand how multi-threading work so i ran the below code: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package mainBowl; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Kbluue */ public class ThreadStudy { Thread t, t1, t2; Runnable r, r1, r2; public ThreadStudy() { init(); } public void start(){ } private void init(){ t = new Thread(r); t.setName("Thread"); t1 = new Thread(r1); t1.setName("Thread 1"); t2 = new Thread(r2); t2.setName("Thread 2"); r = new Runnable() { @Override public void run() { // throw new UnsupportedOperationException("Not supported yet."); if (t != null){ printStart(t); try { Thread.currentThread().wait(); } catch (Exception e){ printError(t); } printResume(t); t1.notify(); } } }; r1 = new Runnable() { @Override public void run() { // throw new UnsupportedOperationException("Not supported yet."); if (t != null){ printStart(t1); try { t1.wait(); } catch (InterruptedException ex) { Logger.getLogger(ThreadStudy.class.getName()).log(Level.SEVERE, null, ex); } printResume(t1); t2.notify(); } } }; r2 = new Runnable() { @Override public void run() { // throw new UnsupportedOperationException("Not supported yet."); if (t != null){ printStart(t2); t.notify(); printResume(t2); } } }; } private void printStart(Thread t){ System.out.println("This is a new thread starting" + t.getName()); } private void printResume(Thread t){ System.out.println("This is a thread resuming" + t.getName()); } private void printError(Thread t){ System.out.println("There is an error" + t.getName()); } public void run(){ t.start(); t1.start(); t2.start(); } } and then i ran this in the main activity new ThreadStudy().run; but the output gave nothing. just; run: BUILD SUCCESSFUL (total time: 0 seconds) not even an error message to work with. Also I'd like to know if there are more ways to add commands/methods to a thread other than the new Thread(Runnable r) method. Thanks i…
accepted answer: http://stackoverflow.com/a/24101100

http://stackoverflow.com/comment/36936398
has text: What value are you expecting?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23973561
score: 6

http://stackoverflow.com/comment/79478966
type: Comment
has text: @Tiny, it's NOT safe.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24104313

http://stackoverflow.com/comment/37153842
type: QuestionComment
has text: The problem is that the use can select several files that are in the cloud to. If he does so, i wont have it inside the device, and wont be able to retrieve the file when sync with main server. That is why I am copying it to another folder, and, after synchronization, the files that were successfully sent are going to be erased by the system itself. But ill look with the way you suggested. Thanks
comment on: http://stackoverflow.com/q/24087728
score: 0
type: Comment

http://stackoverflow.com/q/24025988
score: 1
has title: How to secure Nexmo Callback URL using oAuth/ http header username and password
favorite count: 0
type: Question
has body: I have been looking into Nexmo documentation (https://docs.nexmo.com/index.php/sms-api/handle-inbound-message) for inbound messages and have a query. I want to make sure that the URL is being called from Nexmo and Nexmo alone. So in order to secure my end-point how do I specify token or username and password parameters/ http headers so that its secure? Any help is appreciated. Thanks
tagged with: sms
has answer: http://stackoverflow.com/a/29494821
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/32395326
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47456891
tagged with: vonage
downvote count: 0

http://stackoverflow.com/q/24016458
has comment: http://stackoverflow.com/comment/37017901
tagged with: database
has comment: http://stackoverflow.com/comment/37017784
has answer: http://stackoverflow.com/a/24078935
has answer: http://stackoverflow.com/a/24017056
score: 0
has comment: http://stackoverflow.com/comment/37017434
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/37018046
has comment: http://stackoverflow.com/comment/37018273
has title: ResultSet contains no rows?
has comment: http://stackoverflow.com/comment/37018762
has comment: http://stackoverflow.com/comment/37017859
tagged with: oracle-database
tagged with: jdbc
has body: I am firing the following query. SELECT A.FIRST_NAME AS EMP_FIRST_NAME, A.LAST_NAME AS EMP_LAST_NAME, A.EMAIL_ID AS EMP_EMAIL_ID, A.EMPLOYEE_TYPE AS EMP_EMPLOYEE_TYPE, A.SPECIAL_INSTRUCTIONS AS EMP_SPECIAL_INSTRUCTIONS, B.FIRST_NAME AS HR_FIRST_NAME, B.LAST_NAME AS HR_LAST_NAME, B.FAX_NUMBER AS HR_FAX_NUMBER, B.EMAIL_ID AS HR_EMAIL_ID FROM HR_EMPLOYEE A , HR_REP B WHERE A.HR_REP= B.REP_ID AND A.USER_ID='FOSTER' When I fire this in Java using ResultSet rs = statement.executeQuery(query); I am supposed to get exactly one row. So I do this if(rs.next()) { rs.getString("xxx"); rs.getString("yyy"); } but rs.next() always return false, indicating no rows have been fetched. I copy the same query and run in Oracle's Editor I get the output. So the query is correct. Why is this happening? See output in Oracle Note: When I fire a single table query i.e no join the rs.next() returns true. I have worked in Java for a long time but have never ever come across such an issue. Please help. Update: Full code: @Component @Service public class GeneralUserImp implements GeneralUserService{ private final Logger log = LoggerFactory.getLogger(this.getClass()); @Reference ConnectionProvider connectionProvider; public Employee getEmployee(String userId) throws Exception{ Connection connection=null; Statement statement=null; ResultSet resultSet= null; try{ connection = connectionProvider.getConnection(); log.info("****************** connection ::&gt;&gt; "+connection); statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); log.info("****************** statement ::&gt;&gt; "+statement); String query = "SELECT A.FIRST_NAME AS EMP_FIRST_NAME,A.LAST_NAME AS EMP_LAST_NAME, A.EMAIL_ID AS EMP_EMAIL_ID,A.EMPLOYEE_TYPE AS EMP_EMPLOYEE_TYPE,A.SPECIAL_INSTRUCTIONS AS EMP_SPECIAL_INSTRUCTIONS," + " B.FIRST_NAME AS HR_FIRST_NAME,B.LAST_NAME AS HR_LAST_NAME,B.FAX_NUMBER AS HR_FAX_NUMBER, B.EMAIL_ID AS HR_EMAIL_ID"+ " FROM HR_EMPLOYEE A ,HR_REP B WHERE A.HR_REP…
has comment: http://stackoverflow.com/comment/37017970
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24017056
tagged with: java
has comment: http://stackoverflow.com/comment/37018083
type: Question
accepted answer: http://stackoverflow.com/a/24078935

http://stackoverflow.com/q/24011386
has answer: http://stackoverflow.com/a/24011637
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37008097
has body: I have the following filter which i use to get values from database: On submitting the form, i execute the following query: SELECT id, Month, Year, SUM(3R02) AS 3R02, SUM(3R05) AS 3R05 FROM varcosts WHERE ( Month = 03 AND Month = 02 AND Year = 2013) OR ( Month = 03 AND Month = 02 AND Year = 2014) GROUP BY Year, Month Since I use servlet to execute the query, it becomes cumbersome to implement this query. Just as a question, is there an easier way to write this query? I am looking for a way in which i can include all the months selected by the user in checkbox without repeating AND Month = .. for each month. Is there an easy solution?
has comment: http://stackoverflow.com/comment/37010006
has comment: http://stackoverflow.com/comment/37015183
type: Question
has comment: http://stackoverflow.com/comment/37011471
has title: Filter values from database query
has comment: http://stackoverflow.com/comment/37008388
has comment: http://stackoverflow.com/comment/37008799
accepted answer: http://stackoverflow.com/a/24011637
has comment: http://stackoverflow.com/comment/37013565
has comment: http://stackoverflow.com/comment/37008028
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24011663
has answer: http://stackoverflow.com/a/24011663
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/37009480
tagged with: mysql
tagged with: forms
has comment: http://stackoverflow.com/comment/37008002

http://stackoverflow.com/q/24028930
has body: CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpget = new HttpGet("http://localhost/json"); ResponseHandler&lt;MyJsonObject&gt; rh = new ResponseHandler&lt;MyJsonObject&gt;() { @Override public JsonObject handleResponse( final HttpResponse response) throws IOException { StatusLine statusLine = response.getStatusLine(); HttpEntity entity = response.getEntity(); if (statusLine.getStatusCode() &gt;= 300) { throw new HttpResponseException( statusLine.getStatusCode(), statusLine.getReasonPhrase()); } if (entity == null) { throw new ClientProtocolException("Response contains no content"); } Gson gson = new GsonBuilder().create(); ContentType contentType = ContentType.getOrDefault(entity); Charset charset = contentType.getCharset(); Reader reader = new InputStreamReader(entity.getContent(), charset); return gson.fromJson(reader, MyJsonObject.class); } }; MyJsonObject myjson = client.execute(httpget, rh); Apache gives the above example, but I've never seen that syntax. It looks like the definition of ResponseHandler() is being assigned to a variable; no idea what this means. Is all this code in a single method of a class?
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37041215
tagged with: http
type: Question
tagged with: apache
linked to: http://stackoverflow.com/q/355167
has title: Where does the ResponseHandler go?
has comment: http://stackoverflow.com/comment/37041205
score: 0
duplicate of: http://stackoverflow.com/q/355167
has comment: http://stackoverflow.com/comment/37041230
type: UnansweredQuestion

http://stackoverflow.com/comment/37134663
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24079509
has text: @IbrahimApachi I'd suggest you read up on the subject a little more. Comment threads won't be a great place to get clarity on a broad subject like this.

http://stackoverflow.com/a/24052149
answers question: http://stackoverflow.com/q/24052012
upvote count: 3
downvote count: 0
has body: Before getting the InputStream, simply retrieve the status code. if (con.getResponseCode() == 404) { // do something InputStream err = con.getErrorStream(); // use it } Note how you should be using UrlConnection#getErrorStream() in case of an error (well non-2xx status code). Also, seriously consider using a different, better HTTP client. I suggest Apache's HttpComponents.
type: Answer
score: 3

sbt
tags question: http://stackoverflow.com/q/24037395
tag name: sbt
type: Tag

http://stackoverflow.com/q/24004539
has answer: http://stackoverflow.com/a/24005878
accepted answer: http://stackoverflow.com/a/24005878
answer count: 2
tagged with: apache
favorite count: 0
upvote count: 15
possible better answer: http://stackoverflow.com/a/51687561
tagged with: pdf-generation
has answer: http://stackoverflow.com/a/51687561
type: AnsweredQuestion
downvote count: 0
has body: I need to draw text in right alignment using PDFBOX (java). I am currently using ContentStream.drawString to draw text to the pdf. I'm not using monospace font, so the width of characters varies. Any ideas?
has title: Right-alignment text in PDFBOX?
type: Question
tagged with: java
tagged with: pdfbox
score: 15

http://stackoverflow.com/q/23996666
tagged with: file
has answer: http://stackoverflow.com/a/23996790
type: Question
has body: I changed System.out to print to a file, by invoking System.setOut and System.setErr. Every night at midnight, we want to rename (archive) the current log file, and create a new one. if (out != null) { out.close(); out = null; File f = new File(outputfilename); f.renameTo(new File(dir.getPath().replace(".log", "-" + System.currentTimeMillis() + ".log"))) StartLogFile(); } The StartLogFile(): if (out == null) { out = new FileOutputStream(outputfilename, true); System.setOut(new PrintStream(out)); System.setErr(new PrintStream(out)); } I've left exception-handling out. My concern is that if something tries to print in between out.close() and setOut/setErr that I'm going to miss a log. My real question is, how can I make this atomic with other calls to System.out.println? I was thinking about trying synchronized (System.out) { } but I'm not actually sure if the intrinsic lock here does anything. Especially since I'm nullifying the out object during the operation. Does anyone know how I can ensure proper synchronization here?
has answer: http://stackoverflow.com/a/23997117
has comment: http://stackoverflow.com/comment/36980804
accepted answer: http://stackoverflow.com/a/23996886
downvote count: 0
answer count: 4
has title: Synchronizing on System.out
tagged with: synchronization
favorite count: 0
has comment: http://stackoverflow.com/comment/36980866
score: 6
possible better answer: http://stackoverflow.com/a/23996797
upvote count: 6
has answer: http://stackoverflow.com/a/23996797
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23996886

http://stackoverflow.com/comment/37057125
has text: Edit: As i was doing this i did notice that i didn't see the `setContentView`, That was the problem and as both cesztoszule and Pponenix said, If you want to post it as an actual answer ill accept it and all that stuff. Thanks
comment on: http://stackoverflow.com/q/24036958
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/24003464
type: Question
tagged with: indexing
has comment: http://stackoverflow.com/comment/36993826
has title: String Index OutOfBOunds Exception
tagged with: java
has body: public static void main(String [] args) throws IOException{ BufferedReader in = new BufferedReader(new FileReader(".../senses/command_list")); String line = null; while((line = in.readLine()) != null){ if(line.isEmpty()){ continue; } line = line.trim(); line = line.substring(2 + line.indexOf("&gt;") , line.indexOf("))")); System.out.println(line); } Following is an extract of the file en_actions_.add(new ClusterEntry&lt;String&gt;("photography",-1, 2, 620554,"photography",null)); en_actions_.add(new ClusterEntry&lt;String&gt;("diagnostic procedure",-1, 1, 177127,"diagnostic procedure",null)); en_actions_.add(new ClusterEntry&lt;String&gt;("emergency procedure",-1, 1, 177783,"emergency procedure",null)); en_actions_.add(new ClusterEntry&lt;String&gt;("medical procedure",-1, 1, 1024392,"medical procedure",null)); en_actions_.add(new ClusterEntry&lt;String&gt;("process",-1, 5, 5470189,"process",null)); When I run this program, I encounter a String out of bounds exception with the following error message Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -2 and it points to the line with the indexOf operator. Please let me know what I have done wrong.BTW the purpose, of the program is to store each field in an array of structures/classes. This is just the first part of the program.
accepted answer: http://stackoverflow.com/a/24003600
has answer: http://stackoverflow.com/a/24004342
tagged with: string
has answer: http://stackoverflow.com/a/24003575
has comment: http://stackoverflow.com/comment/36993860
score: 0
has answer: http://stackoverflow.com/a/24003800
tagged with: exception
possible better answer: http://stackoverflow.com/a/24003575
has comment: http://stackoverflow.com/comment/36993885
has comment: http://stackoverflow.com/comment/36994013
has comment: http://stackoverflow.com/comment/36994000
answer count: 4
has comment: http://stackoverflow.com/comment/36993906
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24003600

http://stackoverflow.com/comment/36999529
score: 0
has text: @JBNizet Thanks for your comment. Yes you are correct. It worked after using the Transaction as given in below post.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24002105

http://stackoverflow.com/a/23946708
accepted answer of: http://stackoverflow.com/q/23943172
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
has body: There is a similar question here that may or may not be a duplicate so I'll just link this here: android - listview filter count. You can count the results after applying a filter. Unless your question was about knowing before hand; if that's the case then please edit your question to specify so and we can try a different solution.
answers question: http://stackoverflow.com/q/23943172
type: Answer

http://stackoverflow.com/comment/124411859
type: Comment
has text: Links almost all dead
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24028672

http://stackoverflow.com/q/24103704
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24218322
accepted answer: http://stackoverflow.com/a/24218322
has title: Object pool with the ability save objects on exit and reload on start?
tagged with: object-pooling
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37183320
has comment: http://stackoverflow.com/comment/37393996
tagged with: apache-commons-pool
type: Question
has comment: http://stackoverflow.com/comment/37376219
has body: Apache Commons seems to be the decent Object Pool implementation out there. Or any other framework that could support the cause How Can I save its state of the pool during shutdown; may be serialize its objects to a external form json, xml ..? and reload during next startup ?
tagged with: java

http://stackoverflow.com/comment/37104963
has text: A `Parent` object could be a `Child` object, casted.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24063489
type: Comment

http://stackoverflow.com/q/24074743
answer count: 3
duplicate of: http://stackoverflow.com/q/19049812
favorite count: 0
has answer: http://stackoverflow.com/a/24074801
type: UnansweredQuestion
score: 6
has body: How can we know that how many string object resides in string litral pools. is there any mechanism or java code available that will give me the number of String object that are curruntly in string pool ???
has comment: http://stackoverflow.com/comment/37125853
upvote count: 6
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24075006
has answer: http://stackoverflow.com/a/24074756
downvote count: 0
linked to: http://stackoverflow.com/q/19049812
has title: How can we know that how many string object resides in string litral pools.?

http://stackoverflow.com/comment/37101395
type: Comment
comment on: http://stackoverflow.com/a/24053637
has text: Unless this is documented, expected behavior, this would be JVM dependent. Which JVM did you pull this from? I was somewhat expecting it to sum the length of the strings in the array and just create the destination array. Especially as using a builder like that is likely to allocate arrays multiple times if you're dealing with the number of strings the OP is dealing with...
type: AnswerComment
score: 0

http://stackoverflow.com/a/36112245
has body: If you have moved on to/are on java8, it provides Watch Service API that allows us to monitor file and folder locations. Have a look at Watch Service API
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23967025

http://stackoverflow.com/a/24100459
downvote count: 0
has comment: http://stackoverflow.com/comment/37174212
score: 1
has body: Every time you loop here while((line = rd.readLine()) != null) { your line variable is replaced with the value returned by rd.readLine(). The last time it loops, that method call will return null. That's why line is null. I'm going to assume you wanted to print out response.
answers question: http://stackoverflow.com/q/24100420
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24100420
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24050388
type: Answer
answers question: http://stackoverflow.com/q/24048693
score: 0
has body: The easiest way is to use startsWith method of Strings, but it is required to check first if its null. public boolean startsWithHi(String str) { if (str == null) { return false; } return str.startsWith("hi"); } In case a String starting with "HI" is also required to return true, you should do str.toLowerCase().startsWith("hi");

http://stackoverflow.com/q/23977848
tagged with: ucanaccess
score: 3
has title: SQL query returns no result from Java although it returns a result in Access
upvote count: 3
tagged with: java
has body: When I run this query: select character from tbl_Unknown where format(fw,'.###')='48.143' and code='0001' it returns a result in the Access query interface but when I try to run it from Java it doesn't return a result. My table (tbl_Unknown): char_id: autonumber value:1 fw: short text value:'48.1425' Hint:after format it become '48.143'. code: short text value:'0001' character: short text value: 'x' My java code: public static String getLostedCharacter(String font,String fw, String code) { Connection conn = ConnectDB.getConnection(); String character = null; try { Statement statement = conn.createStatement(); String query = "select character from tbl_"+font+" where format(fw,'.###')='"+fw+"' and code='" + code + "'"; ResultSet rs = statement.executeQuery(query); while (rs.next()) { character = rs.getString(1); return character; } statement.close(); rs.close(); } catch (SQLException ex) { return ""; } return ""; }
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36947036
downvote count: 0
has answer: http://stackoverflow.com/a/24215039
has answer: http://stackoverflow.com/a/23979232
tagged with: sql
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36945243
tagged with: ms-access
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36945173

http://stackoverflow.com/comment/37107779
has text: I updated question with my `pom.xml`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24064848

http://stackoverflow.com/a/38690816
score: 0
has body: if I recall correctly base64 or image has no different, just like the comment above you could use it like : &lt;img src="data:image;base64,etc"/&gt; if you don't want the user to reload, you could use ajax to replace the src using javascript/jquery, you could just replace it with base64 image instead link to image. if the image ain't that big, I myself would prefer to use base64, you could also save the base64 string into database, if it could hold the length :D and use it later on
type: Answer
answers question: http://stackoverflow.com/q/24092475

http://stackoverflow.com/q/24010955
tagged with: inheritance
score: 0
tagged with: extends
linked to: http://stackoverflow.com/q/7999211
tagged with: android
has answer: http://stackoverflow.com/a/24011344
has body: I want to create a class and it extends the SparseArray. The mKeys and mValues are private in SparseArray , so it cannot be accessed in my Class. But I need do some special things about the mKeys and mValues. How to handle it ? http://developer.android.com/reference/android/util/SparseArray.html
has comment: http://stackoverflow.com/comment/37007259
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37009651
tagged with: java
accepted answer: http://stackoverflow.com/a/24011344
has title: How to create a class which extends the SparseArray in Android?
has comment: http://stackoverflow.com/comment/37007856
type: Question
answer count: 1

http://stackoverflow.com/a/43251650
downvote count: 0
has body: public Optional&lt;String&gt; InputStreamToBase64(Optional&lt;InputStream&gt; inputStream) throws IOException{ if (inputStream.isPresent()) { ByteArrayOutputStream outpString base64Image = data.split(",")[1]; byte[] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(base64Image); Then you can do whatever you like with the bytes like: BufferedImage img = ImageIO.read(new ByteArrayInputStream(imageBytes));ut = new ByteArrayOutputStream(); FileCopyUtils.copy(inputStream.get(), output); //TODO retrieve content type from file, &amp; replace png below with it return Optional.ofNullable("data:image/png;base64," + DatatypeConverter.printBase64Binary(output.toByteArray())); } return Optional.empty();
score: 4
upvote count: 4
type: Answer
answers question: http://stackoverflow.com/q/23979842

http://stackoverflow.com/q/24100990
has comment: http://stackoverflow.com/comment/37175469
has comment: http://stackoverflow.com/comment/37182634
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37175922
has comment: http://stackoverflow.com/comment/37182890
has comment: http://stackoverflow.com/comment/37175695
has title: Adding textfile data to Derby Database
answer count: 0
tagged with: java
has body: I have code for reading data from a textfile and splitting it from the hastags. The data is currently stored in an array. I am also using a Derby Database on Netbeans, so my question is, now that the data is separated, how would I insert this data into my Derby Database. Input Data in Text File: 569#Chandini#Singh#58#24#89 425#Angel#Dan#67#58#26 780#Red#Velvet#48#21#10 Input Data (after splitting hastags) which needs to be inserted into Derby Database: 569 Chandini Singh 58 24 89 425 Angel Dan 67 58 26 780 Red Velvet 48 21 10 This is the current insert code which I have written: Studenttbl std = new Studenttbl(); std.setStudentid(Short.parseShort(Id.getText())); std.setName(name.getText()); std.setSurname(surname.getText()); std.setIt(Integer.parseInt(it.getText())); std.setPhysics(Integer.parseInt(physics.getText())); std.setMaths(Integer.parseInt(math.getText())); StudyDBPUEntityManager.getTransaction().begin(); StudyDBPUEntityManager.persist(std); StudyDBPUEntityManager.getTransaction().commit(); studenttblList.clear(); studenttblList.addAll(studenttblQuery.getResultList()); iterator = studenttblList.listIterator(0); setStudents(iterator.next()); System.out.println("Inserted"); This code currently inserts from textFields. Thanks
type: Question
has comment: http://stackoverflow.com/comment/37175607
score: 0

http://stackoverflow.com/comment/37066240
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24042516
type: QuestionComment
has text: It might help if you'd tag the question with a language you're using - Java isn't it?

http://stackoverflow.com/q/24085835
answer count: 6
has body: Im trying to return a JOptionePane message dialog for each one of the possible throws on my method: public void add_note(String note) throws FileNotFoundException, IOException, InvalidFormatException{ ... content ... } Is there any way to do this?
has title: How to specify a message on a method "throws" in Java?
score: 0
has answer: http://stackoverflow.com/a/24086066
has answer: http://stackoverflow.com/a/24086059
tagged with: exception
has answer: http://stackoverflow.com/a/24085924
has answer: http://stackoverflow.com/a/24085904
possible better answer: http://stackoverflow.com/a/24085885
has comment: http://stackoverflow.com/comment/37146385
has answer: http://stackoverflow.com/a/24085885
accepted answer: http://stackoverflow.com/a/24085904
has answer: http://stackoverflow.com/a/24085889
type: AnsweredQuestion
tagged with: java
tagged with: throws
type: Question

http://stackoverflow.com/comment/37099128
comment on: http://stackoverflow.com/a/24059526
type: AnswerComment
type: Comment
has text: How would a ByteArrayOutputStream read from a ByteArrayInputStream?
score: 1

http://stackoverflow.com/q/23967297
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has title: OpenCV HOGDescriptor returning wrong result in static image
tagged with: android
has comment: http://stackoverflow.com/comment/38676813
has answer: http://stackoverflow.com/a/23973660
has body: I am trying to detect the presence of human in a static image using OpenCV HOGDescriptor in Android. Here is the Android java code, I couldn't find an example in Android online, I tried to port the example in C++ in peopledetect.cpp to it. mHOGDescriptor = new HOGDescriptor(); mHOGDescriptor.setSVMDetector(HOGDescriptor.getDefaultPeopleDetector()); Mat img = Highgui.imread(path); final MatOfRect foundLocations = new MatOfRect(); final MatOfDouble foundWeights = new MatOfDouble(); final Size winStride = new Size(8, 8); final Size padding = new Size(32, 32); mHOGDescriptor.detectMultiScale(img, foundLocations, foundWeights, 0.0, winStride, padding, 1.05, 2.0, false); Boolean withFace = false; Rect[] array = foundLocations.toArray(); for (int j = 0; j &lt; array.length; j++) { Rect rect = array[j]; Log.i("TEST", "Height " + rect.height + ", Width " + rect.width); } When I test it again a small set of 30 photos, I notice that the number of false positive is very high. Some of the photos with no obvious person features are flagged as with person too. (in the foundLocation array above and the rect height and width are quite high). For example, a photo with several flowers are flagged with 2 person inside. It's very obvious is wrong. Is there anything I can do to improve it?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: opencv

http://stackoverflow.com/a/25164994
has comment: http://stackoverflow.com/comment/39203188
has comment: http://stackoverflow.com/comment/39179901
score: 0
has comment: http://stackoverflow.com/comment/39209086
answers question: http://stackoverflow.com/q/24016266
type: Answer
has body: If you have included bar as a part of foo using the build bath configuration in Eclipse, bar is in the build classpath when foo is compiled. The correspondent built artifact for bar (e.g. a jar file) should be in the classpath at runtime too. To accomplish this you have to configure your deployment; doing this in Eclipse is different whith different type of projects. What type of project is foo? Now, if you have a project in the classpath (build or runtime), you can find resources in it using a class loader. Assuming you have added the help folder as a source folder in bar and you have a class com.mycompany.MyClass in foo , you can get the URL of your resource in foo using the following: java.net.URL pdfUrl = com.mycompany.MyClass.class.getResource("/help/file.pdf"); Then, with that URL you can open a stream to read your resource: java.io.InputStream is = url.openStream();

http://stackoverflow.com/comment/36878471
has text: @AndrewArnold I've tagged something called **math** and algorithm with the question. Did I ask for code anywhere? And by the way I've researched a lot and written article series on fractals. Don't assume I haven't tried. The thing is how can I try something I don't know.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23941811
score: 0

http://stackoverflow.com/comment/36927253
type: AnswerComment
has text: You reckon the OP also wants to capture the hyphen?
type: Comment
comment on: http://stackoverflow.com/a/23968034
score: 0

variables
tag name: variables
tags question: http://stackoverflow.com/q/24072914
tags question: http://stackoverflow.com/q/23975528
tags question: http://stackoverflow.com/q/24090390
tags question: http://stackoverflow.com/q/23948532
tags question: http://stackoverflow.com/q/23975215
tags question: http://stackoverflow.com/q/23976248
type: Tag
tags question: http://stackoverflow.com/q/23976481
tags question: http://stackoverflow.com/q/24007755
tags question: http://stackoverflow.com/q/23970831
tags question: http://stackoverflow.com/q/24002752
tags question: http://stackoverflow.com/q/23952139
tags question: http://stackoverflow.com/q/24005132

http://stackoverflow.com/comment/36936584
type: QuestionComment
score: 2
has text: @Mr.Sarunov: Ok, you should edit your question to explain *that*.
comment on: http://stackoverflow.com/q/23973561
type: Comment

http://stackoverflow.com/q/24055808
type: Question
has body: Jar version = RXTX-2.2pre1 native lib Version = RXTX-2.1-7 gnu.io.NoSuchPortException at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:269) The above exception is coming while executing the below code, where portName is "COM1": CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); Please help me to fix the problem.
tagged with: rxtx
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24057179
has title: gnu.io.NoSuchPortException is occuring while executing the program
tagged with: java
has comment: http://stackoverflow.com/comment/37091255
linked to: http://stackoverflow.com/q/274179

http://stackoverflow.com/comment/36975556
type: Comment
has text: Here is a link to the [code] (https://www.dropbox.com/s/a77d9dzh59f6kr4/gifsThread.zip)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23993157

http://stackoverflow.com/comment/37071367
type: Comment
has text: try verifying if the 'targetLocation' File exists in the else statement before doing the copy.
score: 0
comment on: http://stackoverflow.com/q/24044995
type: QuestionComment

http://stackoverflow.com/q/23957174
has title: Scala - Heroku - Play!: cannot resolve symbol ReverseApplication
type: Question
accepted answer: http://stackoverflow.com/a/23957514
tagged with: scala
tagged with: deployment
has body: I'm trying to deploy a Play application written in Scala on Heroku following this documentation. On my local machine everything works fine, the server starts correctly and there's no error at compile time, when deploying on Heroku I get this errors: [error] /tmp/scala_buildpack_build_dir/target/scala-2.10/src_managed/main/com/my/project/application/action/routes.java:8: cannot find symbol [error] symbol : class ReverseApplication [error] location: package com.my.project.application.action [error] public static final com.my.project.application.action.ReverseApplication Application = new com.my.project.application.action.ReverseApplication(); And other very similar regarding a ref package (which I don't have in my project) like this one: package com.my.project.application.action.ref does not exist Then I went looking for what was generated by the sbt clean compile stage command and I found this (routes.class): package com.my.project.application.job; public class routes { public static final com.my.project.application.job.ReverseApplication Application = new com.my.project.application.job.ReverseApplication(); public static class javascript { public static final com.my.project.application.job.javascript.ReverseApplication Application = new com.my.project.application.job.javascript.ReverseApplication(); } public static class ref { public static final com.my.project.application.job.ref.ReverseApplication Application = new com.my.project.application.job.ref.ReverseApplication(); } } Where javascript.ReverseApplication and ref.ReverseApplication cannot be found, there's another generated file called routes_reverseRouting.scala which has this missing packages but it's not imported in the routes.class when compiling and staging. Am I missing something? Last time I deployed (a week ago or so) I didn't had this problems. I'm using scala v2.10.3 and sbt v13.0.
score: 0
tagged with: java
answer count: 1
tagged with: heroku
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23957514

http://stackoverflow.com/comment/36889538
comment on: http://stackoverflow.com/q/23947726
has text: It just dawned on me that *you* answered this question a ways back @AbimaranKugathasan. Small world, eh? :)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24011249
upvote count: 51
type: Answer
score: 51
answers question: http://stackoverflow.com/q/24010597
has body: How try with , separate. See doc here and here. &lt;security:intercept-url pattern="/rest/api/myUrl*" access="ROLE1,ROLE2"/&gt; OR hasAnyRole('ROLE1','ROLE2')
downvote count: 0
has comment: http://stackoverflow.com/comment/116231200

http://stackoverflow.com/q/24024408
type: Question
has body: So the idea is to support #Macro in java. Not only in the final result but also during compile time. So all the injections and code completion will work properly. To add the macro functionality to java we can use CPP. src/Test.java: #define READINT (new java.util.Scanner(System.in).nextInt()) class Test { public static void main(String[] args) { int i = READINT; } } cpp command: $ cpp -P src/Test.java preprocessed/Test.java Result: class Test { public static void main(String[] args) { int i = (new java.util.Scanner(System.in).nextInt()); } } Compile: $ javac preprocessed/Test.java Tnx to aioobe for the original idea. How ever this will only allows us to compile macros, we need a way to use it in code time, so if I do some thing like this: #define PASTE2(a, b) a##b #define PASTE(a, b) PASTE2(a, b) #define setParameter(type,name) private type name;public type PAST(get,name)(){return name;} Usage: setParameter(int, value) Will produce: int value;public int getvalue(){return value;} I want the compile to autocomplete this method. So it will know the class contains a getter getvalue() from type int Also there are java annotations that can work in compile time, but I am not sure that it's possible with them.
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/37033546
has comment: http://stackoverflow.com/comment/37033310
has comment: http://stackoverflow.com/comment/37042887
has comment: http://stackoverflow.com/comment/37049492
score: 1
has comment: http://stackoverflow.com/comment/37050437
has comment: http://stackoverflow.com/comment/37032971
favorite count: 0
has comment: http://stackoverflow.com/comment/37033168
has comment: http://stackoverflow.com/comment/37033457
has comment: http://stackoverflow.com/comment/37046303
answer count: 0
has comment: http://stackoverflow.com/comment/37032605
type: UnansweredQuestion
tagged with: macros
has comment: http://stackoverflow.com/comment/37058185
upvote count: 1
has comment: http://stackoverflow.com/comment/37033498
linked to: http://stackoverflow.com/q/6525059
tagged with: c++
has comment: http://stackoverflow.com/comment/37032726
tagged with: java
has title: How to Implement Macro in JAVA using Eclips / IntelliJ
tagged with: eclipse

http://stackoverflow.com/q/23964120
answer count: 1
tagged with: user-interface
type: UnansweredQuestion
tagged with: swing
tagged with: java
has body: Here is my code: String col[] = {"No","Name","Capacity"}; final DefaultTableModel tablemodel = new DefaultTableModel(col,0); Container contentPane = this.getContentPane(); JTable table = new JTable(tablemodel); table.setBounds(414, 39, 294, 281); contentPane.add(table); contentPane.add(new JScrollPane(table)); JButton btnCreateTheMovie = new JButton("Create the movie theater"); btnCreateTheMovie.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { movietheater.addMovieTheater(addtheaterID.getText(), Integer.parseInt(addtheater_capacity.getText())); try { write_movie_theater = new PrintWriter(new FileOutputStream(new File("d:/movietheater.txt"),true)); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }; int x = movietheater.movietheater_array.size()-1; i++; String ID = movietheater.movietheater_array.get(x).getID(); int capacity = movietheater.movietheater_array.get(x).getCapacity(); Object[] data = {i,ID,capacity}; tablemodel.addRow(data); } }); btnCreateTheMovie.setBounds(75, 192, 166, 23); contentPane.add(btnCreateTheMovie,BorderLayout.NORTH); I ran this code, but the JTtable is not visible. How can I add JScrollpane to JList? How can i see the jtable headers? How can i fix it?
has answer: http://stackoverflow.com/a/23964173
type: Question
tagged with: jtable
score: 0
has title: How can I place a JTable inside a JScrollPane?

http://stackoverflow.com/comment/36881664
type: Comment
comment on: http://stackoverflow.com/a/23943634
has text: Thanks alot it worked...I can't upvote as i don't have sufficient reputation.
type: AnswerComment
score: 0

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/24035404
tags question: http://stackoverflow.com/q/24066425
type: Tag

http://stackoverflow.com/a/24101002
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23973097
upvote count: 1
type: Answer
has body: Building on what @Bill suggested, you have 200+ years of resolution with nanoTime, so why not store nanoTime on init, currentTimeMillis on init, then add the difference of nanoTime and initNanoTime to initCurrentTimeMillis to get an augmented, high-precision timestamp? Once you detect clock skew between this augmented clock and the real one over 100ms, or so, you can reinit.

http://stackoverflow.com/comment/36994182
comment on: http://stackoverflow.com/a/24003591
score: 0
type: AnswerComment
has text: The `Timer.start()` method just places an entry in a queue. The EDT executes those entries. And it also executes the `Runnable`s you submit via `SwingUtilities.invokeLater(Runnable)`.
type: Comment

http://stackoverflow.com/q/23960221
has answer: http://stackoverflow.com/a/23960627
upvote count: 4
accepted answer: http://stackoverflow.com/a/23960627
favorite count: 0
has title: Android: Make screen "flash" white
downvote count: 0
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
score: 4
has body: I want to make my android screen "flash" white temporarily (only once). It needs to be long enough that the user will be able to tell that the screen did in fact turn white. The user will land on a screen, which will flash white after 5 seconds, then display the original screen again (possibly fading from white). What would be the best way to do this? Right now I am creating a rectangle that takes up the entire screen and programatically showing and hiding it.
tagged with: android

http://stackoverflow.com/comment/36980473
type: AnswerComment
score: 0
has text: This: `a += sca.next();` is a *wery* bad idea, use `StringBuilder` instead. http://stackoverflow.com/questions/4645020/when-to-use-stringbuilder-in-java
type: Comment
comment on: http://stackoverflow.com/a/23996254

http://stackoverflow.com/comment/56061459
type: Comment
has text: why operands smaller than int get promoted to int ? its somehow related to a computer word ?
comment on: http://stackoverflow.com/a/24004611
score: 0
type: AnswerComment

http://stackoverflow.com/q/24013169
linked to: http://stackoverflow.com/q/21275824
has title: protected void onPostExecute error
type: UnansweredQuestion
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24013986
score: -1
has body: When I try to implement the onPostExecute method it gives me an error to remove @Override and that a super class or method needs to be called. However, I did call the superclass and such. Here is my code of my Asynctask. public class parsenfill extends AsyncTask&lt;Void,Void,Void&gt; { @Override protected Void doInBackground(Void... params) { try { JsonParsing parse = new JsonParsing(url); parse.parseFile(3, urls); return null; } catch(Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void...voids ) { super.onPostExecute(voids); //Body of method } }
type: Question
has answer: http://stackoverflow.com/a/24013612
has comment: http://stackoverflow.com/comment/37011287
upvote count: 0
has answer: http://stackoverflow.com/a/24013206
favorite count: 0
answer count: 3
tagged with: android
tagged with: android-asynctask

http://stackoverflow.com/a/24058335
has comment: http://stackoverflow.com/comment/37096680
type: AcceptedAnswer
downvote count: 0
has body: As far as I know, there's no direct testng equivalent, but it's generally easy to do the same thing using the @AfterXXX/@BeforeXXX annotations. In your case, you could use @BeforeClass and @AfterClass annotations on 2 different methods to emulate the same thing You can find more information on the supported annotations on the testng website
accepted answer of: http://stackoverflow.com/q/24053886
upvote count: 2
answers question: http://stackoverflow.com/q/24053886
type: Answer
score: 2

http://stackoverflow.com/comment/37131816
type: Comment
comment on: http://stackoverflow.com/a/24077306
type: AnswerComment
score: 0
has text: to save output image. The result image is not full but the resolutio the same as origial bitmap.

http://stackoverflow.com/comment/37151205
comment on: http://stackoverflow.com/a/24088217
score: 0
type: AnswerComment
type: Comment
has text: `I'm satisfied with this solution:` I'm not. What happens if `InterruptedException` occurs during `condition.await()`. How will the lock ever be `unlocked` in that case.

http://stackoverflow.com/comment/36886999
type: Comment
comment on: http://stackoverflow.com/a/23946192
score: 0
type: AnswerComment
has text: Wow thanks a ton, this might solve my problems! At first glance it seems like this might be increasing the run time of the array declaration by a bit, though I'm not sure. But in any case, my main priority is avoiding a memory crash, so it would be worth it.

http://stackoverflow.com/comment/139437002
score: 0
type: Comment
comment on: http://stackoverflow.com/a/57670792
type: AnswerComment
has text: second fix worked as expected; wanted to make this work directly in the code rather than using a JVM parameter

http://stackoverflow.com/a/23992206
score: 0
has comment: http://stackoverflow.com/comment/36972869
type: Answer
has comment: http://stackoverflow.com/comment/36972037
answers question: http://stackoverflow.com/q/23992078
has body: Here is answer that could solve one part of your question: http://www.coderanch.com/t/442889/JSP/java/Reading-META-tag-Servlet You need to collect the meta tag's data using clientside script and send them to your servlet: &lt;script type="text/javascript"&gt; function metaKeywords() { metaCollection = document.getElementsByTagName('meta'); alert(''); for (i=0;i&lt;metaCollection.length;i++) { var nameAttribute = metaCollection[i].name.search(/foo/); if (nameAttribute!= -1) { alert(metaCollection[i].content); } } } &gt; &lt;/script&gt;
accepted answer of: http://stackoverflow.com/q/23992078
type: AcceptedAnswer

http://stackoverflow.com/comment/37001461
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23997805
type: Comment
has text: Well we have no idea what's implementing the Rest service, which makes it hard to say - but unless the offset is really important to you, any decent client *should* treat the values the same way. (Or rather, it should parse them as the same instant in time.)

http://stackoverflow.com/q/23944610
tagged with: arraylist
linked to: http://stackoverflow.com/q/960431
accepted answer: http://stackoverflow.com/a/23944644
duplicate of: http://stackoverflow.com/q/960431
answer count: 4
has answer: http://stackoverflow.com/a/23944747
has answer: http://stackoverflow.com/a/23944795
downvote count: 1
has body: I have a List which I need to convert to an int array (int[]) Currently I am doing this: List&lt;Integer&gt; filters = new ArrayList&lt;Integer&gt;(); // add some elements to filters int[] filteres = new int[filters.size()]; for(Integer i=0 ; i&lt;filters.size(); i++) filteres[i] = filters.toArray( new Integer[filters.size()])[i].intValue(); I think this looks like a messy workaround and that should be somehow else to do this. So is there a better way to make such conversion?
has answer: http://stackoverflow.com/a/23944662
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23944747
has title: Java Integer[] to int[]
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23944644
type: Question
has comment: http://stackoverflow.com/comment/36883610
tagged with: casting
upvote count: 0
has comment: http://stackoverflow.com/comment/36883568
favorite count: 0

http://stackoverflow.com/comment/37163619
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24094844
type: QuestionComment
has text: Which Java? Java 8? (http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) Else Calendar or DateFormatter (http://docs.oracle.com/javase/7/docs/api/javax/swing/text/DateFormatter.html)

http://stackoverflow.com/a/24027545
has body: We can say the space complexity of your approach is O(n), since you can never use more than O(2n) = O(n) memory. Skip the heap and just create the HashMap. After you've created the HashMap, you can iterate through it and put all the elements in an array. Then you can run a selection algorithm such as quickselect on the array to get k-th element, and the first k elements from there (the extension to extract the first k elements via quickselect is fairly trivial, or you can just iterating through again to get them). Then you sort the k elements, if required. The running time would be expected O(n) or O(n + k log k) if sorting is required. The space complexity would be O(n).
type: Answer
upvote count: 7
answers question: http://stackoverflow.com/q/24027482
score: 7
downvote count: 0

http://stackoverflow.com/comment/37001700
type: Comment
comment on: http://stackoverflow.com/q/24007579
score: 0
has text: You can't read binary with a `BufferedReader,` but in any case your I/O isn't 'very slow'. You can read millions of lines a second with a `BufferedReader,` and setting a huge buffer size isn't going to affect that materially. What is slow is your *processing.* If for example you are concatenating every line to a String you will bog down very quickly. Try to find a way to process the line at a time.
type: QuestionComment

jasper-reports
tags question: http://stackoverflow.com/q/23967058
tags question: http://stackoverflow.com/q/23996932
tag name: jasper-reports
tags question: http://stackoverflow.com/q/24099036
tags question: http://stackoverflow.com/q/24036505
type: Tag
tags question: http://stackoverflow.com/q/24088625
tags question: http://stackoverflow.com/q/24040859
tags question: http://stackoverflow.com/q/23987944
tags question: http://stackoverflow.com/q/24078820

http://stackoverflow.com/comment/37371246
has text: More ore less. He proposed to use for <connection> a different protocoll, which is (from my point of view) is not necessary. I bundled everything together. So it woul de easier for others to get a backed solution. But I agree: there was nothing not yet mentioned on this page in my answer. ;-)
type: AnswerComment
comment on: http://stackoverflow.com/a/24202844
score: 0
type: Comment

http://stackoverflow.com/comment/37130810
type: QuestionComment
comment on: http://stackoverflow.com/q/24068025
has text: @Jens I changed the code a bit as per matiash's comment. Here is the logcat - http://pastebin.com/PYgXF6ie now it is showing all the layouts properly but gives errors when the activity is launched (see logcat).
score: 0
type: Comment

http://stackoverflow.com/q/24007579
type: Question
tagged with: io
has comment: http://stackoverflow.com/comment/37002597
has comment: http://stackoverflow.com/comment/37001174
linked to: http://stackoverflow.com/q/5868369
has comment: http://stackoverflow.com/comment/37040858
tagged with: bigdata
upvote count: 1
duplicate of: http://stackoverflow.com/q/5868369
answer count: 1
has body: I am having a big file (50-60GB). I also have pretty nice machine (128GB RAM and 16 core). Now, I want to read the entire file and do some operations. Please also note that the file is binary, so reading as string or as bytes doesn't matter to me. My IO is very slow, so I thought of reading the entire file in BufferedReader's buffer. But I am being let down by the buffered reader's constructor. Now, I can have a maximum of 2G buffer size. This will be very painful for me as I have to read from IO 30 times. Seeing methods of BufferedReader, none seems exceed the 2G mark (even this read function) Am I looking at the wrong class ? Are there any other class in java which suit my requirement ? My main requirement is that I can bear with the initial load time and I want to leverage the 128G memory. Thanks
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37023607
has answer: http://stackoverflow.com/a/24007630
downvote count: 0
tagged with: bufferedreader
score: 1
has title: Maximum buffer size of BufferedReader
has comment: http://stackoverflow.com/comment/37001359
has comment: http://stackoverflow.com/comment/37001700
favorite count: 0
has comment: http://stackoverflow.com/comment/37001084

http://stackoverflow.com/comment/36965239
has text: well, if it is a String, it 'll be "1" -> an actual String, and you won't be able to perform calculations or any other actions you can perform on numerical values on it.
comment on: http://stackoverflow.com/q/23988594
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/36069874
score: 1
has body: I had this problem by copying text from an HTML email which came from a MS Word document, pasting into my JavaScript application's textarea field, and posting it to a Web API connected to an Oracle Database. A quick string cleaning sufficed: var tempDescription = myTextAreaContent; if (tempDescription){ tempDescription = tempDescription.replace('–', '-'); } if (tempDescription){ tempDescription = tempDescription.replace('’', '\''); }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24053636

http://stackoverflow.com/comment/36938479
has text: I have a question: Is there between Double.MAX_VALUE and Double.POSITIVE_INFINITY any number?
comment on: http://stackoverflow.com/a/23971942
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37079304
comment on: http://stackoverflow.com/q/24049177
score: 0
type: QuestionComment
type: Comment
has text: @Fede I am looking specifically for documentation on `MAVEN_CMD_LINE_ARGS`, I don't see that in the link you sent me.

http://stackoverflow.com/comment/37182586
has text: What is the purpose of waiting? Are you waiting for a certain event to happen? Make sure you understand what [sleep()](http://docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html) method does
score: 3
comment on: http://stackoverflow.com/q/24104313
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24074009
has comment: http://stackoverflow.com/comment/37125895
has comment: http://stackoverflow.com/comment/37124986
has comment: http://stackoverflow.com/comment/37126008
has body: I get this error javax.el.PropertyNotFoundException:The class java.lang.String does not have the property com_id The problem is at below line where by mistake a space is added after ${variable} that's why it's covered to String and comunas becomes of type String and String doesn't have any property com_id. &lt;c:forEach var="comunas" items="${variable} " &gt; Just removing the extra ending space will solve your problem. There might be one more issue at below line to access the Comunas from Conexion. &lt;c:set var="variable" value="${Conexion.getComunas}"&gt;&lt;/c:set&gt; It should be &lt;c:set var="variable" value="${Conexion.getComunas()}"&gt;&lt;/c:set&gt; OR &lt;c:set var="variable" value="${Conexion.comunas}"&gt;&lt;/c:set&gt; OR &lt;c:set var="variable" value="${Conexion['comunas']}"&gt;&lt;/c:set&gt;
answers question: http://stackoverflow.com/q/24073693
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24073693
downvote count: 0
has comment: http://stackoverflow.com/comment/37124601
type: Answer
upvote count: 2

http://stackoverflow.com/a/23975324
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23975156
accepted answer of: http://stackoverflow.com/q/23975156
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36940167
score: 1
has body: getBoard().get(..) returns a template type E according to the doc I found online, and in your case, E is type Object (since your board data member in ChessPiece is a collection of Objects.) Object has no getColor() method. You'll want to cast (((getBoard().get(getLocation().getAdjacentLocation(i)))) to a class that has a getColor method. (Or maybe change your board to a collection of ChessPieces)
has comment: http://stackoverflow.com/comment/36940160

http://stackoverflow.com/a/23946400
answers question: http://stackoverflow.com/q/23946358
has body: Your component is being added to the contentPane, which is usually a JPanel and which is held a JLayeredPane held by the JFrame's JRootPane. More importantly, as I've mentioned previously, don't use sucky code like this. Instead create an OuterSpace variable, assign your instance to the variable, add the variable to the JFrame, and then use the variable when you want to access the instance. Note, this doesn't make sense: There is a certain method that I cannot call until the Canvas has been added to a JFrame, so that is why I wish to achieve this. Edit Also check out: http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html Edit 2 You ask: I am getting an error when I do this, because I want to access the bufferstrategy from the canvas, which I cannot do until it's been added to the jframe. Canvas? You shouldn't even be using Canvas objects with Swing GUI's. Use a JPanel. I've never used a BufferStrategy as I usually do all my drawing including animation inside the JPanel's paintComponent method. It sounds like you're trying to access a graphics-like object before the component has been rendered, and that has no bearing on when the component is created. My recommendations still stand.
score: 4
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36886833
has comment: http://stackoverflow.com/comment/36886811
has comment: http://stackoverflow.com/comment/36886835

http://stackoverflow.com/a/23955302
has body: The Object will be garbage collected when there is nothing holding on to it, like any other Object. If you click the Button many times it will create many Objects and the garbage collector will have to do more work. It will all depend on how often you press the Button
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23955245

http://stackoverflow.com/a/23985483
has comment: http://stackoverflow.com/comment/36960823
has comment: http://stackoverflow.com/comment/36959820
has comment: http://stackoverflow.com/comment/36960363
downvote count: 0
has comment: http://stackoverflow.com/comment/36959714
has comment: http://stackoverflow.com/comment/36959685
has comment: http://stackoverflow.com/comment/36960427
answers question: http://stackoverflow.com/q/23985471
has comment: http://stackoverflow.com/comment/36960513
has body: You state that: the background starts out white and when the mouse is released, the background changes to red. What I actually want to do is display an image, and when the mouse is released, display a different image. And you show this code: public void mouseReleased(MouseEvent event){ mousepanel.setBackground(Color.RED); } So you know how to use a MouseListener and where the code should go to make your change, and so the solution to your problem is sort of simple -- instead of mousepanel.setBackground(Color.RED); put in code to change the image. But the all important specifics of how to do this will depend on details of your problem, details that you've not told us or shown us. Specifics such as what image? Where to display it? At the site of the mouseReleased? Do you know how to display any image yet? Edit So again, what are the details of your problem? Unless you have multiple images and they're large, you'll likely want to read them into variables before rendering the GUI, perhaps in your class's constructor. I usually read my Images in using the ImageIO.read(...) method. If your goal is to give the GUI a background image on mouseReleased, then one way is to put a JLabel into your JFrame, convert the Image into an ImageIcon, and then call the JLabel variable's setIcon(myIcon) on mouseReleased, passing the ImageIcon you created into the method call. If your goal is something else entirely, then you'll again need to tell us the details.
type: Answer
has comment: http://stackoverflow.com/comment/36960534
score: 2
has comment: http://stackoverflow.com/comment/36960608
upvote count: 2
has comment: http://stackoverflow.com/comment/36959844
has comment: http://stackoverflow.com/comment/36959899
has comment: http://stackoverflow.com/comment/36960475

http://stackoverflow.com/q/23975406
favorite count: 0
has comment: http://stackoverflow.com/comment/36940309
has comment: http://stackoverflow.com/comment/36940346
possible better answer: http://stackoverflow.com/a/23975849
has answer: http://stackoverflow.com/a/23975416
downvote count: 5
has comment: http://stackoverflow.com/comment/36940323
type: AnsweredQuestion
upvote count: 0
score: -5
has body: This is actually one of my lab questions. You can test to see if an integer, x, is even or odd using the Boolean expression (x / 2) * 2 == x. Integers that are even make this expression true, and odd integers make the expression false. Use a for loop to iterate five times. With each iteration, request an integer from the user. Print each integer the user types, and whether it is even or odd. Keep up with the number of even and odd integers the user types, and print “Done” when finished, so the user won’t try to type another integer. Finally, print out the number of even and odd integers that were entered. I basically know what this question requires me to do. However, I don’t quite understand why boolean expression, (x/2)*2 == x, can test whether the integer is an ever number or an odd number. Lets say my number is 59, which is an odd integer obviously. 59 divided by 2 is 29.5. 29.5 times 2, which equals 59. No matter what x is, (x/2)*2 always equals x. So how to make this expression false when the integer is an odd. Then I can determine what I should print.
has title: Boolean expression (x / 2) * 2 == x to test
has comment: http://stackoverflow.com/comment/36940361
type: Question
has comment: http://stackoverflow.com/comment/36940336
has answer: http://stackoverflow.com/a/23975849
tagged with: java
tagged with: boolean
answer count: 2
accepted answer: http://stackoverflow.com/a/23975416
has comment: http://stackoverflow.com/comment/36940353
has comment: http://stackoverflow.com/comment/36940302

http://stackoverflow.com/comment/37063895
type: Comment
has text: so if we convert videos to webm they will be playable on all phones?
type: AnswerComment
comment on: http://stackoverflow.com/a/24031944
score: 0

http://stackoverflow.com/comment/37118984
has text: Thank you for the clarification. One Question left. You predicted a performance drop with `int[]` compared to `ArrayList<Point>`, right? I tried that, and it gave me a performance boost: The whole segmentation takes **about 7-8 seconds** now. I'm wondering whether it is possible to achieve even better performance through a JNI implementation of `Region`.
comment on: http://stackoverflow.com/a/24070468
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37020513
type: AnswerComment
comment on: http://stackoverflow.com/a/24000781
type: Comment
has text: Hi Jaqen H'ghar. I tried <p:column filterBy="#{item.prefDep.prefDep}" filterOptions="#{prefDepsController.depsCombo}" filterValue="9882"> where "9882" is an integer available in depsCombo. But the result is the same: when the user invoke the dataTable, the dataSet is fully loaded yet, and not filtered, as I expected. Is there something wrong? Thanks.
score: 0

http://stackoverflow.com/comment/36903920
score: 0
has text: when i run this in the browser it gives :HTTP Status 500 - An exception occurred processing JSP page /page2.jsp at line 14. Line 14 is conn=DriverManager.getConnection(dbURL,userId,pwd)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23955541

http://stackoverflow.com/comment/37051294
comment on: http://stackoverflow.com/q/24034636
type: Comment
type: QuestionComment
has text: Why not just "change" the values during runtime...?
score: 1

http://stackoverflow.com/q/24059807
has answer: http://stackoverflow.com/a/24060119
favorite count: 0
has answer: http://stackoverflow.com/a/24060428
type: UnansweredQuestion
answer count: 4
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24060822
has title: check whether the array has a consecutive elements or not?
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/37098795
has comment: http://stackoverflow.com/comment/37098235
has answer: http://stackoverflow.com/a/24060569
has body: hi guys i want to ask something if i want to check whether the array has a 4 consecutive elements or not like this {1,2,4,4,4,4,3,5} it will return true but if the array is {1,2,4,4,4,2,4,2} return false PLEASE help in Java :)} that's my code: public class arraysearch { public static void main(String[] args) { // TODO Auto-generated method stub int arr [] ={1,2,4,4,4,4,5,7,10}; int start = arr[0]; int count = 0; int sum=0; for(int i = 1;i&lt;arr.length-1;i++) { if(start==4) { count++; } else { //count=0; for(int j=i+1;j&lt;arr.length-1;j++){ if(arr[i]==arr[j]&amp;&amp;arr[j]==4) { count++; //continue; } } } } if(count == 4) { System.out.println("it has 4 elements"); } else System.out.println("it hasn't 4 elements"); } }
score: 2
downvote count: 0

http://stackoverflow.com/comment/37029404
score: 1
comment on: http://stackoverflow.com/q/24022813
has text: What exception? Post full stacktrace.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23979756
has comment: http://stackoverflow.com/comment/36951139
score: 0
answers question: http://stackoverflow.com/q/23979578
has body: If you are using maven you don't need TestRunner class. you can introduce your suite class to maven in your pom.xml like this: org.apache.maven.plugins maven-surefire-plugin 2.17 -Xmx3g **/JunitTestSuite.java it will run you suite class and your test classes will not run twice.
has comment: http://stackoverflow.com/comment/36962995
type: Answer

http://stackoverflow.com/comment/37126284
score: 0
type: Comment
type: QuestionComment
has text: public void looper() throws ClassNotFoundException, SQLException { for(int i=0;i<2;i++) { new Thread(this.new StartTester(i)).start(); } } public void connect() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/test","root","pwd"); System.out.println("con success "+con); con.close(); System.out.println("con Closed "+con); }
comment on: http://stackoverflow.com/q/24074892

http://stackoverflow.com/comment/37182078
has text: @AbdulFatir I have mentioned that in the title itself.I want to xor 2 cipher texts in hexadecimal using java. i have written the above code to do that. i want to convert the output to ascii so how do i do that?
comment on: http://stackoverflow.com/q/24104063
score: 0
type: Comment
type: QuestionComment

initialization
tags question: http://stackoverflow.com/q/24004333
tags question: http://stackoverflow.com/q/24057426
tag name: initialization
type: Tag

http://stackoverflow.com/comment/37080447
has text: @Aviad what I am saying is that it doesnt work passing it as a variable but I see the variable from the properties file if I do a sysout. does that make sense?
comment on: http://stackoverflow.com/q/24048341
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24093000
tagged with: hamcrest
has answer: http://stackoverflow.com/a/24093345
answer count: 1
tagged with: junit
downvote count: 0
tagged with: generics
favorite count: 0
has body: I would like to be able to assert that the annotation value matches the expected class: import org.junit.Test; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; public final class AnnotatedClassTest { @Test public void someAnnotationIsString() { assertThat( AnnotatedClass.class.getAnnotation(SomeAnnotation.class).value(), is(equalTo(String.class)); } } However, this is a type error: AnnotatedClassTest.java:9: error: no suitable method found for assertThat(Class&lt;CAP#1&gt;,Matcher&lt;Class&lt;String&gt;&gt;) assertThat( ^ method MatcherAssert.&lt;T#1&gt;assertThat(T#1,Matcher&lt;? super T#1&gt;) is not applicable (actual argument Matcher&lt;Class&lt;String&gt;&gt; cannot be converted to Matcher&lt;? super Class&lt;CAP#1&gt;&gt; by method invocation conversion) method MatcherAssert.&lt;T#2&gt;assertThat(String,T#2,Matcher&lt;? super T#2&gt;) is not applicable (cannot instantiate from arguments because actual and formal argument lists differ in length) method MatcherAssert.assertThat(String,boolean) is not applicable (actual argument Class&lt;CAP#1&gt; cannot be converted to String by method invocation conversion) where T#1,T#2 are type-variables: T#1 extends Object declared in method &lt;T#1&gt;assertThat(T#1,Matcher&lt;? super T#1&gt;) T#2 extends Object declared in method &lt;T#2&gt;assertThat(String,T#2,Matcher&lt;? super T#2&gt;) where CAP#1 is a fresh type-variable: CAP#1 extends Object from capture of ? 1 error Here is the annotation class: import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SomeAnnotation { Class&lt;?&gt; value(); } And the class to which I apply that annotation: @SomeAnnotation(String.class) public final class AnnotatedClass { } The type error occurs because: Class&lt;?&gt; value = AnnotatedClass.class.getAnnot…
has comment: http://stackoverflow.com/comment/37160841
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24093345
tagged with: junit4
tagged with: java
type: Question
score: 9
has title: How do I match a Class<?> against a specific Class instance in a Hamcrest Matcher?
upvote count: 9
has comment: http://stackoverflow.com/comment/37179081

http://stackoverflow.com/a/23995748
type: Answer
has body: Your model list List&lt;MyModel&gt; model=new ArrayList&lt;MyModel&gt;(); public class MyModel{ private String id; private String name; private String age; //Getter &amp; Setter Method } model.add("1","name1","19"); model.add("2","name2","20"); After added element itreate your list for(int i=0;i&lt;model.size();i++){ sout(model.get(i).getId());//here you can get id from your list. sout(model.get(i).getName()); sout(model.get(i).getAge()); }
answers question: http://stackoverflow.com/q/23995584
score: 0

http://stackoverflow.com/comment/36981578
has text: 1. In java there are no functions, only methods. 2. `unused` variables , professional code is full of those guys, it's not like an *un-professional* code where you just go ahead anch change some method signatures...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23997059
score: 0

http://stackoverflow.com/q/24006761
linked to: http://stackoverflow.com/q/214741
tagged with: java
downvote count: 3
type: Question
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/36999657
has answer: http://stackoverflow.com/a/24006818
has comment: http://stackoverflow.com/comment/36999650
tagged with: exception
has body: I have written a java code which is giving me StackOverflowError:- Here in commented portion I tried catching an exception but wasn't able to handle it.When can we handle StackOverflowError and StackOverflowException? public class TestExceptions{ public static void main(String [] arg){ try{ new TestExceptions().go(); }catch(Error r){System.out.println("Error is caught:-"+r);} /*try{ new TestExceptions().go(); }catch(Exception e){System.out.println("Exception is caught here:-"+e);}*/ } void go(){ System.out.println("Go method is called:-"); go(); } }
favorite count: 0
has title: Difference between StackOverflowError and StackOverflowException?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36999626
upvote count: 1
linked to: http://stackoverflow.com/q/5813614

http://stackoverflow.com/q/23976735
accepted answer: http://stackoverflow.com/a/23977561
has comment: http://stackoverflow.com/comment/36943090
tagged with: java
type: Question
upvote count: 2
answer count: 2
tagged with: bash
has comment: http://stackoverflow.com/comment/36943046
tagged with: ubuntu
has body: I tried to execute a Linux command with the below code.But it doesn't give the output just prints exit 1.When I execute the command on Linux Terminal its giving the output.When execute through Java it gives error.Please advice. JButton btnRunningtime = new JButton("RunningTime"); btnRunningtime.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try{ textArea.setText(""); String s2=comboBox.getSelectedItem().toString(); p = Runtime.getRuntime().exec("ps -eo pid,comm,cmd,start,etime | grep -i "+s2); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((s = br.readLine()) != null) { textArea.append(s+"\n"); System.out.println("Running time "+s); } p.waitFor(); System.out.println ("exit: " + p.exitValue()); p.destroy(); } catch(Exception e) { System.out.println("Exception "+e); } } }); btnRunningtime.setBounds(409, 211, 104, 27); contentPane.add(btnRunningtime);
has title: Why does the below code stop with exit 1?
tagged with: linux
has comment: http://stackoverflow.com/comment/36943409
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/36943027
downvote count: 0
has comment: http://stackoverflow.com/comment/36943068
possible better answer: http://stackoverflow.com/a/23977521
tagged with: sh
has answer: http://stackoverflow.com/a/23977521
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36944294
has answer: http://stackoverflow.com/a/23977561

http://stackoverflow.com/comment/37131371
has text: @Duncan ok I change it
score: 0
comment on: http://stackoverflow.com/q/24077680
type: Comment
type: QuestionComment

prime-factoring
tags question: http://stackoverflow.com/q/23951769
type: Tag
tag name: prime-factoring

http://stackoverflow.com/comment/37150043
comment on: http://stackoverflow.com/q/24087556
score: 0
type: QuestionComment
type: Comment
has text: i don't know much about that parser.i am familiar with java. thats why i am trying implement it in java.but if u say xml parser iam interested to do it.

http://stackoverflow.com/comment/37162942
comment on: http://stackoverflow.com/a/24094421
score: 0
type: AnswerComment
has text: Very neat sir but in place of stringbuilder you could simply use String as well.
type: Comment

http://stackoverflow.com/comment/37163829
type: QuestionComment
comment on: http://stackoverflow.com/q/24094686
score: 0
has text: @Luksprog I have updated the question with my adapter... It seems to be true that the fragment does not get the chance to instantiate but I really don't understand why... Because the fragments are there, are inflated, I can swipe through them, however after clicking the button those elements are null in the asyncTask...
type: Comment

http://stackoverflow.com/comment/37024540
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24011250
has text: As you had mentioned, I was handling it wrong. But now even after handling it as UTF-8, I still get incorrect results.

http://stackoverflow.com/a/24023144
score: 0
has body: openpage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("your url"))); } }); Should work
answers question: http://stackoverflow.com/q/24022847
type: Answer

http://stackoverflow.com/a/24004374
upvote count: 5
answers question: http://stackoverflow.com/q/24004333
score: 5
downvote count: 0
has body: Your problem is this line: System.out.println("(" + a + ", " + b + ", " + c + ")"); which is after the while (!answerFound) {...} loop. The compiler thinks that there may be a case where one or more of the variables a, b or c isn't initialised. Use this line: int a=0, b=0, c=0; when declaring the variables, so that they are initialised when declared, and the error should go away.
type: Answer

http://stackoverflow.com/comment/36918340
comment on: http://stackoverflow.com/q/23963159
type: QuestionComment
score: 0
has text: I forgot to answer your question: 'yes'
type: Comment

http://stackoverflow.com/q/24048657
has body: I'm working with JUL for my logging (no I can't change that). I've developed a simple wrapper that I pass in the parameters and it creates the FileHandler with the correct format every time so that I don't have to recreate the logging in every project. My test app functions exactly as intended, but when I import the library into other projects I seem to be getting one (only one so far) unique error: Every single time, it adds a ".0" to the end of the log file. It does this even when there is no conflicts and the Filehandler has been configured to append to the end an existing file (which it does fine). I've played with various file names, most recently I've been using the simple "mylog.log" and the log file still gets output as "mylog.log.0". I've checked and the fileHandler is being passed the correct file ("mylog.log"), but it isn't logging there. This does not happen in my logging test, only in the project I actually want to use it in. Even when using the exact same parameters, I get different file names. Is there some quirk about JUL that I'm missing? Code is very simple. Relevent code: String logFilePath = directory+name; // directory and name are method arguments Handler newFileHandler; File dirFile = new File(directory); if(!dirFile.exists()) { dirFile.mkdirs(); } newFileHandler = new FileHandler(logFilePath, true); newFileHandler.setFormatter(myformatter); //... etc
tagged with: path
tagged with: logging
has answer: http://stackoverflow.com/a/24066025
type: AnsweredQuestion
tagged with: java
has title: Java FileHandler Adding Unnecessary Digit to File Name
possible better answer: http://stackoverflow.com/a/24066025
type: Question
has answer: http://stackoverflow.com/a/29812010
score: 0
answer count: 2
tagged with: filehandler
accepted answer: http://stackoverflow.com/a/29812010

http://stackoverflow.com/comment/36883158
type: Comment
has text: Oh missed that bit. Thanks it works, but can you give a little bit more information on why this works? I want to understand it clearly.
comment on: http://stackoverflow.com/a/23944339
type: AnswerComment
score: 0

spring-mvc
tags question: http://stackoverflow.com/q/24086207
tags question: http://stackoverflow.com/q/24099691
tags question: http://stackoverflow.com/q/24095334
tags question: http://stackoverflow.com/q/23974128
tags question: http://stackoverflow.com/q/23943455
tags question: http://stackoverflow.com/q/24069484
tags question: http://stackoverflow.com/q/23952119
tags question: http://stackoverflow.com/q/23981231
tags question: http://stackoverflow.com/q/24031282
tags question: http://stackoverflow.com/q/24032865
tags question: http://stackoverflow.com/q/23946369
tags question: http://stackoverflow.com/q/24040430
tags question: http://stackoverflow.com/q/23990683
tags question: http://stackoverflow.com/q/23943990
tags question: http://stackoverflow.com/q/23994106
tags question: http://stackoverflow.com/q/24026570
tags question: http://stackoverflow.com/q/24091778
tags question: http://stackoverflow.com/q/24063270
tags question: http://stackoverflow.com/q/24047500
tags question: http://stackoverflow.com/q/23970054
tags question: http://stackoverflow.com/q/23996776
tags question: http://stackoverflow.com/q/23990008
tags question: http://stackoverflow.com/q/24065975
tags question: http://stackoverflow.com/q/24059941
tags question: http://stackoverflow.com/q/24025924
tags question: http://stackoverflow.com/q/24035910
tags question: http://stackoverflow.com/q/24072495
tags question: http://stackoverflow.com/q/24053139
tags question: http://stackoverflow.com/q/24000738
tags question: http://stackoverflow.com/q/23944934
tag name: spring-mvc
tags question: http://stackoverflow.com/q/23974619
tags question: http://stackoverflow.com/q/24080025
tags question: http://stackoverflow.com/q/24009894
tags question: http://stackoverflow.com/q/23982162
tags question: http://stackoverflow.com/q/24016500
tags question: http://stackoverflow.com/q/24057594
tags question: http://stackoverflow.com/q/23985409
tags question: http://stackoverflow.com/q/24074742
tags question: http://stackoverflow.com/q/24034404
tags question: http://stackoverflow.com/q/24023986
tags question: http://stackoverflow.com/q/24006599
tags question: http://stackoverflow.com/q/24040084
tags question: http://stackoverflow.com/q/24053684
tags question: http://stackoverflow.com/q/24065688
tags question: http://stackoverflow.com/q/24011225
type: Tag
tags question: http://stackoverflow.com/q/23967025
tags question: http://stackoverflow.com/q/23966027
tags question: http://stackoverflow.com/q/24008573
tags question: http://stackoverflow.com/q/23955447
tags question: http://stackoverflow.com/q/24096740
tags question: http://stackoverflow.com/q/24066159
tags question: http://stackoverflow.com/q/24000148
tags question: http://stackoverflow.com/q/23959357
tags question: http://stackoverflow.com/q/24053759
tags question: http://stackoverflow.com/q/23958356
tags question: http://stackoverflow.com/q/24013114
tags question: http://stackoverflow.com/q/23950032
tags question: http://stackoverflow.com/q/23953863
tags question: http://stackoverflow.com/q/24071220
tags question: http://stackoverflow.com/q/24041765
tags question: http://stackoverflow.com/q/24034015
tags question: http://stackoverflow.com/q/24050231
tags question: http://stackoverflow.com/q/24070183
tags question: http://stackoverflow.com/q/24050533
tags question: http://stackoverflow.com/q/24013341
tags question: http://stackoverflow.com/q/23993440
tags question: http://stackoverflow.com/q/24101640
tags question: http://stackoverflow.com/q/24051748
tags question: http://stackoverflow.com/q/24050371
tags question: http://stackoverflow.com/q/24055594
tags question: http://stackoverflow.com/q/24080541
tags question: http://stackoverflow.com/q/24034756
tags question: http://stackoverflow.com/q/23947860
tags question: http://stackoverflow.com/q/24047501
tags question: http://stackoverflow.com/q/24049480
tags question: http://stackoverflow.com/q/24012325
tags question: http://stackoverflow.com/q/23966535
tags question: http://stackoverflow.com/q/24007086

http://stackoverflow.com/comment/127760592
comment on: http://stackoverflow.com/a/23951459
type: AnswerComment
has text: why do we need to add something to our java\bin folder? Is not there any other method only we import via gradle and maven?
type: Comment
score: 0

http://stackoverflow.com/comment/112541890
has text: Yes, it is chargeable. Manufactures always give Online API as license based.
comment on: http://stackoverflow.com/a/57640043
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24046085
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24047700
tagged with: java
has comment: http://stackoverflow.com/comment/37074000
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24047700
has comment: http://stackoverflow.com/comment/37074287
score: 0
has body: I have created an InputStream that does File -> (MD5) -> Zip -> Encrypt -> (MD5) and a OutputStream that should reverse this action. But most files fails the test (see Main). Try a file with content "-abcdefghiz-abcdefghijklmnopqrstuvxyz". Others have described similar problems, but they had forgot to close the stream. If i comment out the Cipher or the Deflater/Inflater it works fine. import java.io.*; import java.security.*; import java.math.*; import javax.crypto.*; import javax.crypto.spec.*; import java.security.spec.*; import java.util.*; import java.util.zip.*; class InputStreamWithZipMd5Aes extends InputStream { InputStream is; MessageDigest md = MessageDigest.getInstance("MD5"); MessageDigest mdEncrytped = MessageDigest.getInstance("MD5"); public InputStreamWithZipMd5Aes(InputStream innerInputStream, String password) throws Exception { if (password==null) throw new IllegalArgumentException("password"); byte[] key = password.getBytes("UTF-8"); MessageDigest sha = MessageDigest.getInstance("SHA-1"); key = sha.digest(key); key = Arrays.copyOf(key, 16); // use only first 128 bit SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES"); Cipher ecipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); byte[] iv = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv); ecipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, paramSpec); //File -&gt; MD5 -&gt; Zip -&gt; Encrypt -&gt; MD5 is = new DigestInputStream(innerInputStream, md); is = new DeflaterInputStream(is); is = new CipherInputStream(is, ecipher); is = new DigestInputStream(is, mdEncrytped); } public int read() throws IOException { return is.read(); } public String getMd5() { BigInteger bi = new BigInteger(1, md.digest()); return String.format("%1$032X", bi); } public String getMd5encrypted() { BigInteger bi = new BigInteger(1, mdEncrytped.digest()); return String.format("%1$032X", bi); } } class Ou…
tagged with: deflate
has comment: http://stackoverflow.com/comment/37075863
has comment: http://stackoverflow.com/comment/37074169
has title: Losing bytes when using Cipher combined with Deflater/Inflater
tagged with: encryption
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/23987527
has title: jScrollPane.viewport MouseListener doesn't work if added its viewport.view MouseListener
has answer: http://stackoverflow.com/a/23989021
type: Question
accepted answer: http://stackoverflow.com/a/23989021
score: 0
tagged with: mouselistener
tagged with: java
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/36963335
has comment: http://stackoverflow.com/comment/36963444
has body: I have a JScrollPane subclass with this methods. private MouseListener currentViewportMouseListener; private MouseMotionListener currentViewportMouseMotionListener; private MouseListener currentScrollableMouseListener; private MouseMotionListener currentScrollableMouseMotionListener; @Override public void setViewportMouseListener(MouseListener mouseListener) { if (currentViewportMouseListener == mouseListener) return; viewport.removeMouseListener(currentViewportMouseListener); viewport.addMouseListener(mouseListener); currentViewportMouseListener = mouseListener; } @Override public void setViewportMouseMotionListener(MouseMotionListener mouseMotionListener) { if (currentViewportMouseMotionListener == mouseMotionListener) return; viewport.removeMouseMotionListener(currentViewportMouseMotionListener); viewport.addMouseMotionListener(mouseMotionListener); currentViewportMouseMotionListener = mouseMotionListener; } @Override public void setScrollableMouseListener(MouseListener mouseListener) { if (currentScrollableMouseListener == mouseListener) return; viewport.getView().removeMouseListener(currentScrollableMouseListener); viewport.getView().addMouseListener(mouseListener); currentScrollableMouseListener = mouseListener; } @Override public void setScrollableMouseMotionListener(MouseMotionListener mouseMotionListener) { if (currentScrollableMouseMotionListener == mouseMotionListener) return; viewport.getView().removeMouseMotionListener(currentScrollableMouseMotionListener); viewport.getView().addMouseMotionListener(mouseMotionListener); currentScrollableMouseMotionListener = mouseMotionListener; } So when I use first pair of methods its ok. scrollPane.setViewportMouseListener(mouseListener); scrollPane.setViewportMouseMotionListener(mouseListener); But if I set viewport and view listeners at the same time, viewport Mouse(Motion)Listener does not catch any events. scrollPane.setViewportMouseListener(mouseListener); scrollPane.setViewportMouseMotionListener(mouseListener)…
tagged with: jscrollpane
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36965970

http://stackoverflow.com/comment/37118334
has text: It has nothing to do with memory. It works perfectly but frequently this happens.
type: Comment
comment on: http://stackoverflow.com/a/24070458
score: 0
type: AnswerComment

http://stackoverflow.com/a/24009672
answers question: http://stackoverflow.com/q/23995099
score: 1
upvote count: 1
downvote count: 0
has body: jar files related jnlp from the outside webapp folder Jars in the web app. directory are never meant for client distribution. They stay on the server and are protected. A Java Web Start app. obviously needs to download all the Jars and related resources to the client, so every one of those resources must be available by URL on a public part of the server. Always make sure you can fetch the resource (Jar, JNLP, icons etc.) using a direct link in your favorite browser. If it does not allow it, neither will it work in JWS apps.
type: Answer

http://stackoverflow.com/q/24054754
tagged with: security
downvote count: 0
has title: Secure Remote Password Protocol SRP and Spring Security
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/37089647
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37089333
score: 2
answer count: 0
upvote count: 2
tagged with: srp-protocol
tagged with: java
has body: I am trying to find more information about spring security implementation (if any) of SRP (Secure remote Password protocol) version 6 and above. Jboss has already implementation of the this protocol. http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/Security_on_JBoss-The_Secure_Remote_Password_SRP_Protocol.html Does spring also have or intend to integrate it? Is there any implementation example out there, even if using external libraries/projects but related to Spring?
type: Question

http://stackoverflow.com/q/23964064
answer count: 1
has title: Create a hotspot on the edge on top of all apps that can be swiped on Android
score: 0
type: UnansweredQuestion
tagged with: android-fragments
tagged with: java
type: Question
has body: I would like to develop an app that is very simple. All it does is put a hotspot (at a user specified y coordinate, user specified width and user specified left or right edge of the screen). When the user swipes across this hotspot, it expands horizontally into a seek bar (like one for brightness). A similar app would be Switchr, but I'd like to use the edge swipes for a different purpose (not for switching apps). Anyone know how I could go about doing this? Or if there any open source resources that I could learn from?
has answer: http://stackoverflow.com/a/23964162
tagged with: android

http://stackoverflow.com/comment/37117415
has text: Ok, I got. Fair enough.
type: QuestionComment
comment on: http://stackoverflow.com/q/24066935
type: Comment
score: 0

http://stackoverflow.com/q/23944370
has comment: http://stackoverflow.com/comment/36882976
has comment: http://stackoverflow.com/comment/36882949
has answer: http://stackoverflow.com/a/66688111
has answer: http://stackoverflow.com/a/30219956
linked to: http://stackoverflow.com/q/40075780
has title: How to get milliseconds from LocalDateTime in Java 8
has answer: http://stackoverflow.com/a/65304278
has comment: http://stackoverflow.com/comment/36882957
has answer: http://stackoverflow.com/a/23944399
has answer: http://stackoverflow.com/a/51098166
accepted answer: http://stackoverflow.com/a/23945792
downvote count: 0
has answer: http://stackoverflow.com/a/78069090
has answer: http://stackoverflow.com/a/60731636
favorite count: 0
has body: I am wondering if there is a way to get current milliseconds since 1-1-1970 (epoch) using the new LocalDate, LocalTime or LocalDateTime classes of Java 8. The known way is below: long currentMilliseconds = new Date().getTime(); or long currentMilliseconds = System.currentTimeMillis();
linked to: http://stackoverflow.com/q/42766674
has answer: http://stackoverflow.com/a/66305713
has answer: http://stackoverflow.com/a/51397889
tagged with: datetime
upvote count: 440
has comment: http://stackoverflow.com/comment/36883075
possible better answer: http://stackoverflow.com/a/28706357
tagged with: java-8
has answer: http://stackoverflow.com/a/28706357
answer count: 15
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48743055
score: 440
tagged with: java
has answer: http://stackoverflow.com/a/23945792
has answer: http://stackoverflow.com/a/57647604
type: Question
has comment: http://stackoverflow.com/comment/36883001
has answer: http://stackoverflow.com/a/70977690
has comment: http://stackoverflow.com/comment/130443123
tagged with: java-time
tagged with: milliseconds
has answer: http://stackoverflow.com/a/68770594

http://stackoverflow.com/comment/37022059
score: 1
has text: If you can't use a spy driver; I suggest you run in a debugger and set some breakpoints in `ExpressionEvaluatingSqlParameterSourceFactory.ExpressionEvaluatingSqlParameterSource.doGetValue()` to verify your xpath expressions are being evaluated as expected.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24017026

http://stackoverflow.com/a/24102472
upvote count: 3
has comment: http://stackoverflow.com/comment/37247571
accepted answer of: http://stackoverflow.com/q/24102340
score: 3
has body: Interestingly enough, your current lambda expression will work for this (barring the fix to the typo of system.out.println). The below is merely a more concise way to express it. Effectively, you're writing out a method that takes in two values, produces one, and places it in some sort of consumer. That consumer could be a collection, some function that can handle the result, or another object. Let's take lambdas out of the equation for a moment and write this out with an anonymous class. x.sum(1, 2, new Consumer&lt;Integer&gt;() { @Override public void accept(final Integer value) { // what should go here? } }); We need to tell this result where to go. We've got a few options: A Collection (List, Set, etc) A new reference object A method reference that accepts the parameter Let's take the simplest approach and simply print it out. x.sum(1, 2, new Consumer&lt;Integer&gt;() { @Override public void accept(final Integer value) { System.out.println(value); } }); Now, this makes some sense - we're taking the result of two numbers, adding them together, and then printing the result to the screen. Let's put lambdas back into the mix. This can be expressed in terms of a lambda in this manner: x.sum(1, 2, System.out::println); Effectively, whatever resultant value we get back, we wish to then allow the println method to consume it.
answers question: http://stackoverflow.com/q/24102340
has comment: http://stackoverflow.com/comment/53071254
has comment: http://stackoverflow.com/comment/53074765
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37140102
comment on: http://stackoverflow.com/q/24082285
has text: I need it to be be hosted in the same web application I don't think anyone is going to OK spawning 20 instances of Windows just so we can have a connection pool.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23949978
has comment: http://stackoverflow.com/comment/36893471
has answer: http://stackoverflow.com/a/23950009
has comment: http://stackoverflow.com/comment/36893408
has title: Why is this if statement always returning true?
has answer: http://stackoverflow.com/a/23950038
has body: Suppose: list = ["be", "be", "is", "not", "or", "question", "that", "the", "to", "to"] public static void removeDuplicates(ArrayList&lt;String&gt; list) { for(int i = 0; i &lt; list.size(); i++) { String s = list.get(i); for(int j = 0; j &lt; list.size() - 1; j++) { String s2 = list.get(j); if(s2.equals(s)); { list.remove(j + 1); } } } } When I debug it, s2.equals(s) seems to be returning true all the time when s2 and s does not equal to each other at all. What am I doing wrong?
accepted answer: http://stackoverflow.com/a/23950050
has answer: http://stackoverflow.com/a/23950190
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36893362
tagged with: java
linked to: http://stackoverflow.com/q/14112515
has comment: http://stackoverflow.com/comment/36893378
type: Question
tagged with: string
has answer: http://stackoverflow.com/a/23950050
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/203984
possible better answer: http://stackoverflow.com/a/23950009
has comment: http://stackoverflow.com/comment/36893635
answer count: 4

http://stackoverflow.com/q/24015489
tagged with: swt
has title: SWT Sash/SashForm mirroring
has answer: http://stackoverflow.com/a/24015873
has body: I have tried implementing upper and lower SashForms (Children A and B) inside a horizontal SashForm (Parent). I want to be able to drag a (vertical)sash of one of the Children (child A) and have the (vertical)sash of the other child (Child B) mimic exactly the horizontal position of A. To do this I tried a hack creating a 'ModifiedSashForm' that exposes SashForms sashes: public Sash[] getSashes() { return sashes; } I then created a class that extends ModifiedSashForm and overrides public void onDragSash(Event event){ ... that sends a note to a listener (eg Child A) that B's sash has been dragged: if(sash.getParent().getData(WidgetData.DATA_DRAG_SOURCE).equals(WidgetData.DRAG_SOURCE.SOURCE)){ fireSashDragged(event, sashIndex); }} Child A then substitutes B's sash as the event source (!): if(sashes[sashIndex]!=null){ event.widget=sashes[sashIndex]; } listener.onDragSash(event); and I get a somewhat functioning gui. However I get problems with the sashes getting out of sync. The code is nasty and I would rather not butcher SWT in this way. I then tried getting Child B's weights and pushing them into A - but again get problems - especially when sashes are dragged close to each other, the listeners weight order flips. Next I tried using Sash and FormLayout. Example code is below - but I still can't get the upper vertical sash to exactly mimic the movement of the lower vertical sash and vice versa. //Based on http://www.eclipse.org/swt/snippets/ SWT Snippet107 public class SashTest { final private List&lt;Sash&gt; listeners = new ArrayList&lt;Sash&gt;(); private Shell shell; public static void main(String[] args) { new SashTest().run(); } void run() { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("SashTest"); this.shell = shell; init(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } void init() { final FormLayout form = new FormLayout(); shell.setLay…
tagged with: java
type: Question
tagged with: layout
answer count: 1
downvote count: 0
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/24077792
tags question: http://stackoverflow.com/q/23944243
tags question: http://stackoverflow.com/q/23946983
tags question: http://stackoverflow.com/q/23974084
tags question: http://stackoverflow.com/q/23983278
tags question: http://stackoverflow.com/q/23949924
tags question: http://stackoverflow.com/q/24039881
tags question: http://stackoverflow.com/q/23969007
tags question: http://stackoverflow.com/q/24012611
tags question: http://stackoverflow.com/q/23979841
tags question: http://stackoverflow.com/q/24055807
tags question: http://stackoverflow.com/q/23991595
tags question: http://stackoverflow.com/q/24047458

http://stackoverflow.com/a/26756582
accepted answer of: http://stackoverflow.com/q/24056422
has comment: http://stackoverflow.com/comment/67733377
answers question: http://stackoverflow.com/q/24056422
type: AcceptedAnswer
type: Answer
has body: I had fixed this problem with using an empty Verifier, something like this: Token accessToken = service.getAccessToken(requestToken,new Verifier(""));
has comment: http://stackoverflow.com/comment/68212095
score: 0

http://stackoverflow.com/comment/36971591
comment on: http://stackoverflow.com/q/23992175
type: Comment
type: QuestionComment
score: 10
has text: (Also, don't use `==` to compare strings - see http://stackoverflow.com/questions/513832)

http://stackoverflow.com/comment/37128593
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24061803
has text: @marcadian I imagine that most application need some sort of schooling how to use the application. In this it would be nice if the user could work on the live data without actually work on the live data set. Or simple for test purposes.

http://stackoverflow.com/q/24095407
tagged with: java
has comment: http://stackoverflow.com/comment/37165373
tagged with: screen-capture
upvote count: 1
has comment: http://stackoverflow.com/comment/37165090
has answer: http://stackoverflow.com/a/24095576
has title: Disable running screen capture software in Java app
type: Question
has answer: http://stackoverflow.com/a/37716556
has comment: http://stackoverflow.com/comment/37165454
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37165059
has comment: http://stackoverflow.com/comment/37165846
has comment: http://stackoverflow.com/comment/37165172
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37165011
has body: I found similar questions here, but not with this approach and problem. I have a program which does some mathematics. At the moment, results are written in .doc file. But, this file can be shared through network. I want to disable it by writing results in label. But, again, screen can be captured. So, I found many ideas for preventing this, but the most interesting to me is that to detect and disable all screen capture software running on the system, and periodically (if it is possible) delete clipboard. It doesn't matter what happens with results and my program (if it is lost or program closed), the only important thing is that to prevent screenshot. I know this is impossible to do completely, but, I wanna make it as difficult as I can. P.S. Don't discuss about phone's camera, writing results on a paper and so, I need to prevent creating image of my program (at least when results are on the screen). EDIT: This thing with detecting software, is there any way just to detect if some running program can take screenshot and if is, close my app? But it need to listen all time for starting these software (if it is not running on the my program's start). Thing is that this program is for students, and they don't have money for commercial software (excluding trial, of course), as they do not have enough knowledge for something special (they don't use computers as people on this site). So, this protection doesn't need to be absolute and for programmers, just for student (but they are not naive totally :) ). Thanks in advance.
has comment: http://stackoverflow.com/comment/37164933
tagged with: screenshot
tagged with: detection
score: 1

http://stackoverflow.com/q/23983301
has answer: http://stackoverflow.com/a/23983348
has comment: http://stackoverflow.com/comment/36955520
has comment: http://stackoverflow.com/comment/36955550
accepted answer: http://stackoverflow.com/a/23983348
type: AnsweredQuestion
tagged with: list
tagged with: java
has title: Sorting a List of Objects by specific value
has comment: http://stackoverflow.com/comment/36955564
type: Question
tagged with: sorting
possible better answer: http://stackoverflow.com/a/23983451
tagged with: comparable
has comment: http://stackoverflow.com/comment/36955489
has comment: http://stackoverflow.com/comment/36955495
has answer: http://stackoverflow.com/a/23983451
score: 0
answer count: 2
has body: I want to sort a List of Objects (Remarks) by a value contained in another object (DefectClass). public class Remark { private int remarkId; private DefectClass defectClass; } I have a List of Remarks and I'm using this code to sort them by the title of the defectClass : Collections.sort(remarks, new Comparator&lt;Remark&gt;() { @Override public int compare(Remark arg0, Remark arg1) { return arg0.getDefectClass().compareTo(arg1.getDefectClass()); } }); and this is the Compare to methode in my DefectClass model : public class DefectClass implements Comparable&lt;DefectClass&gt; { private String DefectClassTitle; /* Getters And Setters */ @Override public int compareTo(DefectClass o) { if(o.getDefectClassTitle().equals(this.getDefectClassTitle())) return 0; else return 1; } by these codes I want to sort a List of remarks by the Title of the DefectClass of these Remarks ... but At the end I always get the same list with no sorting. What I'm doing wrong ?

http://stackoverflow.com/a/24009933
answers question: http://stackoverflow.com/q/24008395
has comment: http://stackoverflow.com/comment/51168651
accepted answer of: http://stackoverflow.com/q/24008395
downvote count: 0
score: 21
upvote count: 21
type: AcceptedAnswer
has body: I faced a similar issue and i fixed it by following steps: step1: Go to where your SQL Developer is installed. step2: Go into the sqldeveloper folder (inside SQL developer installation folder) >bin step3: just edit the sqldeveloper.conf . You will see line called “SetJavaHome”, that’s where we need to fix. Remove that line, then try starting the SQL Developer again: use this link for further references.
has comment: http://stackoverflow.com/comment/86823093
has comment: http://stackoverflow.com/comment/59614733
type: Answer

http://stackoverflow.com/a/23964771
answers question: http://stackoverflow.com/q/23964568
has body: You could download firebug plugin for firefox and trace the css , maybe try this css: .item-list ul li { list-style-type: none; list-style-image: none; }
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/37001038
has text: @ace If you are happy with the answer please can you accept it so that the issue can be closed
comment on: http://stackoverflow.com/a/24000960
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23997302
type: Question
possible better answer: http://stackoverflow.com/a/23997400
accepted answer: http://stackoverflow.com/a/23997500
upvote count: 6
has answer: http://stackoverflow.com/a/23997527
has answer: http://stackoverflow.com/a/23997400
answer count: 3
has answer: http://stackoverflow.com/a/23997500
tagged with: arguments
favorite count: 0
has title: How can I avoid using method selector arguments (flag/boolean arguments) in Java
score: 6
has comment: http://stackoverflow.com/comment/36982928
has comment: http://stackoverflow.com/comment/36981923
type: AnsweredQuestion
has body: I've just finished Clean Code and one of the precepts is to avoid passing boolean arguments as functional selectors, e.g., Instead of this: public double calculateWeeklyPay(boolean overtime) { double pay = calculatePay(); if (overtime) { return pay *= 1.5; } return pay; } We should do this, and let the consumer call the appropriate method: public double calculateWeeklyPay() { return calculatePay(); } public double calculateWeeklyPayWithOvertime() { double pay = calculateWeeklyPay(); return pay *= 1.5; } But what should I do in more complicated methods where splitting up the method will mean lots of duplicate code? What should be done here: public double calculateWeeklyPay(boolean overtime) { double pay = calculatePay(); pay = modifyPay1(pay); pay = modifyPay2(pay) pay = modifyPay3(pay) if (overtime) { pay = pay *= 1.5; } pay = modifyPay4(pay); pay = modifyPay5(pay); pay = modifyPay6(pay); }
downvote count: 0
tagged with: if-statement
tagged with: java
tagged with: methods

http://stackoverflow.com/comment/37154716
comment on: http://stackoverflow.com/a/24089879
type: AnswerComment
score: 0
type: Comment
has text: A `swap` method should conceptually check against minimal (negative) and maximal values, so the bug would surface easily. This code's logic doesn't reflect well from it so it's harder to spot bugs like the one mentioned.

http://stackoverflow.com/a/23971693
type: Answer
accepted answer of: http://stackoverflow.com/q/23971457
answers question: http://stackoverflow.com/q/23971457
has body: Probably you do not know much of android. in your main activity class where you want to show data create the filed String array as public class NNN extends Activity { //... some other fields private String[] data; private int current; Private TextView yourTextView; //in on create data = null; current = 0; yourTextView = (TextView) findViewById(R.id.myTextView); then in the method where you parsed the XML of string array do data = parsedArray; current =0; then on button click where you want to set the text to text view if(data ! = null) { //means you have parsed XML to string array if(current != data.length) { //means there is some data that user did not viewd youTextView.setText(data[current]); current++; } } You must see some tutorials to get familiar to the android. See Creating hello world app
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24061144
type: Answer
has body: A global variable is a variable which can be accessed from anywhere (from any part of the program). Thus a public static variable in any Java class is global.
answers question: http://stackoverflow.com/q/24060921
score: 0

http://stackoverflow.com/a/24074041
downvote count: 0
has comment: http://stackoverflow.com/comment/37124522
accepted answer of: http://stackoverflow.com/q/24073765
has body: Well, let's try it: for (int i=0;i&lt;1000000;i++) 5046949 5314307 4619485 5045923 4397800 And with the method call: for (int i=0;i&lt;Math.pow(10,6);i++) 221661393 222532742 239673896 216985460 221952869 Hmm, so Java does recalculate the method every time. Figures, since it has no way to tell that the method will return the same value over time. You could also do: for (int i=0;i&lt;(int)1e6;i++) 4329548 4781644 4614867 4508642 4508642
type: Answer
answers question: http://stackoverflow.com/q/24073765
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23996419
tagged with: sockets
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23996492
tagged with: openshift
type: AnsweredQuestion
has body: I have 2 DIY Gears running simple a Java Client-Server Application with Sockets. What I want to do is sent a command via Socket to Gear1, which sends a command via Socket to Gear2, then sends back to the user whatever data Gear2 sent back. The problem is that I can't connect to Gear2 from Gear1. Gear1 address = 127.13.55.1:16000 Gear2 address = 127.7.21.129:16001 I forwarded port 16000 on Gear1 so that I can communicate with it from a local client. But when I try to connect to Gear2 from inside Gear1 I get the error message: java.net.NoRouteToHostException: No route to host. Is there some configuration I forgot about?
tagged with: java
has answer: http://stackoverflow.com/a/23996492
type: Question
has title: Socket communication between Gears on OpenShift
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/37133401
type: QuestionComment
has text: you can achive this thing by fetching there IPV6 address..do some google that will give you how to fetch IPV6
comment on: http://stackoverflow.com/q/24078847
score: 0
type: Comment

http://stackoverflow.com/a/24074282
has comment: http://stackoverflow.com/comment/37125277
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24074150
type: Answer
answers question: http://stackoverflow.com/q/24074150
has body: You can use JPA Named Query. You need to put the query in the orm.xml file like this: select u from User u where u.lastname = ?1 For example and then you just need to declare the method findByLastname in your repository class: public interface UserRepository extends JpaRepository<User, Long> { List<User> findByLastname(String lastname); } You can see the documentation in Spring Data Documentation or for 2023 version of dependency have a look at Spring Data JPA 3.0.3 Documentation.

http://stackoverflow.com/comment/36976571
comment on: http://stackoverflow.com/a/23994287
type: AnswerComment
has text: just one last ques... say i entered name = ABC and save it. ABC will get saved to the database now when i restart the app, will the abc be visible to the edittext ?
score: 0
type: Comment

http://stackoverflow.com/comment/36981061
comment on: http://stackoverflow.com/q/23996762
type: Comment
type: QuestionComment
score: 1
has text: Not a dupe, I am working with log4j**2**

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/23946496
type: Tag

http://stackoverflow.com/a/24012020
answers question: http://stackoverflow.com/q/24011843
has body: As you can see or have wirten String[] args args is an array of String-Objects Your method void extRight(int x) however takes an int as argument. The primitive type int and the Object type String are not compatible. Plus an array of objects is not compatible with a single object of the same type. You need to Iterate over the array of your arguments and do an explicit conversion/parsing of the String value to an int value. The statement x = x % 10; has not the effect that you expect, in java parameters are passed by value (references too), so when you modify x inside the method, the modified value is visible only in that method. (It's not like in C where you can pass a pointer to an int!) finally your method extRight has the the return type void which will give you error on the line int s = extRight(args); Your method needs to be int extRight(int x) Here is a modified version of your class class ExtRight { public static int extRight(int x) { return x % 10; } public static void main(String[] args){ for(String s : args) { int i = extRight(Integer.parseInt(s)); System.out.print(i); } } } Also note that you should not name a method with the same name of The class, and that classnames should always start with an Upper case letter.
has comment: http://stackoverflow.com/comment/37009253
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37009075

reference
tags question: http://stackoverflow.com/q/23976248
type: Tag
tags question: http://stackoverflow.com/q/23979590
tags question: http://stackoverflow.com/q/23974854
tags question: http://stackoverflow.com/q/23958282
tag name: reference

http://stackoverflow.com/a/23976389
score: 1
has comment: http://stackoverflow.com/comment/36942983
upvote count: 1
has comment: http://stackoverflow.com/comment/36943520
answers question: http://stackoverflow.com/q/23976328
downvote count: 0
has comment: http://stackoverflow.com/comment/36942954
type: Answer
has body: You don't want a simple string escape util, which is what you're using. What you want is an HTML sanitizer, like the OWASP Java HTML Sanitizer. It allows whitelists of HTML tags to not escape, e.g., custom HTML policies with which you can specify allowed tags, in case the default sanitizers don't meet your needs. Other libraries also do this, like JSoup with its cleaning functionality.

http://stackoverflow.com/a/23970517
type: Answer
answers question: http://stackoverflow.com/q/23970044
score: 0
has body: The answer to the question "Which layout manager is best for this task" is subjective. Any capable layout manager can do your layout easily—GridBagLayout, GroupLayout, BoxLayout (by nesting), or MigLayout. The MigLayout is by far the most capable layout manager.

http://stackoverflow.com/a/23997239
answers question: http://stackoverflow.com/q/23997115
has body: You can try with zoom instead of scaling. But, since zoom will not work in FireFox or Opera, try all the following: .scale-half { zoom: 0.5; /* IE */ -moz-transform: scale(0.5); /* Firefox */ -moz-transform-origin: 0 0; -o-transform: scale(0.5); /* Opera */ -o-transform-origin: 0 0; -webkit-transform: scale(0.5); /* Safari And Chrome */ -webkit-transform-origin: 0 0; transform: scale(0.5); /* Standard Property */ transform-origin: 0 0; }
type: Answer
score: -3
downvote count: 3
upvote count: 0

http://stackoverflow.com/comment/36973945
score: 0
type: AnswerComment
has text: You don't need to be that wordy: `menu_list.map(x => x: java.util.Map[String, Any])`
type: Comment
comment on: http://stackoverflow.com/a/23992800

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/24006937

http://stackoverflow.com/q/24086645
score: 1
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/24088446
type: UnansweredQuestion
tagged with: android
tagged with: model-view-controller
has body: I've been following this tutorial. Now, I have to fetch and parse some JSON from a web URL. For that I am thinking to use an AsyncTask for now (might try something else as well. Such as a separate thread. advice..?) But am not able to decide and approach things for now as to how the AsyncTask can inform back to the controller about the state of execution (I thought of using a handler but that'll defeat the purpose of already used controller acting as a Observer for button click(s)..starting the AsyncTask as well) and where can I put the AsyncTask. Certainly not in the controller itself. As the controller has the sole responsibility of giving out commands/judging + it'll be a cluster f* :D Any help in form of sample code clearly showing me how/what to accomplish is appreciated. Thanks
tagged with: java
upvote count: 1
tagged with: observer-pattern
type: Question
has comment: http://stackoverflow.com/comment/37147951
has title: Using AsyncTask With a Observer based Controller class (MVC Arch.)
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37019117
type: QuestionComment
comment on: http://stackoverflow.com/q/24017013
score: 1
has text: You've only inflated the activity layout but the view you access with `findViewById()` is in the fragment layout. http://stackoverflow.com/questions/23653778/nullpointerexception-accessing-views-in-oncreate
type: Comment

http://stackoverflow.com/a/23976168
type: Answer
accepted answer of: http://stackoverflow.com/q/23976151
answers question: http://stackoverflow.com/q/23976151
score: 0
type: AcceptedAnswer
has body: I guess class file is not building in the eclipse,so you are deploying the old version.I guess you mistakenly click the 'Build Automatically' option in the "Project" menu.Wheneevr this option is unchecked,your class file will not be updated automatically.So please check the issue

http://stackoverflow.com/a/23944030
upvote count: 4
downvote count: 0
score: 4
has body: Common way to do it: glPushMatrix(); glRotatef(/*...*/); // Drawing commands here glPopMatrix();
type: Answer
answers question: http://stackoverflow.com/q/23943941

http://stackoverflow.com/comment/36903416
type: QuestionComment
comment on: http://stackoverflow.com/q/23955634
score: 0
has text: show how you instantiate btnSeat1?
type: Comment

http://stackoverflow.com/comment/36931987
comment on: http://stackoverflow.com/a/23970470
type: Comment
has text: @GopalRao Noted. I'm a little rusty on android developement :/. If you see any other flaws, feel free to edit the answer
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36947675
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23978923
has text: Ok use Gdx.app.log(**put the x value here to see if its changing or not**) . Or if thats not showing up in the log use System.out.println(**xvalue**)

http://stackoverflow.com/comment/37167909
comment on: http://stackoverflow.com/q/24097110
score: 4
type: QuestionComment
has text: What do you actually *need* to return?
type: Comment

http://stackoverflow.com/q/23984968
tagged with: java
score: 10
linked to: http://stackoverflow.com/q/21672454
upvote count: 10
type: Question
answer count: 2
has body: I´m new to JPA. I´m developing an application which uses JPA (Hibernate implementation) and Spring. I´ve declared a persistence unit in my persistence.xml and configuration about EntityManagerFactory in my Spring config files. Something like this: <bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> create-drop org.hibernate.dialect.MySQL5Dialect Then I have some DAOs where I inject the entityManager with the @PersistenceContext annotation: public MyDaoImpl implements MyDao{ private EntityManager entityManager; @PersistenceContext private void setEntityManager(EntityManager em){ this.entityManager = em; } } And finally, I have some services where DAOs are injected (by @Autowired Spring's annotation): public MyServiceImpl implements MyService{ @Autowired private MyDao myDao; public List<MyEntity> readOperation(){ // return myDAo.searchAll(); } } As its a read only operation I thought it wasn´t needed the @Transactional annotation, but without it, there is an exception: java.lang.IllegalStateException: No transactional EntityManager available at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:223) at $Proxy121.unwrap(Unknown Source) I´ve read some other posts like this: java.lang.IllegalStateException: No transactional EntityManager available And all is said is that the transactional annotation is needed. It´s true that it works with it, but I´d like to know (and why) if all methods (even read only operations) must be transactional.
has answer: http://stackoverflow.com/a/23985299
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: JPA without transaction
has answer: http://stackoverflow.com/a/23989908
linked to: http://stackoverflow.com/q/14522691
tagged with: transactions

http://stackoverflow.com/a/24001049
answers question: http://stackoverflow.com/q/24000459
score: 0
type: Answer
has body: Always try to avoid Scriplet instead use JavaServer Pages Standard Tag Library and Expression Language that is more easy to use and less error prone. Sample code using JSTL &lt;c:choose&gt; that is equivalent to Java switch case. &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%&gt; ... &lt;c:set var="defaultURL" value="xyz"/&gt; &lt;c:choose&gt; &lt;c:when test="${fn:containsIgnoreCase(request.getRequestURI(), 'fizz')}"&gt; &lt;c:redirect url="http://fizz.example.com" /&gt; &lt;/c:when&gt; &lt;c:when test="${fn:containsIgnoreCase(request.getRequestURI(), 'buzz')}"&gt; &lt;c:redirect url="http://buzz.example.com" /&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;c:redirect url="http://${defaultURL}.example.com" /&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; Read more about All Tags | Functions and Oracle Tutorial - Using JSTL

http://stackoverflow.com/comment/36922481
score: 0
has text: `null` layout is the first alert, `setBounds` of the frame is the second. Try using `setLocationRelativeTo(null)` instead
comment on: http://stackoverflow.com/q/23965255
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/60744220
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24812453
has text: The second xmlConfig() does not work as is. I had to use `new XmlConfig()` instead.
type: AnswerComment

http://stackoverflow.com/a/24051736
upvote count: 3
answers question: http://stackoverflow.com/q/24051705
type: AcceptedAnswer
has body: You should implement compareTo() in the class Employee and start it with: Employee o = (Employee)other; Then continue with comparing this to o - this will ensure you're comparing two Employees (which is the lowest common denominator).
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24051705
type: Answer
score: 3

http://stackoverflow.com/q/23966858
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36933595
tagged with: gradle
has answer: http://stackoverflow.com/a/23973537
tagged with: unit-testing
type: Question
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/23967729
has body: I'm running java tests with gradle. here is the exception I have: java.lang.RuntimeException: java.lang.IllegalStateException: Unable to load Java agent; please add lib/tools.jar from your JDK to the classpath at org.powermock.modules.agent.PowerMockClassRedefiner.redefine(PowerMockClassRedefiner.java:59) at org.powermock.modules.agent.support.PowerMockAgentTestInitializer.redefine(PowerMockAgentTestInitializer.java:49) at org.powermock.modules.agent.support.PowerMockAgentTestInitializer.initialize(PowerMockAgentTestInitializer.java:41) at com.blablacompany.app.weight.WeightMilestonesViewBeanUnitTest.setUpMock(WeightMilestonesViewBeanUnitTest.java:41) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.inv…
has answer: http://stackoverflow.com/a/23973743
accepted answer: http://stackoverflow.com/a/23973743
has comment: http://stackoverflow.com/comment/36925232
has title: Gradle JRE vs JDK please add lib/tools.jar from your JDK
favorite count: 0
tagged with: powermock
possible better answer: http://stackoverflow.com/a/23973537
type: AnsweredQuestion

http://stackoverflow.com/comment/37140859
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24083039
score: 0
has text: `WHAT_SUPPOSE_TO_BE_HERE` should be a valid url under which you have defined a GET method implementation that returns all records

http://stackoverflow.com/comment/37055267
score: 0
type: Comment
type: QuestionComment
has text: run `scp` command using java Process class : http://www.tutorialspoint.com/java/lang/java_lang_process.htm
comment on: http://stackoverflow.com/q/24036702

http://stackoverflow.com/a/23971736
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23967819
type: Answer
has comment: http://stackoverflow.com/comment/36965263
has body: Just derive component and override paint(Graphics) to draw. Place it in the center of a border layout form. You can also override paint in Form but you would run into some issues.
accepted answer of: http://stackoverflow.com/q/23967819
has comment: http://stackoverflow.com/comment/37000085
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37000032
has comment: http://stackoverflow.com/comment/36962755

http://stackoverflow.com/q/24081146
favorite count: 0
accepted answer: http://stackoverflow.com/a/24081335
has comment: http://stackoverflow.com/comment/37137344
possible better answer: http://stackoverflow.com/a/24081255
has answer: http://stackoverflow.com/a/24081255
has answer: http://stackoverflow.com/a/24081335
has title: FindBugs - finalize error
has body: I have finalize method in my project(I know finalize should not be used, but can not change logic now.) FindBugs gives error that super.finalize() should be called, but if that is done and Throwable is catched (which should not be done either), FindBugs gives another error, stating Throwable should not be catched. I can not throw Throwable either, application may suffer. Is there anyway out?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/37137479
tagged with: findbugs
has comment: http://stackoverflow.com/comment/37137514

http://stackoverflow.com/a/24100799
accepted answer of: http://stackoverflow.com/q/24100758
upvote count: 2
has comment: http://stackoverflow.com/comment/37175183
has comment: http://stackoverflow.com/comment/37175214
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37175455
has comment: http://stackoverflow.com/comment/37175471
has comment: http://stackoverflow.com/comment/37175247
has comment: http://stackoverflow.com/comment/37175500
has comment: http://stackoverflow.com/comment/37175395
type: Answer
has comment: http://stackoverflow.com/comment/37175408
has comment: http://stackoverflow.com/comment/37174996
score: 2
has comment: http://stackoverflow.com/comment/37181876
has body: Because the method you're calling - JComponent.setLocationRelativeTo(Component c) takes a Component parameter, not an Object parameter. If you think about it, it wouldn't make sense otherwise: To setLocationRelativeTo something, you need to know what that something's location is. Component is structured to accommodate this, but arbitrary objects are not. Would: Double d = new Double(4.48); dia.setLocationRelativeTo(d); or Boolean b = new Boolean(false); dia.setLocationRelativeTo(b); make sense? Addendum: It sounds like you need to read up on this. This The following is acceptable: public Class Frame extends JFrame{ ... dia.setLocationRelativeTo(this); because this in this context refers to an instance of Frame, which extends JFrame, which extends JComponent. The following is unacceptable: public void newDialog(Object obj){ JDialog dia = new JDialog(); dia.setSize(200,200); dia.setLocationRelativeTo(obj); because obj is an instance of Object, which does not.
answers question: http://stackoverflow.com/q/24100758
has comment: http://stackoverflow.com/comment/37182021
has comment: http://stackoverflow.com/comment/37175297

http://stackoverflow.com/comment/37078483
score: 1
comment on: http://stackoverflow.com/q/24048341
has text: If i understand correctly you can set browser=firefox in the properties file and it works.. So i didn't understood because you are still having a problem :) Can you show me the structure of your project also, the file is loaded properly?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36880948
type: Comment
comment on: http://stackoverflow.com/a/23943163
has text: hmmmmmm... I think i need a bit in code :) u can see i suck at this
type: AnswerComment
score: 0

http://stackoverflow.com/q/24006127
upvote count: 3
possible better answer: http://stackoverflow.com/a/24006175
tagged with: java
has comment: http://stackoverflow.com/comment/36998546
has answer: http://stackoverflow.com/a/24006175
accepted answer: http://stackoverflow.com/a/24006136
type: Question
has comment: http://stackoverflow.com/comment/36998514
answer count: 2
downvote count: 0
tagged with: arraylist
has body: I think trimToSize() method in Java's ArrayList is unnecessary. My understanding is: Let's take an array of integers: int[] a = new int[10]; //This allocates ten free slots proactively. The major advantage of ArrayList is it can create arrays dynamically at run time thus saving memory. Now the code ArrayList&lt;Integer&gt; arl = new ArrayList&lt;Integer&gt;(10); will not assign ten free slots proactively; instead it adds slots only when there is data to be stored. Now Java specification says trimToSize() will remove the unused space from ArrayList, but according to my understanding there won't be any unused space in ArrayList because space is created only when data is available, and when data is available the unused or free space will be nil.
has title: Is Java Array list trimToSize() method redundant?
favorite count: 0
has answer: http://stackoverflow.com/a/24006136
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36998539
score: 3

http://stackoverflow.com/comment/131506393
type: AnswerComment
comment on: http://stackoverflow.com/a/74442369
score: 0
type: Comment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33185482)

http://stackoverflow.com/comment/36920354
comment on: http://stackoverflow.com/q/23964101
score: 0
type: Comment
type: QuestionComment
has text: @etherous I was looking into `sharedPreferences`, but I have no idea how I would adapt it to my use, or if it was even a good idea for what I was doing.

http://stackoverflow.com/comment/36962629
has text: @WahtsUpWorld: don't be too hard on yourself, and please don't beat yourself up -- that's our job. Seriously though, you'll get better at Java with practice, and your questions will get better too. Your first one above wasn't a bad one, other than throwing perhaps a bit too much code at us, but knowing what is too much code and what is too little takes experience. Keep at it, persevere, and you may soon find that you actually like this stuff.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23986926
type: Comment

http://stackoverflow.com/comment/36943027
comment on: http://stackoverflow.com/q/23976735
has text: `.When execute through Java it gives error` Which error/Exception?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36952359
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23980760
has text: You have not provided web.xml contents. If your page is indeed getting forwarded and you are getting null for the attribute there is no issue with mappings.
type: AnswerComment

http://stackoverflow.com/comment/37080605
has text: Can you show the code for this. MadProgrammer is thinking what I am thinking. I am certain of it. MadProgrammer could you show a working example of this. I think you are thinking what I am thinking. I was trying to see if you could make the same example without having to implement an interface. When you say create an instance of ActionListener and assign it to m are you saying ActionListener myList = m; or something like that.
comment on: http://stackoverflow.com/a/24048448
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23986760
score: 3
answers question: http://stackoverflow.com/q/23986641
upvote count: 3
type: Answer
downvote count: 0
has body: The files are in the same folder as my NewJFrame class This automatically suggest that the images are, what is commonly known as, embedded resources. Remember, a class lives in a package, which can live inside a Jar file. This makes accessing these resources different from accessing resources on the file system... Instead of using ImageIO.read(new File("Nguyen_black_dress.png")); you should be using something like Class#getResource(...), for example.. try { img = ImageIO.read(getClass().getResource("Nguyen_black_dress.png")); } catch (IOException e) { e.printStackTrace(); } Reading images each time you want to display them is inefficient, you may not see too much of an issue with something simple like this, but trust us when we say, this is not a good habit to get into. Consider loading the images when the class is instantiate and storing them in a Map of some kind for easy retrieval, for example... private Map&lt;String, BufferedImage&gt; mapImages; //... mapImages = new HashMap&lt;&gt;(25); mapImages.put("normal", ImageIO.read(new File("Nguyen_normal.png"))); Then when you want to the "normal" image, simply retrieve it from the Map... BufferedImage normal = mapImages.get("normal");

http://stackoverflow.com/q/23993608
score: 1
tagged with: java
has body: I am using Java 6. I have static block in one of my class say "MyStaticBlockClass.java". There are no references to that class (MyStaticBlockClass.java) from the rest of my project. Here I need to execute the static block in the above specified class at the time of JVM start up. Is there a way to load the class into JVM without references to that class ?
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23993644
favorite count: 0
has title: How to load a class without referring to it?
type: AnsweredQuestion
tagged with: classloader
accepted answer: http://stackoverflow.com/a/23993644
upvote count: 1
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/37095453
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24058212
has text: How are you building this? It's pretty easy with Maven (and I think Gradle), but I don't know about fiddling with it manually in Eclipse.

http://stackoverflow.com/comment/37108333
type: Comment
has text: Sure, but the settings in the other answer you've currently accepted will only affect the Tomcat connector, not the WAR application running within it. If you want the application running within your WAR to use those settings, you'll need one of the two options I've just mentioned (probably the first one if you only have one application).
comment on: http://stackoverflow.com/a/24065161
type: AnswerComment
score: 0

class
tags question: http://stackoverflow.com/q/24047507
tags question: http://stackoverflow.com/q/24073964
tags question: http://stackoverflow.com/q/24091951
tags question: http://stackoverflow.com/q/24024888
tags question: http://stackoverflow.com/q/24102792
tags question: http://stackoverflow.com/q/24057617
tags question: http://stackoverflow.com/q/24072387
tags question: http://stackoverflow.com/q/24011432
tags question: http://stackoverflow.com/q/24050654
tags question: http://stackoverflow.com/q/23951802
tags question: http://stackoverflow.com/q/24010920
tags question: http://stackoverflow.com/q/23957393
tags question: http://stackoverflow.com/q/23983697
tags question: http://stackoverflow.com/q/24029546
tags question: http://stackoverflow.com/q/24003616
tags question: http://stackoverflow.com/q/23988977
tags question: http://stackoverflow.com/q/24076476
tags question: http://stackoverflow.com/q/23975215
tags question: http://stackoverflow.com/q/24100867
tags question: http://stackoverflow.com/q/24013245
tags question: http://stackoverflow.com/q/24097319
type: Tag
tags question: http://stackoverflow.com/q/23978541
tags question: http://stackoverflow.com/q/23983278
tags question: http://stackoverflow.com/q/24073870
tags question: http://stackoverflow.com/q/24043611
tags question: http://stackoverflow.com/q/24009971
tags question: http://stackoverflow.com/q/24007755
tags question: http://stackoverflow.com/q/24055105
tags question: http://stackoverflow.com/q/24085675
tag name: class
tags question: http://stackoverflow.com/q/24022285
tags question: http://stackoverflow.com/q/24052746
tags question: http://stackoverflow.com/q/24027665
tags question: http://stackoverflow.com/q/24097409
tags question: http://stackoverflow.com/q/23999157
tags question: http://stackoverflow.com/q/24020413
tags question: http://stackoverflow.com/q/24096952
tags question: http://stackoverflow.com/q/24055268
tags question: http://stackoverflow.com/q/24031712
tags question: http://stackoverflow.com/q/23944537

http://stackoverflow.com/q/23945407
linked to: http://stackoverflow.com/q/394616
has body: I use the "Create Jar File..." option and choose my main class. When I try to execute the program from the Jar, my JOptionPane window will show up, but the program will just end there and not show my JFrame. I have tried putting the jar inside the project folder and running it from there, but some of my objects will not draw when I start it. Is there something I could be doing wrong or something I could do to fix my problem?
has answer: http://stackoverflow.com/a/25935809
tagged with: bluej
upvote count: 1
answer count: 1
tagged with: jar
favorite count: 0
has title: When I convert a Java project to a .jar with BlueJ, the project doesn't work as it does straight from BlueJ
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25935809
type: Question

http://stackoverflow.com/q/24072699
tagged with: bufferedreader
has body: I've modified the following code from an example on the internet. Currently it POSTs and returns the response line by line. How can I modify the code so it returns the entire response in one line, so I can parse it more easily. static void updateIp() throws MalformedURLException, IOException { String urlParameters = "name=sub&amp;a=rec_edit&amp;id=9001"; URL url = new URL("http://httpbin.org/post"); URLConnection con = url.openConnection(); con.setDoOutput(true); BufferedReader reader; try (OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream())) { writer.write(urlParameters); writer.flush(); String line; reader = new BufferedReader(new InputStreamReader(con.getInputStream())); while ((line = reader.readLine()) != null) { System.out.println(line); } } reader.close(); } Any help would be greatly appreciated!
score: 0
has title: Getting entire POST response in one line
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24081439
has comment: http://stackoverflow.com/comment/37122284
accepted answer: http://stackoverflow.com/a/24081439
tagged with: java
tagged with: post
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37122496

http://stackoverflow.com/comment/36891068
type: Comment
type: QuestionComment
has text: For java you can try using this. String[] names = _name_.split(","); where name = the variable holding the concat String. Your split String will be stored in an array names[]
comment on: http://stackoverflow.com/q/23947155
score: 0

http://stackoverflow.com/comment/37163575
type: Comment
type: QuestionComment
has text: Can you make a connection using a browser on your device?
comment on: http://stackoverflow.com/q/24081179
score: 0

http://stackoverflow.com/a/24002221
has body: You need a transaction. EventCategory eventCategory = new EventCategory(); eventCategory.setEvent(event); eventCategory.setCategory(category); eventCategory.setId(eventCategoryId); Session session = getSession(); Transaction transaction = session.beginTransaction(); session.save( eventCategory ); transaction.commit();
has comment: http://stackoverflow.com/comment/36999508
has comment: http://stackoverflow.com/comment/37028382
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24002105
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37015997
answers question: http://stackoverflow.com/q/24002105
type: Answer
has comment: http://stackoverflow.com/comment/37027022
score: 2
downvote count: 0

rpc
tag name: rpc
type: Tag
tags question: http://stackoverflow.com/q/23999590

http://stackoverflow.com/q/24065450
type: Question
has comment: http://stackoverflow.com/comment/37203528
has body: I set up a Java EE DAL as a jar library. I used JPA + Hibernate + C3P0 for the connection pool management. The EntityManager class is produced by the following bean package my.dal; import javax.enterprise.inject.Alternative; import javax.enterprise.inject.Default; import javax.enterprise.inject.Produces; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.PersistenceContext; @Alternative @Default public class EntityManagerProvider { private EntityManager entityManager; @Default @Produces @PersistenceContext public EntityManager getEntityManager() { if(entityManager == null) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("DALPersistenceUnit"); entityManager = emf.createEntityManager(); } return entityManager; } } A DAO class, then, injects the EntityManager and uses it package my.dal.dao; @Default public class UserDAO { @Inject private EntityManager entityManager; public User find(String username) { ... } ... } These are the C3P0 dependencies set in the pom.xml com.mchange c3p0 0.9.2.1 org.hibernate hibernate-c3p0 4.3.5.Final com.mchange mchange-commons-java 0.2.3.4 I wrote a test class (named DALUserTest) which injects the DAO class and uses it to persist data on a DB. The problem is that whenever I try to run the test, the application stops at the injection step throwing the following exception stack javax.enterprise.inject.CreationException 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 org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33) at java.security.AccessController.doPrivileged(Native Method) at org.jboss.weld.injection.Exceptions.rethrowE…
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/57546823
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37128759
answer count: 1
has comment: http://stackoverflow.com/comment/37129041
has title: C3P0 + Hibernate ClassNotFoundException: com.mchange.v2.log.MLog
tagged with: jpa
tagged with: c3p0
has answer: http://stackoverflow.com/a/57546823
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37110752
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/23941083
tagged with: maven-cobertura-plugin
tagged with: cobertura
tagged with: code-coverage
tagged with: java
has title: Cobertura coverage ignore annotation in maven project?
type: Question
score: 4
has answer: http://stackoverflow.com/a/27939706
upvote count: 4
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/29667832
favorite count: 0
type: UnansweredQuestion
has body: I am trying to exclude certain methods from Unit test coverage. I am using Cobertura because I found out that since version 2.0 they introduced a coverage ignore annotation for excluding methods and classes: https://github.com/cobertura/cobertura/wiki/Coverage-Annotations I set up my project as it should be, created a @interface called "CoverageIgnore" as it is in the article and annotated some methods. I am using Cobertura 2.0.3 and when generating the report the annotations don't seem to work :( I found this article also - https://github.com/cobertura/cobertura/wiki/Ant-Task-Reference#ignore-method-annotation which talks about some configuration of the instrument task in cobertura but it seems to be Ant-compliant: &lt;cobertura-instrument&gt; &lt;ignoreMethodAnnotation annotationName="foo.bar.CoverageIgnore"/&gt; &lt;/cobertura-instrument&gt; Is there something like this for my maven project? Thanks.
tagged with: maven
has answer: http://stackoverflow.com/a/27820542

http://stackoverflow.com/a/36641849
answers question: http://stackoverflow.com/q/24016962
upvote count: 4
downvote count: 0
score: 4
has body: The reasoning is very simple, it is because Object is the base class for all the Java classes. So even if we have Object's method defined as default method in some interface, it will be useless because Object's method will always be used. That is why to avoid confusion, we cannot have default methods that are overriding Object class methods.
type: Answer

http://stackoverflow.com/q/23993844
type: Question
accepted answer: http://stackoverflow.com/a/23994287
has title: Android saving data from edit texts fields to database
has answer: http://stackoverflow.com/a/23993979
answer count: 2
downvote count: 4
possible better answer: http://stackoverflow.com/a/23993979
upvote count: 0
has comment: http://stackoverflow.com/comment/36974911
tagged with: sqlite
favorite count: 0
has answer: http://stackoverflow.com/a/23994287
has body: I am new to SQLite. I have an activity in which I have different fields like Name,Email,Date of Birth etc. When user fill the information and clicks the save button I want it to get saved to the database. But I am stuck in mid way and don't know what to do.How to save the data from Edit Text Views to the database on Save Button click.Please help me. I am sharing my code. DataBaseHelper.java public class DatabaseHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "NewUserDb.db"; private static final String TABLE_INFO = "info"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_GOAL = "userGOAL"; public static final String COLUMN_NAME = "userName"; public static final String COLUMN_EMAIL = "userEmail"; public static final String COLUMN_DOB = "userDOB"; public static final String COLUMN_HEIGHT = "userHeight"; public static final String COLUMN_WEIGHT = "userWeight"; public static final String COLUMN_GENGER = "userGender";; public static final String COLUMN_ZIP = "userZIP"; private static final String[] COLUMNS = { COLUMN_ID, COLUMN_GOAL, COLUMN_NAME, COLUMN_EMAIL, COLUMN_DOB, COLUMN_HEIGHT, COLUMN_WEIGHT, COLUMN_GENGER, COLUMN_ZIP }; // http://www.techotopia.com/index.php/An_Android_SQLite_Database_Tutorial /* * public DatabaseHelper(Context context, String name, CursorFactory * factory, int version) { super(context, name, factory, version); // TODO * Auto-generated constructor stub * * } */ @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub String CREATE_USER_TABLE = "CREATE TABLE User ( " + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "gaol TEXT, " + "name TEXT )"; db.execSQL(CREATE_USER_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS users"); // create fresh books table this.onCreate(db); } public DatabaseHelper(Context …
tagged with: android
type: AnsweredQuestion
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/36975002

http://stackoverflow.com/comment/37116355
score: 0
comment on: http://stackoverflow.com/q/24068308
has text: It has to be cast this way to account for the issue between java and c++ that java doesn't support unsigned. Anyway, that part of the code works. When I get the value out of the the function and write it to std out I can see the value and it is correct. It just isn't being passed up to the java code.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36992420
has text: i am running it using admin account
type: Comment
comment on: http://stackoverflow.com/a/23999687
score: 0
type: AnswerComment

http://stackoverflow.com/q/24076434
has comment: http://stackoverflow.com/comment/37171134
has answer: http://stackoverflow.com/a/27688288
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/37128946
tagged with: java
tagged with: hibernate
type: Question
has title: save Unicode characters(utf-8) in oracle APEX with hibernate
has body: I use SQL Developer IDE to work visually with database, and hibernate_4.2.1 to save my data(in UTF-8 Unicode) to database in my application. And problem is: when i insert data from SQL Developer is fine, and show correct. but when i insert from application it's don't show correct. from SQL Developer: INSERT INTO PLACEMENT_USER (ID, FIRST_NAME, last_name) values(11111,'علی','علی پور'); !First record inserted from application with hibernate, second record inserted from SQL Developer
tagged with: sql-server
score: 0
answer count: 1

http://stackoverflow.com/comment/37172347
comment on: http://stackoverflow.com/q/24099456
type: Comment
score: 2
has text: http://ideone.com/tPcGjl says something else. Are you sure about content of your list? maybe it is something like `2+2-2`?
type: QuestionComment

http://stackoverflow.com/a/24074011
accepted answer of: http://stackoverflow.com/q/24073964
has comment: http://stackoverflow.com/comment/37125216
downvote count: 0
has comment: http://stackoverflow.com/comment/37125532
has comment: http://stackoverflow.com/comment/37125120
has comment: http://stackoverflow.com/comment/37125558
has body: You need to create a get method to your name of product inside the Product class to enable you to get the data you want to check on each iteration of the array. you cant just compare an object with a string without accessing the String. solution: create a getter method in your Product class public String getName() { return this.name; } Iterate to all the Product class and compare string by calling the getter method for the name of the product for(int i = 0; i &lt; current_size_product; i++) { if(product[i].getName().contains(string)) //true }
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37124758
type: Answer
has comment: http://stackoverflow.com/comment/37125075
upvote count: 5
has comment: http://stackoverflow.com/comment/37125662
answers question: http://stackoverflow.com/q/24073964

http://stackoverflow.com/q/23959615
has answer: http://stackoverflow.com/a/50246200
has comment: http://stackoverflow.com/comment/36911511
tagged with: apt-get
tagged with: ubuntu
has answer: http://stackoverflow.com/a/74459934
has answer: http://stackoverflow.com/a/23959640
upvote count: 14
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/56625916
has title: how to remove default-jre java installation from Ubuntu?
has answer: http://stackoverflow.com/a/44950496
score: 14
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/50246200
has answer: http://stackoverflow.com/a/77087014
tagged with: java
accepted answer: http://stackoverflow.com/a/23959640
type: Question
has body: I had no java (i.e. java -version said java no found or similar) I installed it like this: sudo apt-get install default-jre This results in installing java 1.6 - I need java 1.7 So the next probelem is how to uninstall it. I tried this: sudo apt-get --purge -remove default-jre Which seemed to work, but when I do: java -version I still java respond with 1.6 - i.e. id didnt uninstall java. Ok, so I guess -remove does not remove the thing it installed. Is there a way to o this?
has answer: http://stackoverflow.com/a/64464408

http://stackoverflow.com/a/24056775
score: 0
answers question: http://stackoverflow.com/q/24056419
type: Answer
has body: After you switch to frame WebElement ifr = driver.findElement(By.xpath("//iframe[@id='loginIframe']")); driver.switchTo().frame(ifr); Try to switch back with: driver.switchTo().defaultContent();}

http://stackoverflow.com/comment/37194012
has text: Are there any drawbacks to using CraftBukkit in place of Bukkit?
comment on: http://stackoverflow.com/a/24110352
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24024895
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5837698
has comment: http://stackoverflow.com/comment/37066281
has comment: http://stackoverflow.com/comment/37034298
has comment: http://stackoverflow.com/comment/37035387
has comment: http://stackoverflow.com/comment/37034125
tagged with: java
has comment: http://stackoverflow.com/comment/37033776
downvote count: 1
type: Question
has body: I have persistent problems with networking in java. It might because I'm used to operate upon bytes, which are for some reason signed in Java (I take it as a proof of existence of the ultimate Evil). I have been struggling to send binary data using some packet system. Originally, I wanted to create data myself, but Java is not designed to operate with bytes. Instead, it's advised that you send serialised object. So I looked up how to create a serialisable class ChatPacket that I will send over network. This my code derived from answer similar to the one I linked above (I couldn't found the original one): //Convert packet to raw data public byte[] getBytes() { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { //Pass the stream refference to the weird object output stream thing out = new ObjectOutputStream(bos); //Save the packet into byte stream out.writeObject(this); //Create separate arrays of bytes byte[] data = bos.toByteArray(); //Funny way to convert int in array of 4 bytes. The Java Way... byte[] size = ByteBuffer.allocate(4).putInt(data.length).array(); //The final data array - feel free to sugest more efficient way to merge the two arrays byte[] data_all = new byte[data.length+4]; //Merge the arrays of bytes - I found no other way than creating third array. for(int i=0; i&lt;data_all.length; i++) { //Save the size if(i&lt;4) { data_all[i] = size[i]; } //Save the data else { data_all[i] = data[i-4]; } } //Debug output Log.debug("Sending packet of "+data.length+" bytes"); for(int i=0; i&lt;data_all.length; i++) { Log.debug(i+": Sending character: "+((char)data_all[i]))+" ["+(int)data_all[i]+"]"); } Now the last debug lines produce a nice output: Sending packet of 262 bytes 0: Sending character: 0 [0] - 1: Sending character: 0 [0] | The int - size of the packet 2: Sending character: 1 [1] | 3: Sending character: 6 [6] - 4: Sending character: -84 [-84] - 5: Sending character: -19 [-19] | 6: Sending character: 0 [0] | The dat…
has comment: http://stackoverflow.com/comment/37066069
has comment: http://stackoverflow.com/comment/37066157
has comment: http://stackoverflow.com/comment/37034236
has comment: http://stackoverflow.com/comment/37037426
has comment: http://stackoverflow.com/comment/37033867
score: 0
tagged with: byte
upvote count: 1
has comment: http://stackoverflow.com/comment/37035457
has comment: http://stackoverflow.com/comment/37064538
has comment: http://stackoverflow.com/comment/37065906
favorite count: 0
has comment: http://stackoverflow.com/comment/37066304
has title: Loosing information while sending serialised data
answer count: 0

http://stackoverflow.com/q/23990887
has body: Hi i have a JSON file saved in a txt file and i am parsing it in my android code. I keep getting a JSONSyntax lateral exception. I used a json validator and my json syntax is correct. I really don't know the problem. Can someone pls help me out. I used this JSON object array in my file {"destinations": [ { "name": "Aegean Coast", "id": "001" }, { "name": "Black Sea", "id": "002" }, { "name": "Central and eastern Anatolia", "id": "003" }, { "name": "Istanbul", "id": "004" }, { "name": "Lycian Way", "id": "005" }, { "name": "Georgia", "id": "006" } ] } This is my android class fragment where i access my json objects: public class DestinationsFragment extends Fragment { private GoogleMap map; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_destinations, container, false); ListView listview= (ListView)rootView.findViewById(R.id.list); String feed = loadJSONFromAsset(); try { ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;(); JSONArray jsonArray = new JSONArray(feed); for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String name= jsonObject.getString("name"); items.add(name); Log.d(name,"Output"); } ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(),R.layout.list_item, items); listview.setAdapter(adapter); } catch (Exception e) { e.printStackTrace(); } return rootView; } public String loadJSONFromAsset() { String json = null; try { InputStream is = getActivity().getAssets().open("destinations.txt"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; } } This is my logcat error ouput: 06-02 11:51:47.027: W/System.err(6304): org.json.JSONException: Expected literal value at character 1 of {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoas…
has answer: http://stackoverflow.com/a/23991195
has comment: http://stackoverflow.com/comment/36969429
favorite count: 0
has comment: http://stackoverflow.com/comment/36970255
tagged with: android-json
tagged with: android
has answer: http://stackoverflow.com/a/23991029
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36970057
has comment: http://stackoverflow.com/comment/36969539
has title: Parsing JSON gives error org.json.JSONException: Expected literal value
has comment: http://stackoverflow.com/comment/36969367
has comment: http://stackoverflow.com/comment/36969698
type: Question
has comment: http://stackoverflow.com/comment/36969557
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/23991029
score: -1
downvote count: 5
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/23991195

http://stackoverflow.com/a/24050825
has body: Some changes you mentioned are predictable. The transformation does not retain &lt;!DOCTYPE&gt; declarations. In fact it does not even read it. But you can re-generate it with a transformer property: transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://xml.cXML.org/schemas/cXML/1.2.009/cXML.dtd"); Attribute order is irrelevant according to the XML specification, so the parser isn't required to preserve it. The changes in the payload, timestamp and the &lt;SupplierPartAuxiliaryID&gt; shouldn't be happening if you are just reading a file and printing it out. If it's a generated file, check if you are not comparing to an outdated version. The timestamp and payload might be generated values. Certainly some other process is changing that data along the way. The parser and the transform wouldn't change the data if you used them as you described.
answers question: http://stackoverflow.com/q/24050596
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24050596
has comment: http://stackoverflow.com/comment/37082623

http://stackoverflow.com/a/24095700
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24095662
upvote count: 2
answers question: http://stackoverflow.com/q/24095662
type: AcceptedAnswer
has body: Right now you have a single list that contains all fetched IDs, and you're putting this list for every T1, while you need to create a new list for every unique T1 and add results to the corresponding list: while (rs2.next()) { int cid = rs2.getInt("category_id"); String t1 = rs2.getString("T1"); if (!categoryItemsList.containsKey(t1)) { categoryItemsList.put(t1, new LinkedList&lt;Integer&gt;()); } categoryItemsList.get(t1).add(cid); }
has comment: http://stackoverflow.com/comment/37165155
type: Answer

http://stackoverflow.com/q/24006634
type: UnansweredQuestion
tagged with: mysql
has answer: http://stackoverflow.com/a/24006687
tagged with: java
has body: When I try to execute: SELECT matricula FROM lss_alumnos WHERE lss_alumnos.division = 'PREP'; I get this message: SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.division = 'PREP'' at line 1 And I am also using MySQL Workbench, and there I got the right result.
type: Question
score: 0
answer count: 2
has title: MySQL syntax mistake
has comment: http://stackoverflow.com/comment/36999451
has answer: http://stackoverflow.com/a/24006843
has comment: http://stackoverflow.com/comment/36999534

http://stackoverflow.com/comment/37095720
type: QuestionComment
comment on: http://stackoverflow.com/q/24058419
score: 0
has text: now the ArrayIndexOutof Bounds : 1......
type: Comment

http://stackoverflow.com/a/24023774
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24023545
has body: You can parse it as an Object which is quite well documented. But if you DONT want to build a whole object framework around some response you can use their generic JsonArray and JsonObject classes to traverse your json string. // this is just your json string. String yourJson = "{\"result\":\"_error\",\"invokeId\":2,\"data\":{\"timestamp\":1.401824129758E12,\"rootCause\":{\"message\":\"Wrong client version for server\",\"localizedMessage\":\"Wrong client version for server\",\"rootCauseClassname\":\"login.impl.ClientVersionMismatchException\",\"substitutionArguments\":[\"4.9\",\"4.8.14_05_16_17_02\"],\"errorCode\":\"LOGIN-0001\"},\"headers\":{},\"correlationId\":\"00E36368-6158-CD63-56CA-4F39493E8ED3\",\"faultCode\":\"Server.Processing\",\"messageId\":\"D8424EAD-8D0B-5441-820B-775B99812CFD\",\"faultString\":\"login.impl.ClientVersionMismatchException : Wrong client version for server\",\"timeToLive\":0.0,\"clientId\":\"D8424E8B-5F0F-1ECD-C29F-C6440488B0FC\",\"destination\":\"loginService\"},\"version\":0}"; // create a parser JsonParser parser = new JsonParser(); // parse then get your root node as a JsonObject JsonObject obj = parser.parse(yourJson).getAsJsonObject(); // traverse your object JsonArray subArgs = obj.get("data").getAsJsonObject() .get("rootCause").getAsJsonObject() .get("substitutionArguments").getAsJsonArray(); // because the get(1) returns a JsonElement you will need to use getAsString // to retrive the actual results System.out.println(subArgs.get(1).getAsString()); // 4.8.14_05_16_17_02
answers question: http://stackoverflow.com/q/24023545
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/95427202
type: Comment
has text: Adding link to this helpful answer here: https://stackoverflow.com/a/43374464/1968909
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31880978

http://stackoverflow.com/q/24073579
score: 0
has comment: http://stackoverflow.com/comment/37123722
has comment: http://stackoverflow.com/comment/37123752
type: UnansweredQuestion
has title: Issue with MySql Unique key
answer count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/37123788
type: Question
has body: Here are my table definition CREATE TABLE users_registration (user_id int4 NOT NULL UNIQUE, request_id int4 NOT NULL UNIQUE, status bpchar NOT NULL, session_id varchar(100) NOT NULL, attempts int4, PRIMARY KEY(user_id, request_id)); In one place it is taking request_id=1 everytime when new record creating but another new MYSQL Database i am getting thi exception com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'request_id' Can anyone tell what is the issue using Hibernate in my application.
has comment: http://stackoverflow.com/comment/37123705

http://stackoverflow.com/q/24051547
has body: I tried a lot of differents configurations following some other posts, but anything worked. I'm trying to run this simple tutorial(http://www.vogella.com/tutorials/REST/article.html) but i'm still having the message: "The requested resource is not available". Anyone? Running on Eclipse Kepler, Tomcat 7 and MAC OS 10.8.5. I tried this configuration for the web.xml, but didn't work too (reference: Running Jersey project (Rest web service) to tomcat) <?xml version="1.0" encoding="UTF-8"?> Hello ServletAdaptor com.sun.jersey.spi.container.servlet.ServletContainer 1 ServletAdaptor /rest/* and those are the jars in the last try: asm-3.3.1.jar jersey-bundle-1.12.jar jersey-server-1.12.jar jersey-servlet-1.12.jar jsr311-api-1.0.jar tried the following urls: http://localhost:8080/Hello/ http://localhost:8080/de.vogella.jersey.first/rest/hello
type: Question
downvote count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37100335
tagged with: rest
answer count: 1
has answer: http://stackoverflow.com/a/28840568
tagged with: macos
favorite count: 0
type: UnansweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37083164
tagged with: java
linked to: http://stackoverflow.com/q/10090715
has title: Simple Rest service with Tomcat and Eclipse, Mac os. The requested resource is not available
tagged with: eclipse

http://stackoverflow.com/comment/37140539
comment on: http://stackoverflow.com/a/24081845
has text: ahh ok, that makes sense. so the core project will error in my IDE?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37026793
has text: I don't think you need this line: SwingUtilities.invokeLater(new Runnable() { });
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24021319

http://stackoverflow.com/a/24028836
type: Answer
answers question: http://stackoverflow.com/q/24027671
score: 0
has body: It looks like one of those calls (or your main call) is causing a URL to be loaded (looks like it's a jar file), then there's a redirect, and there's a space or tab in one of the response HTTP headers names. What happens if you host the applet jar/war on a local webserver rather than Github?

http://stackoverflow.com/comment/37180482
type: AnswerComment
comment on: http://stackoverflow.com/a/24098473
type: Comment
has text: Can you give me an example?
score: 0

http://stackoverflow.com/a/75029659
type: Answer
has body: Another option is using IKVM and .NET6+. IKVM is converting Java to a .NET Application. Under .NET 6+, one can then turn this into a natively compiled application, so .NET does not need to exist on the target Windows system. Note that performance may suffer, if you go this route.
answers question: http://stackoverflow.com/q/23960542
score: 0

http://stackoverflow.com/comment/36918692
type: QuestionComment
comment on: http://stackoverflow.com/q/23963362
score: 0
has text: So you are saying that the `/home/junfu/RESEARCH/HelloWorld` directory doesn't exist?
type: Comment

http://stackoverflow.com/comment/37087186
type: QuestionComment
has text: Casting is not a conversion - it only works if the target type and the actual type are related in terms of class hierarchies and implemented interfaces, i.e. if the actual type _already is_ the target type. You need a mapping, not a cast.
comment on: http://stackoverflow.com/q/24053749
score: 0
type: Comment

http://stackoverflow.com/comment/36960102
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23985630
has text: @user3502615: then you're doing it wrong. Show us how you try to do this, but post any new code to the bottom of your original question by [editing your question](http://stackoverflow.com/posts/23985626/edit). Also, please see **Edit 3** to my answer.

http://stackoverflow.com/q/24090997
type: Question
has title: Check if exist a sequence of elements in array that fulfill predetermined conditions using recursion
has comment: http://stackoverflow.com/comment/37156896
upvote count: 0
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/24091877
favorite count: 0
type: UnansweredQuestion
downvote count: 1
tagged with: recursion
has body: The conditions is given in int array where each number represent a condition. Conditions: 0 - one digit number or 2 digits number. 1 - one digit number. 2 - 2 digits number. The function deceleration: boolean match(Integer[] inputArray,Integer[] pattern) In case the conditions array is {1,0,2} I'll need to check if exist sequence of one digit number, one or two digits number and two digits number in a row. I didn't find a way to stop the recursion when it succeed to find the pattern's sequence and it keep going until I get a unwelcome false. Didn't manage to do it or to think on a way to let it finish and then get the true (always get false in the end) Thank you very much for your help! public static boolean match(Integer[] a,Integer[] pattern) { int _counter = 0; int _variNum = 0; Integer[] _copyA= new Integer[a.length];_copyA=a; Integer[] _copyPattern= new Integer[pattern.length];_copyPattern=pattern; return match(_copyA,_copyPattern,pattern.length,a,pattern); } public static boolean match(Integer[] secA,Integer[] secPattern,int originPatternLength,Integer[] originA,Integer[] originPattern) { boolean success=false; System.out.println("\n"); System.out.println("First array: "+Arrays.toString(secPattern)+" Second array: "+Arrays.toString(secA)+" to the rules..."); System.out.println("_variNum: *"+_variNum+"* secPattern.length: *"+secPattern.length+"* counter: "+_counter); success=(((originA.length-_counter)+_variNum)&lt;originPatternLength)?false:true; success=(originPatternLength ==_variNum)?true:false; _counter++; if(secPattern.length&gt;0) { switch ((secPattern[0])) { case 0: if(!(secA[0]&gt;-100 &amp;&amp; secA[0]&lt;100)) { Integer[] newArr = Arrays.copyOfRange(secA, 1, secA.length);_variNum=0;_counter=0; match(newArr,secPattern,originPatternLength,originA,originPattern); } _variNum++; Integer[] newArr = Arrays.copyOfRange(secA, 1, secA.length); Integer[] newPArr = Arrays.copyOfRange(secPattern, 1, secPattern.length); match(newArr,newPArr,originPatternLength,or…
tagged with: java
has comment: http://stackoverflow.com/comment/37156983
score: -1

http://stackoverflow.com/q/23980540
upvote count: 3
has answer: http://stackoverflow.com/a/24037536
answer count: 3
accepted answer: http://stackoverflow.com/a/24037536
has comment: http://stackoverflow.com/comment/66505216
possible better answer: http://stackoverflow.com/a/24612230
downvote count: 0
favorite count: 0
has body: I am using: Ubuntu 14.x 64 bit Chromedriver latest Chrome latest Selenium Java 2.37.1 JDK 1.7.0_60 When I run a selenium with google chrome, chrome window has a funny yellow warning on the top that says You are using an unsupported command-line flag --ignore-certificate-error Anyone ever see that before? Is it a setting in the selenium driver java code? I do not notice any negative effects.
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24612230
tagged with: selenium
tagged with: google-chrome
type: Question
has title: Selenium+Chrome on Ubuntu says unsupported command-line flag --ignore-certificate-error
has answer: http://stackoverflow.com/a/45556612
has comment: http://stackoverflow.com/comment/36950289

http://stackoverflow.com/a/24058063
has body: It is all about encapsulation basically chaining getters is an anti-pattern (imho). You should encapsulate part of this in ObjectA, you should provide a getstr method and remove the getObjectB() method. public class ObjectA { private ObjectB objectB; public String getstr() { return objectB != null ? objectB.getstr() : null; } } Now your other code would simply be. if (objectA != null &amp;&amp; StringUtils.hasText(objectA.getstr()) { ... }
downvote count: 0
has comment: http://stackoverflow.com/comment/37095306
upvote count: 2
has comment: http://stackoverflow.com/comment/37095451
type: Answer
answers question: http://stackoverflow.com/q/24057816
score: 2

http://stackoverflow.com/comment/37147176
type: QuestionComment
comment on: http://stackoverflow.com/q/24086044
score: 1
has text: Wouldn't you have to use the Eclipse API in order to tell it to open the file and navigate to the specific line?
type: Comment

http://stackoverflow.com/q/23948237
has comment: http://stackoverflow.com/comment/36922506
type: Question
has comment: http://stackoverflow.com/comment/36890861
has answer: http://stackoverflow.com/a/23950776
score: 0
tagged with: facebook
tagged with: spring
answer count: 1
has title: JSF2 Session issue
tagged with: jsf
has comment: http://stackoverflow.com/comment/36923824
tagged with: java
type: UnansweredQuestion
has body: Here i am checking In a LoginBean.java a Sessionscoped bean I have this code Call from MyPage.xhtml public String Method1(){ HttpSession secondSession = (HttpSession) FacesContext. getCurrentInstance(). getExternalContext(). getSession(false); System.out.println(secondSession.getId()); } result coming 9B4CB2748A440FEF1B2B4A7AEF401BFF In same bean i have another method which is called from another JSF page call from MyAnotherPage.xhtml public String Method2(){ HttpSession secondSession = (HttpSession) FacesContext. getCurrentInstance(). getExternalContext(). getSession(false); System.out.println(secondSession.getId()); } result coming 3F9F2F1CF9C9A0A56B44AB5DB04ABF12 Look it created two different session id it mean two different session .Now issue is that if in first method i am adding any attribute in session i am not able to get that attribute in second method .What is going wrong Why different session for different request ? Note:- Second method call after user successfully login from Facebook so it is CallbackOurl which add Twitter APPS. http://127.0.0.1:8080/mywebapp/login/MyAnotherPage.xhtml and i am calling method like this from this xhtml page &lt;f:event listener="#{TwitterManagedBean.redirectTwitterLogin2}" type="preRenderView" /&gt; How i set the attribute HttpServletRequest request = (HttpServletRequest) FacesContext .getCurrentInstance().getExternalContext().getRequest(); HttpServletResponse response = (HttpServletResponse) FacesContext .getCurrentInstance().getExternalContext().getResponse(); try { Twitter twitter = new TwitterFactory().getInstance(); RequestToken requestToken; request.getSession().setAttribute("twitter", twitter); twitter.setOAuthConsumer("***********","***************" ); requestToken = twitter .getOAuthRequestToken("http://127.0.0.1:8080/3c/login/TwitterLogin.xhtml"); String authURL = requestToken.getAuthenticationURL(); request.getSession().setAttribute("requestToken", requestToken); response.sendRedirect(authURL); } catch (TwitterE…
has comment: http://stackoverflow.com/comment/36890700

http://stackoverflow.com/a/24021103
type: Answer
has comment: http://stackoverflow.com/comment/37032973
has comment: http://stackoverflow.com/comment/37034692
answers question: http://stackoverflow.com/q/24020553
has comment: http://stackoverflow.com/comment/37030027
accepted answer of: http://stackoverflow.com/q/24020553
has comment: http://stackoverflow.com/comment/37033849
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37032751
has comment: http://stackoverflow.com/comment/37040225
type: AcceptedAnswer
downvote count: 0
has body: Try: JPanel blankJPanel1 = new JPanel(); this.addTab("+", blankJPanel1); setModel(new DefaultSingleSelectionModel() { @Override public void setSelectedIndex(int index) { System.out.println("woah!"); } }); Update Just an alternative version, without the need of modifying the model behavior. JPanel blankJPanel = new JPanel(); this.addTab("dummy text", blankJPanel); JLabel label = new JLabel("x"); label.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("woah!!"); } }); setTabComponentAt(indexOfComponent(blankJPanel), label); Update 2 Seems I end up doing something similar to this answer, please refer to it as the "best" solution to this problem.
has comment: http://stackoverflow.com/comment/37037332
has comment: http://stackoverflow.com/comment/37026347

http://stackoverflow.com/comment/37007582
score: 0
type: Comment
has text: This works fine thanks. I have got another question. Whats wrong with this code?´ <test property="org.eclipse.core.resources.path" value="Remote*" /> ´
type: AnswerComment
comment on: http://stackoverflow.com/a/24009697

http://stackoverflow.com/comment/36943326
comment on: http://stackoverflow.com/q/23976620
type: Comment
type: QuestionComment
score: 0
has text: i did it but still the same... code edited!

http://stackoverflow.com/comment/37039288
comment on: http://stackoverflow.com/a/24027738
score: 0
type: Comment
has text: I suppose I don't, which is actually something I was afraid of. I guess I;m not sure how to check if I am doing it correctly then.
type: AnswerComment

yahoo-boss-api
tag name: yahoo-boss-api
tags question: http://stackoverflow.com/q/24057122
type: Tag

http://stackoverflow.com/a/24052803
has body: From the HttpURLConnection javadoc: "Each HttpURLConnection instance is used to make a single request but the underlying network connection to the HTTP server may be transparently shared by other instances." So if you want to send multiple requests, then for each request call obj.openConnection(), set the connection settings, open the OutputStream, and write the data. Your Java runtime is permitted to keep the actual connection open to save time and bandwidth.
downvote count: 0
answers question: http://stackoverflow.com/q/24051426
has comment: http://stackoverflow.com/comment/37119545
has comment: http://stackoverflow.com/comment/37178296
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37119531
score: 2

http://stackoverflow.com/comment/39323049
has text: I've found this link and Its simple with Graph_API. I tried it in my browser with my access-token which I got from Graph-explore like this https://graph.facebook.com/me/accounts?access_token=xxxxxxxx and it returned json with the pages details , running fine
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24116104
type: Comment

http://stackoverflow.com/comment/36950110
has text: I added my BlogPost class, can you help me out how to display all content of the blogposts?
comment on: http://stackoverflow.com/a/23980537
score: 0
type: Comment
type: AnswerComment

soap
tags question: http://stackoverflow.com/q/24041700
tags question: http://stackoverflow.com/q/24030335
tags question: http://stackoverflow.com/q/24029081
type: Tag
tags question: http://stackoverflow.com/q/23996269
tags question: http://stackoverflow.com/q/23997723
tags question: http://stackoverflow.com/q/24058867
tags question: http://stackoverflow.com/q/23950134
tags question: http://stackoverflow.com/q/24078142
tags question: http://stackoverflow.com/q/24042555
tags question: http://stackoverflow.com/q/24026650
tags question: http://stackoverflow.com/q/23944219
tags question: http://stackoverflow.com/q/24079714
tags question: http://stackoverflow.com/q/24010801
tags question: http://stackoverflow.com/q/24043279
tags question: http://stackoverflow.com/q/24013076
tags question: http://stackoverflow.com/q/23976470
tags question: http://stackoverflow.com/q/24061087
tags question: http://stackoverflow.com/q/24036717
tag name: soap
tags question: http://stackoverflow.com/q/23976960

http://stackoverflow.com/comment/37043667
type: Comment
type: QuestionComment
has text: Yes I got the point that we need to use `remove()` but in my scenario, I need to remove only the first occurrence of that element and that is why I used `removeFirstOccurrence`
comment on: http://stackoverflow.com/q/24030239
score: 0

http://stackoverflow.com/comment/36886062
type: QuestionComment
score: 1
has text: I agree with @AndrewThompson -- you need to show real compilable runnable code, a [minimal example program](http://stackoverflow.com/help/mcve) that reproduces your problem for us.
comment on: http://stackoverflow.com/q/23945921
type: Comment

http://stackoverflow.com/comment/37112973
comment on: http://stackoverflow.com/a/24067069
type: AnswerComment
type: Comment
score: 1
has text: @Nit done ! I was just waiting for some minutes seq3 was fast :) thanks guys

http://stackoverflow.com/q/23981859
type: Question
has answer: http://stackoverflow.com/a/23982025
tagged with: adt
accepted answer: http://stackoverflow.com/a/23982025
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I'm using Ubuntu 12.04, 64 bit. I recently updated my Java to Java 7: isa@Daemon:~$ java -version java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode) And after this, my ADT bundle stopped working. When I open up eclipse, I get the following error: when I click on 'ok', other errors show up like And it starts working really hard (laptop gets hot), from time to time it stops responding and I'm forced to force quit it. It is a newly installed version of the adt bundle (from: http://developer.android.com/sdk/index.html) and I really don't know what to do. It worked before the update to java7 (yes, I have installed the 32-libs). Google told me that the first error I get is an out of memory error, but changing the heap size for eclipse can't be the solution as it worked before the update. I think there is something wrong with my java version. By the way: I'm using an other version of Eclipse (Indigo) on the same laptop. This version works without any problems. Attached: eclipse.ini: -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20130807-1835 -product com.android.ide.eclipse.adt.package.product -showsplash com.android.ide.eclipse.adt.package.product --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256m -Xms40m -Xmx768m -Declipse.buildId=v22.6.2-1085508 -XX:MaxPermSize=512M and a part of the error log (I won't bother you by pasting all >10000 lines here) http://pastebin.com/i7dUfg4h EDIT: after changing the virtual machine that eclipse used, these errors disappeared but when I try to build a project (launch onto android device), I get following errors in the terminal: and eclipse decides to terminate. I appreciate any hints! Isa
has title: Memory error in Eclipse (ADT) - Wrong Java version?
tagged with: eclipse

http://stackoverflow.com/q/24095572
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/24095589
downvote count: 1
type: Question
tagged with: image
score: 0
has title: What is the default type of a BufferedImage?
answer count: 1
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/24095589
linked to: http://stackoverflow.com/q/21057963
type: AnsweredQuestion
has body: As we know, there are some types of BufferedImage like BufferedImage.TYPE_3BYTE_BGR , BufferedImage.TYPE_INT_ARGB , BufferedImage.TYPE_USHORT_565_RGB and so on. If I only use BufferedImage image = ImageIO.read(new pngFile(filePath)); What is the type of image.Does it has something to do with the file's format like PNG?
tagged with: java

http://stackoverflow.com/comment/122436338
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24010109
has text: `IntStream.rangeClosed(-n, 0).map(i -> -i)` will produce elements in reversed order i.e. `n, n-1, n-2, ... , 0`.
score: 0

http://stackoverflow.com/q/23966745
linked to: http://stackoverflow.com/q/976441
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36924853
has comment: http://stackoverflow.com/comment/36924885
has body: Have a template class: class Foo &lt;T&gt; { private T bar; public Foo(T bar) { this.bar = bar; } } Have an interface: interface SomeInterface { public void boom(); } I want Foo to only accept types of classes that implement the interface SomeInterface. Intuitively, I wanted something like this: class Foo &lt;T implements SomeInterface&gt; But apparently this doesn't work. Is it possible for a template class to only accept implementers of a specific interface? This is because I want to call certain methods on this.bar. Methods that happen to be defined in SomeInterface.
duplicate of: http://stackoverflow.com/q/976441
has title: Is it possible for a template class to only accept implementers of a specific interface?
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36924845
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24054662
has title: OutOfMemoryError in XML JDOM parser in Java
possible better answer: http://stackoverflow.com/a/24079589
has comment: http://stackoverflow.com/comment/37089842
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/37089359
tagged with: android
has comment: http://stackoverflow.com/comment/37089705
has answer: http://stackoverflow.com/a/24079589
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37089008
has comment: http://stackoverflow.com/comment/37095596
has answer: http://stackoverflow.com/a/24057522
accepted answer: http://stackoverflow.com/a/24057522
type: Question
upvote count: 2
answer count: 2
tagged with: jdom
has body: Developing dictionary application for Android. There is a database in XML file. It is quite large(72MB) to parse with DOM parser. Trying to parse it with JDOM parser: List&lt;org.jdom2.Element&gt; list = null; try { File db = new File(UnZip.DATABASE_PATH); InputStream stream = new FileInputStream(db); SAXBuilder builder = new SAXBuilder(); //HERE CODE IS GETTING STUCK Document document = (Document) builder.build(stream); org.jdom2.Element rootNode = document.getRootElement(); list = rootNode.getChildren(ENTRY_TAG); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JDOMException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (Element node : list) { Log.d(LOG_TAG, node.getChildText(ENT_SEQ)); Log.d(LOG_TAG, node.getChildText(REB)); } This code is giving OutOfMemory error: 06-05 12:45:58.788: E/AndroidRuntime(10068): FATAL EXCEPTION: main 06-05 12:45:58.788: E/AndroidRuntime(10068): java.lang.OutOfMemoryError: [memory exhausted] 06-05 12:45:58.788: E/AndroidRuntime(10068): at dalvik.system.NativeStart.main(Native Method) I assume that code is getting stuck here: Document document = (Document) builder.build(stream); How to avoid this error and find needed entry from whole XML file(170000 entries)?
has comment: http://stackoverflow.com/comment/37089107

http://stackoverflow.com/a/24069204
type: Answer
answers question: http://stackoverflow.com/q/24068805
has comment: http://stackoverflow.com/comment/37122419
has body: Could you be including a servlet-api JAR in your package? I have run into situations where an old version of the servlet API was unintentionally included in the WAR, resulting in similarly cryptic messages.
score: 0

http://stackoverflow.com/a/70977690
answers question: http://stackoverflow.com/q/23944370
upvote count: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/137761055
type: Answer
score: 6
has body: In case of LocalDate, you can use the toEpochDay() method. It returns the number of days since 01/01/1970. That number then can be easily converted to milliseconds: long dateInMillis = TimeUnit.DAYS.toMillis(myLocalDate.toEpochDay()); In case of LocalDateTime, you can use the toEpochSecond() method. It returns the number of seconds since 01/01/1970. That number then can be converted to milliseconds, too: long dateTimeInMillis = TimeUnit.SECONDS.toMillis(myLocalDateTime.toEpochSecond());
has comment: http://stackoverflow.com/comment/137760334

http://stackoverflow.com/comment/36949330
has text: I botched the question (see comment to @bdean20 above).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23975274

http://stackoverflow.com/comment/37017622
has text: Stack Overflow is not a debugging service, so please don't treat it as one.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24016620

http://stackoverflow.com/comment/37071084
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24044596
has text: OK apparently the RequestMappingHandlerAdapter bean was not in the context. but now that it is. i am getting the following. java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException and i have all the dependencies for jackson.
type: AnswerComment

http://stackoverflow.com/comment/37245890
comment on: http://stackoverflow.com/a/24079652
has text: @PRATHAPS `@` is a special character in Regular Expressions. So for the regex parser to take it as a literal `@` you will need to put a back slash before `@`. The thing is, \ is also a special character in Java. So for Java to take the \ literally you need another \ before it. Thus the `\\@` at the beginning. The `[a-z]+` in regex means "one or more instances of `[a-z]` (any small letter).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37036174
type: QuestionComment
type: Comment
has text: @haifzhan `<appender-ref ref="FILE"/>` is definitely not a problem. Two `<appender name="FILE">` with the same filename would be. I think I might have sent you in the wrong direction. :(
comment on: http://stackoverflow.com/q/24025806
score: 0

http://stackoverflow.com/comment/37172604
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24099361
has text: I am not too familiar with xml namespace support on XmlPullParser but you could try removing namespace support where you configure XmlPullParserFactory. At least until your xml starts using namespaces.
score: 0

arrays
tags question: http://stackoverflow.com/q/23945234
tags question: http://stackoverflow.com/q/24085373
tags question: http://stackoverflow.com/q/24048737
tags question: http://stackoverflow.com/q/24069733
type: Tag
tags question: http://stackoverflow.com/q/24068167
tags question: http://stackoverflow.com/q/24096836
tags question: http://stackoverflow.com/q/23957760
tags question: http://stackoverflow.com/q/23967532
tags question: http://stackoverflow.com/q/23948419
tags question: http://stackoverflow.com/q/24013661
tags question: http://stackoverflow.com/q/24100882
tags question: http://stackoverflow.com/q/23949924
tags question: http://stackoverflow.com/q/24022769
tags question: http://stackoverflow.com/q/24008272
tags question: http://stackoverflow.com/q/24026859
tags question: http://stackoverflow.com/q/24060564
tags question: http://stackoverflow.com/q/24024228
tags question: http://stackoverflow.com/q/23985498
tags question: http://stackoverflow.com/q/24061149
tags question: http://stackoverflow.com/q/23991299
tags question: http://stackoverflow.com/q/23946397
tags question: http://stackoverflow.com/q/24101144
tags question: http://stackoverflow.com/q/24027482
tags question: http://stackoverflow.com/q/23951999
tags question: http://stackoverflow.com/q/23958956
tags question: http://stackoverflow.com/q/24098652
tags question: http://stackoverflow.com/q/24051415
tags question: http://stackoverflow.com/q/24089254
tags question: http://stackoverflow.com/q/24026494
tags question: http://stackoverflow.com/q/24085701
tags question: http://stackoverflow.com/q/24011485
tags question: http://stackoverflow.com/q/24089242
tags question: http://stackoverflow.com/q/24089677
tags question: http://stackoverflow.com/q/24042111
tags question: http://stackoverflow.com/q/24020593
tags question: http://stackoverflow.com/q/23959465
tags question: http://stackoverflow.com/q/23948955
tags question: http://stackoverflow.com/q/23976650
tags question: http://stackoverflow.com/q/24101765
tags question: http://stackoverflow.com/q/23996609
tags question: http://stackoverflow.com/q/24067174
tags question: http://stackoverflow.com/q/24090760
tags question: http://stackoverflow.com/q/24040681
tags question: http://stackoverflow.com/q/23985425
tags question: http://stackoverflow.com/q/24038939
tags question: http://stackoverflow.com/q/23965087
tags question: http://stackoverflow.com/q/24088961
tags question: http://stackoverflow.com/q/23986080
tags question: http://stackoverflow.com/q/24062494
tags question: http://stackoverflow.com/q/23945100
tags question: http://stackoverflow.com/q/24002752
tags question: http://stackoverflow.com/q/24078360
tags question: http://stackoverflow.com/q/24076053
tags question: http://stackoverflow.com/q/23984786
tags question: http://stackoverflow.com/q/23958607
tags question: http://stackoverflow.com/q/24090997
tags question: http://stackoverflow.com/q/24082422
tags question: http://stackoverflow.com/q/23990634
tags question: http://stackoverflow.com/q/24004860
tags question: http://stackoverflow.com/q/23999157
tags question: http://stackoverflow.com/q/23962323
tags question: http://stackoverflow.com/q/23975200
tags question: http://stackoverflow.com/q/24090431
tags question: http://stackoverflow.com/q/24074659
tags question: http://stackoverflow.com/q/23995238
tags question: http://stackoverflow.com/q/24087510
tags question: http://stackoverflow.com/q/24054456
tags question: http://stackoverflow.com/q/24066883
tags question: http://stackoverflow.com/q/23962074
tags question: http://stackoverflow.com/q/24049964
tags question: http://stackoverflow.com/q/23996000
tags question: http://stackoverflow.com/q/23994265
tags question: http://stackoverflow.com/q/24028690
tags question: http://stackoverflow.com/q/24021582
tags question: http://stackoverflow.com/q/24091215
tags question: http://stackoverflow.com/q/24096952
tags question: http://stackoverflow.com/q/24008767
tags question: http://stackoverflow.com/q/24006276
tags question: http://stackoverflow.com/q/23989628

http://stackoverflow.com/comment/36938066
type: QuestionComment
has text: @Mr.Sarunov: I reworded your title and question to make it more evident. Now there should really be no doubts on what is your intent.
comment on: http://stackoverflow.com/q/23973561
score: 0
type: Comment

http://stackoverflow.com/comment/36936816
score: 0
type: Comment
has text: There are some scenarios where "PushLocalFrame and PopLocalFrame, and put all your code in between" won't be appropriate and others that take a bit of thought. One, in particular is very common: returning a Java object created as a local reference. In that case, you need to pass the object to `PopLocalFrame` to tell it re-reference it in the outer frame (in other words, not to free the object). This is mentioned in [JNI Local Reference Changes in ICS](http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html) but applies generally.
comment on: http://stackoverflow.com/a/23944731
type: AnswerComment

http://stackoverflow.com/q/24074868
has comment: http://stackoverflow.com/comment/37126333
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37126470
has comment: http://stackoverflow.com/comment/37126652
has comment: http://stackoverflow.com/comment/37126185
has comment: http://stackoverflow.com/comment/37126400
has comment: http://stackoverflow.com/comment/37126269
has body: I am having an image stored at a location say : C:\Users\admin\Desktop\SharedCrpto1\web\RetrievedFiles\FILE310@ST-testemp\abc.png .Now when i try to show it in my jsp page the image is not getting visible even when the path to image is correct. This image is to be displayed after my server process the browsed image provided by the client. I tried : &lt;img src="&lt;%=path%&gt;" alt="No image" /&gt; The image in the particular folder is being created by my servlet like this : File filesstore = new File("C:\\Users\\admin\\Desktop\\SharedCrpto1\\web\\RetrievedFiles\\FILE310@ST-testemp\\"); if(!filesstore.exists()) { System.out.println("MAKING DIRECTORY.."); filesstore.mkdirs(); } To copy one file to this location I did : FileInputStream fis = new FileInputStream("C:\\test.png"); int xx=fis.available(); byte[] b = new byte[xx]; fis.read(b); FileOutputStream fos=new FileOutputStream("C:\\Users\\admin\\Desktop\\SharedCrpto1\\web\\RetrievedFiles\\FILE310@ST-testemp\\abc.png"); fos.write(b); Am i doing something wrong?Please help
has comment: http://stackoverflow.com/comment/37126081
has comment: http://stackoverflow.com/comment/37126030
has comment: http://stackoverflow.com/comment/37126237
has comment: http://stackoverflow.com/comment/37126715
has comment: http://stackoverflow.com/comment/37126139
has comment: http://stackoverflow.com/comment/37126160
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37126067
has comment: http://stackoverflow.com/comment/37126946
has comment: http://stackoverflow.com/comment/37125962
type: Question
has title: Image not being displayed in browser
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37126815
has comment: http://stackoverflow.com/comment/37126013
has answer: http://stackoverflow.com/a/24079962
has comment: http://stackoverflow.com/comment/37126071
has comment: http://stackoverflow.com/comment/37126200
has comment: http://stackoverflow.com/comment/37126251
has comment: http://stackoverflow.com/comment/37126108
has comment: http://stackoverflow.com/comment/37126479
score: -3
has comment: http://stackoverflow.com/comment/37126159
has comment: http://stackoverflow.com/comment/37126423
has comment: http://stackoverflow.com/comment/37126043
tagged with: servlets
has comment: http://stackoverflow.com/comment/37126891
has comment: http://stackoverflow.com/comment/37126371
has comment: http://stackoverflow.com/comment/37125989
has comment: http://stackoverflow.com/comment/37126065
upvote count: 0
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/37126104
answer count: 1
has comment: http://stackoverflow.com/comment/37126362
has comment: http://stackoverflow.com/comment/37126304
has comment: http://stackoverflow.com/comment/37126053
favorite count: 0
has comment: http://stackoverflow.com/comment/37126049

http://stackoverflow.com/a/24021011
has body: As Raghunandan said, just pass it in the constructor class MyTask extends AsyncTask&lt;...,..., FuncionResult&gt; { Context mCtx; MyTask(Context ctx) { mCtx = ctx; } ... protected void onPostExecute(FunctionResult result) { ... Toast.makeText(mCtx, "text", 1000).show(); AlertDialog.Builder builder = new AlertDialog.Builder( mCtx); builder.show(); } } Then you need to be careful to cancel the task if the activity is destroyed (or better paused) so to avoid leakage and notifications to the wrong activity/context
accepted answer of: http://stackoverflow.com/q/24020171
score: 2
has comment: http://stackoverflow.com/comment/37029263
answers question: http://stackoverflow.com/q/24020171
has comment: http://stackoverflow.com/comment/37064339
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37064437
has comment: http://stackoverflow.com/comment/37027477
has comment: http://stackoverflow.com/comment/37117661
type: Answer
has comment: http://stackoverflow.com/comment/37116678
upvote count: 2

http://stackoverflow.com/a/24181659
score: 0
type: Answer
has body: Put a logback.xml into the base package of your applications classpath.
answers question: http://stackoverflow.com/q/24080736

http://stackoverflow.com/q/23947845
tagged with: android-preferences
type: Question
has title: Why is EditTextPreference setText("string") only working internally on start? I'm trying to set a value when the user enters an empty string
tagged with: android-sharedpreferences
has body: I have my MainActivity, that calls my settings Activity: Intent i = new Intent(this, SettingsActivity.class); startActivityForResult(i, RESULT_SETTINGS); "device_name" is an EditTextPreference with no default value or value. &lt;EditTextPreference android:key="device_name" android:title="Device Name" android:selectAllOnFocus="true" android:inputType="textCapWords" android:capitalize="words" android:singleLine="true" android:maxLines="1" /&gt; My SettingsActivity extends PreferenceActivity. onPostCreate I call bindPreferenceSummaryToValue(findPreference("device_name")); private static void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); // Trigger the listener immediately with the preference's // current value. sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager .getDefaultSharedPreferences(preference.getContext()) .getString(preference.getKey(), "")); } The listener's primary focus is setting the preferences summary, for the editTextPreference I was to check if the value is null or empty and replace it with Build.MODEL. private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list. ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); // Set the summary to reflect the new value. preference.setSummary( index &gt;= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof EditTextPreference) { EditTextPreference editTextPreference = (EditTextPreference) preference; //editTextPrefer…
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/45115992
tagged with: android
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/23992047
has body: I'm writing a script using Groovy which will connect to an FTP and download the latest file to the local machine to perform additional work on the data. I'm trying to use FTPClient &amp; FTPFile in order to do this, but not too sure how to go about selecting the latest file? I've managed to get it to connect to the FTP and return a list of the files so far. //Retrieve latest file from FTP FTPClient ftpClient = new FTPClient() ftpClient.connect('xxxx.xxxxxxx.xxx') ftpClient.login("xxxxxxxx", "xxxxxx") FTPFile[] files = ftpClient.listFiles() for (FTPFile file : files) { println(file.getName()) } ftpClient.logout() ftpClient.disconnect()
accepted answer: http://stackoverflow.com/a/23992453
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23992453
tagged with: groovy
answer count: 1
tagged with: scripting
downvote count: 0
favorite count: 0
tagged with: ftp
has title: Use Groovy to FTP Latest File
upvote count: 2

http://stackoverflow.com/comment/37075938
score: 0
has text: Use an [option type](http://java.dzone.com/articles/no-more-excuses-use-null).
comment on: http://stackoverflow.com/q/24046971
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37037702
has text: @camickr if all of us have time to read all those oracle tutorial, i would never ask a question here, your answer and the way you speak is not kind and not respectful, sorry.
score: 0
comment on: http://stackoverflow.com/q/24026743
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24068959
tagged with: c++
tagged with: opencv
downvote count: 0
tagged with: java
has title: OpenCV C++ Conversion to Java for Shape Detection Issues
type: Question
score: 4
has comment: http://stackoverflow.com/comment/47261098
has body: We are a bit new to the openCV Java development and ran across an issue. We are trying to convert this code to Java for Android. The approxPolyDp requires a MatOfPoint2f where we have 'approx' parameter. Though, when we need to use this same variable in the if statement just after for the isContourConvex, it requires a MatOfPoint. The original code in the first place was using a ArrayList for approx. We're very confused by this and need a nudge in the right direction to understand what we're supposed to do. // Find contours java.util.ArrayList&lt;java.util.ArrayList&lt;Point&gt;&gt;(); List&lt;MatOfPoint&gt; contours = new ArrayList&lt;MatOfPoint&gt;(); Mat hierarchy = new Mat(); Imgproc.findContours(bw.clone(), contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); // java.util.ArrayList&lt;Point&gt; approx = new java.util.ArrayList&lt;Point&gt;(); MatOfPoint2f approx = new MatOfPoint2f(); Mat dst = img.clone(); for (int i = 0; i &lt; contours.size(); i++) { // Approximate contour with accuracy proportional // to the contour perimeter MatOfPoint2f contoursMat2 = new MatOfPoint2f( contours.get(i)); Imgproc.approxPolyDP(contoursMat2, approx, Imgproc.arcLength(contoursMat2, true) * 0.02, true); // Skip small or non-convex objects if (Math.abs(Imgproc.contourArea(contours.get(i))) &lt; 100 || !Imgproc.isContourConvex(approx)) continue;
has answer: http://stackoverflow.com/a/61949640
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 4

http://stackoverflow.com/comment/36924386
type: QuestionComment
comment on: http://stackoverflow.com/q/23966228
score: 0
has text: @kasdega My answer notwithstanding, you should probably be using a proper DOM library instead of a solution created from scratch
type: Comment

http://stackoverflow.com/comment/37152106
comment on: http://stackoverflow.com/a/24083795
type: Comment
has text: it work sir. thanks alot but what will i do to print out the 4 digits. e.g if i enter 12, i want to see 0001 coz 144 is not equal to 8 digits. a user can see the number that was squred. am trying to get the substring of userinputsquare at index 2-6, but i get StringIndexOutOfBoadException
score: 0
type: AnswerComment

http://stackoverflow.com/a/23973701
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23973100
score: 1
accepted answer of: http://stackoverflow.com/q/23973100
has body: Like shekhar said you need to update the code to be count +=1 or to be safe count = count + 1 Like CDahn said, the variable count needs to be static, because it has to preserve value across calls to the functions Every time GuessMachine is called the count will get reset. Think about how GuessMachine will be getting called again and again. This means you will be executing count = 0 at the top of the function GuessMachine again and again. You need to take the initialization of count = 0 out of the function GuessMachine and into the function main because even after you make it static, if you initialize it every time you call GuessMachine, the count will keep getting reset. There is another issue with your code. In the if block in GuessMachine 2 out of 3 times, the count is incremented way too late. It needs to be incremented immediately. In fact it is the same exact piece of code so we can take it out of the if block public static int GuessMachine(int InputNumber, int rndNumber) { int value = InputNumber; int randomNumber = rndNumber; count = count + 1; if (InputNumber == randomNumber) { // count +=1; No need for this statement anymore because we moved it out. ... I suggest you stepping through the program. Try "dry running" and also try using a debugger to step through each statement, and get a feel for the control flow of this code. Seems like you need a lot of practice understanding how to design code and debug it.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24080881
has comment: http://stackoverflow.com/comment/37136786
has comment: http://stackoverflow.com/comment/37136841
linked to: http://stackoverflow.com/q/23529521
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20600721
has answer: http://stackoverflow.com/a/24082592
linked to: http://stackoverflow.com/q/23736305
has title: Creating Self Signed Certificate and KeyStore from GUI
score: 0
tagged with: swing
has body: We have an application locally hosted on which we create self signed certificate and keystore using java keytool command line utility in order to run the application over https. We are now changing and wants to create keystore and self-signed certificate from a Graphical User interface. So is there any opensource tool available which can cater all the requirement or I have to develop this using Java Swings? Please suggest what is the best option.
type: Question
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/24085930
answer count: 2
has comment: http://stackoverflow.com/comment/37136754

http://stackoverflow.com/a/24060119
downvote count: 1
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37100832
has comment: http://stackoverflow.com/comment/37100810
has comment: http://stackoverflow.com/comment/37101118
has body: Your code makes no differentiation between consecutive elements and those separated. what you can do (with a slight modification) is reset the count. count = 1; for(int i=0; i&lt;arr.size-1; i++){ if(arr[i+1] == arr[i]){ count++; } else{ count=1; } if(count == 4){ return true; } } This code iterates through checking if the next element is the same as the current element, and if so, adds one to the count. If not, the count is reset for the next chain. This will work for any series of numbers, and will always store the longest, so I reccomend checking if it contains a series of AT LEAST 4 elements.
answers question: http://stackoverflow.com/q/24059807
has comment: http://stackoverflow.com/comment/37101085
upvote count: 2
has comment: http://stackoverflow.com/comment/37100240

http://stackoverflow.com/q/24060272
tagged with: file
has body: I would like to ask a question if there is a way to copy a file(i.e. an image) to a .jar file, because i want to deploy a program and i created folders along with the source codes(they are in the same location as the source codes) and the folders are inside the jar file (i used Netbeans to create the jar file)..... Now what i want is i would like to copy files choosen by a JFileChooser to the folders inside the jar file???? Any idea is heartily accepted..!!! Thanks in advance???? P.S.: I already tried searching the net for answers but all they know is how to copy the file inside the jar file to another directory......
score: 2
tagged with: java
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24060513
has title: Is there a possible way to copy a file to a jar file?
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/24060719
tagged with: copy
linked to: http://stackoverflow.com/q/2223434
tagged with: directory
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24091582
has body: So I've been working on a music player in android studio and I've created two java classes. One for Main Start Screen(StartScreen.Java) and one for the main player (player.Java). I have an onClicl event associated with a button as shown below. public void onClick(View view) { Intent detailIntent = new Intent(this, main_player.class); startActivity(detailIntent); } The code for the second Java Class is as below. There is nothing in the java class as for now. package com.example.musicplayer.app; import android.app.Activity; import android.os.Bundle; public class main_player extends Activity { protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.player); } } The code in the manifest is as below. &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".StartScreen" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".main_player" android:label="@string/main_player" android:parentActivityName=".StartScreen"&gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".StartScreen"/&gt; &lt;/activity&gt; Can you please tell me where is the actual mistake because the app works fine until i click the button that is suppose to take me to the main player screen? Thank You
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37157738
has answer: http://stackoverflow.com/a/24091737
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37157981
type: Question
has title: My application crashes when moving from one view(Java Class) to another
tagged with: java

http://stackoverflow.com/comment/36946852
comment on: http://stackoverflow.com/q/23978277
type: Comment
score: 0
has text: Put it on pastebin.com or something silimar and link it here.
type: QuestionComment

http://stackoverflow.com/q/24104517
has comment: http://stackoverflow.com/comment/37205784
answer count: 1
downvote count: 0
has title: Mule SFTP File Listener
accepted answer: http://stackoverflow.com/a/24122629
favorite count: 0
tagged with: sftp
has body: I have a question about mule. I have a SFTP Component that moves file to local directory every end of month by Quartz component. but when the file upcoming to the SFTP at the middle of month. I want to move it at a time, i don't want to wait until end of month. i need something depends on event, listening files like service or something like this. If Is there any configuration can help me.
has answer: http://stackoverflow.com/a/24122629
has comment: http://stackoverflow.com/comment/37188232
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mule

http://stackoverflow.com/q/24047747
has comment: http://stackoverflow.com/comment/37077151
possible better answer: http://stackoverflow.com/a/24047947
type: Question
has answer: http://stackoverflow.com/a/24047871
has answer: http://stackoverflow.com/a/24047947
upvote count: 2
linked to: http://stackoverflow.com/q/23783355
has title: Removing conditional code as part of Strategy pattern
downvote count: 1
has answer: http://stackoverflow.com/a/24049717
favorite count: 0
has body: I have some code which performs different logic depending on a conditional. But using strategy pattern does not allow to remove conditional code? Using Google this seems to be a common consequence of using the Strategy pattern : https://www.google.ie/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=removing%20if%20statements%20strategy%20pattern For example : class Cond { if(cond1){ perform1 } if(cond2){ perform1 } } Strategy pattern : interface Performer { doWork } class Perform1 implements Performer { doWork } class Perform2 implements Performer { doWork } class Cond { if(cond1){ new Perform1.doWork } if(cond2){ new Perform2.doWork } } Strategy pattern is more concerned with open-closed principle than actually removing conditional code ? Also isn't conditional code a natural occurrence of programming ?
accepted answer: http://stackoverflow.com/a/24047973
tagged with: design-patterns
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37159120
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24047973
tagged with: strategy-pattern

http://stackoverflow.com/comment/37166492
type: QuestionComment
comment on: http://stackoverflow.com/q/24095623
has text: I dont mean that I mean to update an activity you need to do it in either the main or UI thread or you need to call a thread from the main thread of the same activity
score: 0
type: Comment

http://stackoverflow.com/comment/37156324
type: Comment
has text: @AlexS thanks.although this answer didn't satisfy OP.did you receive her/his meaning?
comment on: http://stackoverflow.com/a/24090486
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36907281
type: Comment
comment on: http://stackoverflow.com/a/23957457
score: 0
type: AnswerComment
has text: Just checked and I'm using java 1.7 SE on the pi but java 1.8 on the PC.

http://stackoverflow.com/comment/37083939
type: AnswerComment
type: Comment
has text: Check this out http://stackoverflow.com/questions/596462/any-reason-to-prefer-getclass-over-instanceof-when-generating-equals
comment on: http://stackoverflow.com/a/24052002
score: 0

http://stackoverflow.com/q/24096381
type: Question
has title: How I can seen my created page of site on my OpenShift?
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37167013
has comment: http://stackoverflow.com/comment/37166693
score: 0
has comment: http://stackoverflow.com/comment/37167194
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: git
has body: I try create site on Java with Spring help on OpenShift. I did some actions: -Registered an account at OpenShift -Set it -Created application 'myapp' with 'Tomcat 7 (JBoss EWS 2.0)' Cartridge -Cloned it by git -Edited myapp by NetBeans(made simple index.jsp page which can saw by NetBeans Tomcat Local Server 8.0). -Pushed this project to OpenShift server by 'git push'(there's this data with changes on the server at this moment) -Deployed on the server(used 'gear deploy' command) And now I want seen my page on server but can seen only it: myapp-masakra.rhccloud.com what I have to do or change?
tagged with: java

http://stackoverflow.com/comment/37182363
comment on: http://stackoverflow.com/q/24104207
score: 0
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/529085/how-to-generic-array-creation

http://stackoverflow.com/comment/36980101
has text: are you sure? have you checked logcat? and btw, where do you initialize **db**?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23996358

http://stackoverflow.com/q/23942453
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36910501
has comment: http://stackoverflow.com/comment/36880380
has comment: http://stackoverflow.com/comment/36880538
has comment: http://stackoverflow.com/comment/36913003
has body: I have a Java program that listens for incoming connections on a port. I've been using 0.0.0.0 as the IP address so that it accepts connections on any IP on a multihomed system. Well, any IPv4 address, that is, and so I'd like to switch to the IPv6 equivalent, ::0, so it will accept incoming IPv6 connections as well... but if this code is then run on an IPv4-only system, will it still work? UPDATE: The binding, in this case, is expressed in the form of a URL - it's to configure an ActiveMQ broker - so I can't provide null.
answer count: 2
tagged with: ipv6
has title: Java binding to ::0 on IPv4-only machine?
has comment: http://stackoverflow.com/comment/36880318
has comment: http://stackoverflow.com/comment/36881306
has answer: http://stackoverflow.com/a/24001553
score: 0
has answer: http://stackoverflow.com/a/23942574
type: AnsweredQuestion
tagged with: activemq-classic
has comment: http://stackoverflow.com/comment/36880414
possible better answer: http://stackoverflow.com/a/23942574
accepted answer: http://stackoverflow.com/a/24001553
has comment: http://stackoverflow.com/comment/36902313

http://stackoverflow.com/comment/96926325
comment on: http://stackoverflow.com/a/24050702
has text: The link is broken. Can you help here, please? @CogComp-NLP
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24032626
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37208536
answers question: http://stackoverflow.com/q/24030366
has body: The difference is that: (1) executes your slow task in servlet thread pool, resulting in servlet pool starvation (that's the case with Tomcat/Jetty at least). What that means is that if you replace serviceImpl(req, resp, adapter, context, isNotLeakScan); with Thread.sleep(Long.MAX_VALUE); and try to connect to Tomcat from your browser 200 times (200 is the default number of threads) - Tomcat is going to hang forever, not accepting any more HTTP connections. (2) spawns a thread per task manually. You normally don't want to manually spawn threads, poll the queue etc. Instead you would use Executors framework, it has queue implementation under the hood, and is based on internal thread pool. @WebServlet(urlPatterns = {"/slowServlet"}, asyncSupported = true) public class SlowServlet extends javax.servlet.http.HttpServlet { protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException { final AsyncContext acontext = request.startAsync(); ServletContext appScope = request.getServletContext(); ((Executor) appScope.getAttribute("executor")).execute(() -&gt; { try { Thread.sleep(10000); // your slow running task acontext.getResponse().getWriter().print("Done"); } catch (Exception e) { e.printStackTrace(); } }); } } And servlet context listener is (the size of thread pool is hardcoded here) @WebListener public class ExecutorListener implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) { Executor executor = Executors.newFixedThreadPool(10); sce.getServletContext().setAttribute("executor", executor); } public void contextDestroyed(ServletContextEvent sce) { // add executor fancy shutdown logic here } }
has comment: http://stackoverflow.com/comment/37081862
accepted answer of: http://stackoverflow.com/q/24030366
has comment: http://stackoverflow.com/comment/37048185

http://stackoverflow.com/q/24006512
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
has body: I am new to Android development. I want every activity has a same customized popup menu on the top right. I use a LinearLayout in xxmenu.xml and include it in each activity's layout xml files. The display is OK. As the OnClickListener should be same, I don't want to implement the OnClick functions in every activity's Java file. How can I do this? I know Android has inherent menu solution via OptionsMenu, but I don't know if it can be customized or how (e.g., I want it on topright corner, with different backgrounds, each item has an image icon followed by texts, one-side shadow, etc.)
has comment: http://stackoverflow.com/comment/36999236
has answer: http://stackoverflow.com/a/24009701
type: Question
possible better answer: http://stackoverflow.com/a/24006544
answer count: 2
has answer: http://stackoverflow.com/a/24006544
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24009701
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/36999945
has title: Bind listeners on customized menu across activities in Android
linked to: http://stackoverflow.com/q/4344469
has comment: http://stackoverflow.com/comment/36999186

http://stackoverflow.com/q/23947261
tagged with: cassandra
has comment: http://stackoverflow.com/comment/36888776
has comment: http://stackoverflow.com/comment/36888512
type: Question
tagged with: nosql
has comment: http://stackoverflow.com/comment/36888567
tagged with: cassandra-2.0
score: 0
has body: I have installed Cassandra 2.0 On CentOS6.5 Server and and while testing simple records everything is working fine, Now I have to upload 600 billion rows, when I use COPY on cqlsh it failed after 5 minutes and approx rows inserted are 0.2 million with rpc timeout, then I opted for pycasso and parsed csv and tried to import using inserts commands, after every 10K records, We opted to close connection and develop new connection again. but after around 60k records it failed with with timeout. My debug trace shows something this while server is not accepting inserts, without any activity it's still busy. DEBUG [OptionalTasks:1] 2014-05-30 04:34:16,305 MeteredFlusher.java (line 41) Currently flushing 269227480 bytes of 2047868928 max DEBUG [OptionalTasks:1] 2014-05-30 04:34:17,306 MeteredFlusher.java (line 41) Currently flushing 269227480 bytes of 2047868928 max DEBUG [OptionalTasks:1] 2014-05-30 04:34:18,306 MeteredFlusher.java (line 41) Currently flushing 269227480 bytes of 2047868928 max DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,012 ColumnFamilyStore.java (line 298) retryPolicy for schema_triggers is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,012 ColumnFamilyStore.java (line 298) retryPolicy for compaction_history is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,012 ColumnFamilyStore.java (line 298) retryPolicy for batchlog is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,012 ColumnFamilyStore.java (line 298) retryPolicy for sstable_activity is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,012 ColumnFamilyStore.java (line 298) retryPolicy for peer_events is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,012 ColumnFamilyStore.java (line 298) retryPolicy for compactions_in_progress is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,013 ColumnFamilyStore.java (line 298) retryPolicy for hints is 0.99 DEBUG [OptionalTasks:1] 2014-05-30 04:34:19,013 ColumnFamilyStore.java (line 298) retryPolicy for schema_keyspaces is 0.99 DEBUG [OptionalTasks:1] 2014-05…
tagged with: java
has title: Cassandra Insertion/ write failed
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36888471
tagged with: pycassa

http://stackoverflow.com/comment/37323358
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24064349
has text: Seems the server side still doesn't like me doing this. It is very specific about matching JSessionid's with client generated Id's and it just seems to allow only one session. Stupid thing. Thanks for your help though.
type: Comment

http://stackoverflow.com/comment/37245415
type: Comment
has text: i have work with longitude and latitude. but the problem is ,i cannot able to work with touch event and map listener event. can you post some code?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24135780

http://stackoverflow.com/comment/36898213
comment on: http://stackoverflow.com/q/23946269
score: 0
type: Comment
type: QuestionComment
has text: looks like a java question, what's clojure in it?

http://stackoverflow.com/comment/36880486
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23943042
type: Comment
has text: It doesn't look like id is being initialized to anything and it's not being set by your table class with i.setId(_). Hence, when you do i.getId() it will return null.

http://stackoverflow.com/comment/37083565
comment on: http://stackoverflow.com/a/24051713
type: AnswerComment
has text: This works when I have a set amount of listings in the list. I tried implementing it after populating the list using AsyncTask to get from a webserver and then I got another error but this time on `listView.addFooterView(footerView)`
score: 0
type: Comment

http://stackoverflow.com/comment/37126454
type: QuestionComment
has text: @user3713816, put your code on question, not in comment. Try to use conection pooling.
comment on: http://stackoverflow.com/q/24074892
score: 0
type: Comment

http://stackoverflow.com/comment/36942669
score: 0
type: Comment
type: QuestionComment
has text: Great question, what I am attempting to do is make a game to help myself learn java and OOP. So what I am stuck on is creating a reset button. Example, I have a random number that gets generated by a method and displayed, and I want this "reset" button to clear the previous value and reuse that method to generate a new one.
comment on: http://stackoverflow.com/q/23976499

http://stackoverflow.com/q/23998603
accepted answer: http://stackoverflow.com/a/23999568
type: AnsweredQuestion
tagged with: java
tagged with: image-processing
type: Question
tagged with: opencv
has body: I need to implement a template matching method with Java. I found OpenCV and JavaCV for this problem. To start with OpenCV I found some Tutorials at http://www.tutorialspoint.com/ (Don´t know why, but the most only create a black image). No matter... Now I wanted to try this: http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html But I have no Idea how I can use it with Java (OpenCV and JavaCV are furnished in Eclipse). For the case of JavaCV, I found the following Code: IplImage src = cvLoadImage("new.png"); IplImage tmp = cvLoadImage("old.png"); IplImage result = cvCreateImage(cvSize(src.width()-tmp.width()+1, src.height()- tmp.height()+1), IPL_DEPTH_32F, 1); cvZero(result); //Match Template Function from OpenCV cvMatchTemplate(src, tmp, result, CV_TM_CCORR_NORMED); double[] min_val = new double[2]; double[] max_val = new double[2]; CvPoint minLoc = new CvPoint(); CvPoint maxLoc = new CvPoint(); //Get the Max or Min Correlation Value cvMinMaxLoc(result, min_val, max_val, minLoc, maxLoc, null); System.out.println(Arrays.toString(min_val)); System.out.println(Arrays.toString(max_val)); CvPoint point = new CvPoint(); point.x(maxLoc.x()+tmp.width()); point.y(maxLoc.y()+tmp.height()); cvRectangle(src, maxLoc, point, CvScalar.WHITE, 2, 8, 0);//Draw a Rectangle for Matched Region cvShowImage("Lena Image", src); cvWaitKey(0); cvReleaseImage(src); cvReleaseImage(tmp); cvReleaseImage(result); But however I pass the files I get a NullPointerException. Has anyone an example how I can use template matching with OpenCV or JavaCV or is there a simple approach doing this task without any library?
tagged with: javacv
has comment: http://stackoverflow.com/comment/36984971
has answer: http://stackoverflow.com/a/23999568
score: 0
has comment: http://stackoverflow.com/comment/37018783
has title: Template matching via OpenCV or JavaCV
answer count: 1

http://stackoverflow.com/a/24081503
accepted answer of: http://stackoverflow.com/q/24062716
type: Answer
has comment: http://stackoverflow.com/comment/37181734
has comment: http://stackoverflow.com/comment/37263444
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24062716
has comment: http://stackoverflow.com/comment/37313526
type: AcceptedAnswer
downvote count: 0
has body: Instead of artifact (file("${buildDir}/dist/${module_context}.jar")){ name "${module_name}" extension 'jar' } use from components.java The first simply publishes the specified file. The second will publish the jar generated by the jar task of the java plugin and generate dependency meta data from the runtime configuration.
has comment: http://stackoverflow.com/comment/37338898
has comment: http://stackoverflow.com/comment/37138695
has comment: http://stackoverflow.com/comment/37212775

http://stackoverflow.com/q/24032656
has comment: http://stackoverflow.com/comment/37048257
has answer: http://stackoverflow.com/a/24033146
has comment: http://stackoverflow.com/comment/37047739
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/37048195
type: Question
has title: I am unable to get image bytes from my JSON array, can anyone help me?
has comment: http://stackoverflow.com/comment/37047807
accepted answer: http://stackoverflow.com/a/24033146
score: 0
has comment: http://stackoverflow.com/comment/37047671
has comment: http://stackoverflow.com/comment/37048448
answer count: 1
has body: This is my JSON Array, I am unable to parse ItemImage1 and Bytes from this JSON array. Can any one help me. {"FetchAllItemsResult":[{"ItemID":5, "ItemCategoryID":225, "ItemCode":"1263", "barcode":"0010000005", "ItemDescription":"CAKE TRAY ROUND TEFAL 1 PCS (L) [RETAIL]", "packingtypeid":1, "ItemImage1":{"Bytes":[137,80,78,71,13,10,26,....]}, "sellingPrice":350.00, "TaxPercentage":6.00},..]} This is my Product Class. public class Product{ @SerializedName("ItemID") int itemID; @SerializedName("ItemCategoryID") int itemCategoryID; @SerializedName("ItemCode") String itemCode; @SerializedName("barcode") String barCode; @SerializedName("ItemDescription") String itemDescription; @SerializedName("packingtypeid") int packingTypeID; @SerializedName("sellingPrice") double sellingPrice; @SerializedName("TaxPercentage") double taxPercentage; @SerializedName("ItemImage1") ProductImage itemImage; } This is ProductImage Class. public class ProductImage { @SerializedName("Bytes") byte[] itemImage; } This is ProductList class to hold the entire JSON Array. public class ProductList { @SerializedName("FetchAllItemsResult") List&lt;Product&gt; Products; } I'm using Volley GsonRequest&lt;ProductList&gt; There are no errors but I cannot get Image Bytes(ItemImage1 and Bytes) from JSON array, please help me. This is the output I'm getting for Bytes array. [B@b2e761c8
tagged with: android-volley
has comment: http://stackoverflow.com/comment/37047858
has comment: http://stackoverflow.com/comment/37048006
tagged with: android

currency
tag name: currency
tags question: http://stackoverflow.com/q/23990805
type: Tag
tags question: http://stackoverflow.com/q/24065392
tags question: http://stackoverflow.com/q/24038665

http://stackoverflow.com/q/24036224
score: 1
has title: Hibernate search faceting, how to return facet query Spring MVC
upvote count: 1
tagged with: spring
answer count: 1
tagged with: java
tagged with: hibernate
tagged with: hibernate-search
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/24058151
tagged with: facet
has body: I have query and getting facets by this query. But how Can I add selected facet to next query from front end ? FacetingRequest categoryFacetingRequest = qBuilder.facet() .name("categoryFaceting").onField("distr").discrete() .orderedBy(FacetSortOrder.COUNT_DESC).includeZeroCounts(false) .createFacetingRequest(); FacetManager facetManager = fullTextQuery.getFacetManager(); facetManager.enableFaceting(categoryFacetingRequest); List&lt;Facet&gt; facets = facetManager.getFacets("categoryFaceting"); List of facets I attach as model attribute.
type: Question

http://stackoverflow.com/comment/37175823
comment on: http://stackoverflow.com/q/24100437
score: 0
type: Comment
type: QuestionComment
has text: Not helpful? Any idea how to fix instead of criticize the question?

http://stackoverflow.com/comment/36894051
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23950296
has text: I knoe it is my dear T.J. Usually when we run date it brings this format 15:04:03 but this was just 3 numbers. That's why I asked. To be honest I copy pasted this "Calendar.getInstance().get(Calendar.MILLISECOND) method. I don't have good clear idea. That's why I asked why 542 brings.
type: AnswerComment

http://stackoverflow.com/q/24016564
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14578536
score: 1
has body: I am following this tutorial https://developers.google.com/accounts/docs/OAuth2ServiceAccount to authorise my application. i have created a JWT by following the tutorial. But when I make a access token request I keep on getting a "Invalid grant_type: urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer" exception. Here is my code to make the request HttpClient httpClient = new HttpClient(); PostMethod post = new PostMethod("https://accounts.google.com/o/oauth2/token"); post.addRequestHeader("Content-Type", "application/x-www-form-urlencoded"); post.addParameter("grant_type", URLEncoder.encode("urn:ietf:params:oauth:grant-type:jwt-bearer", "UTF-8")); post.addParameter("assertion", "JWT including signature."); httpClient.executeMethod(post); I have looked at a lot of resources bu the obvious error seems to be mistaking the client id for the email id. However, I have checked and re-cheeked that to make sure that I am using the correct one. Please can anyone tell me what am I doing wrong. Many Thanks
tagged with: java
type: Question
tagged with: google-oauth
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24039994
accepted answer: http://stackoverflow.com/a/24039994
tagged with: google-drive-api
has title: 400 Error "error_description" : "Invalid grant_type: urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer" Google Service account

http://stackoverflow.com/q/24005486
has answer: http://stackoverflow.com/a/24006016
has body: For a couple of reasons, I'm interested in writing a hybrid application which is partially coded in Java (via Google Web Toolkit) and partially coded in JavaScript. I'm planning on calling the Java library from JavaScript by using GWT Exporter. The trouble is that this destroys a lot of the opportunities for code optimization and compression. GWT is mostly just designed to optimize the JavaScript it generates, and third-party Javascript compression libraries will probably break down when given GWT output. Is there a way to tell the GWT compiler "hey, pass these Javascript files into your optimization pass as well"? GWT has a flag for using the Closure Compiler under the hood (which obviously supports optimizing regular javascript), so it feels like this should be possible.
tagged with: java
has answer: http://stackoverflow.com/a/24010567
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/24008527
tagged with: javascript
score: 0
answer count: 3
type: UnansweredQuestion
has title: Can GWT optimize raw javascript along with its generated output?

http://stackoverflow.com/a/24069804
upvote count: 10
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24048157
type: Answer
answers question: http://stackoverflow.com/q/24048157
score: 10
has body: Jim, yes you were correct. Indeed, I was not following exactly what needed to be done. You could have been a little bit more helpful though in pointing out which part I got wrong though, rather than the standard RTFM response. For anyone else coming to this in the future, here is the full/correct/cleaned-up "make" batch file... @echo off setlocal cls set HOME_DIR=D:\current\battle set CLASS_DIR=classes set SRC_DIR=src set CLASS_NAME=RemoveFiles set STUB=stub.bat cd /d %HOME_DIR% javac -d %CLASS_DIR% src\%CLASS_NAME%.java pushd %CLASS_DIR% echo Main-Class: %CLASS_NAME% &gt; MANIFEST.MF jar -cvmf MANIFEST.MF ..\%CLASS_NAME%.jar %CLASS_NAME%*.class popd jar -uf %CLASS_NAME%.jar %CLASS_DIR%\%CLASS_NAME%.java echo @java -jar %%~n0%%~x0 %%* &gt; %STUB% echo @exit /b &gt;&gt; %STUB% copy %STUB% /b + %CLASS_NAME%.jar /b %CLASS_NAME%.bat /b del %CLASS_NAME%.jar del %STUB% endlocal Note: It is important to not just use %0. If running the batch file as "RemoveFiles", it would not work, because the ".bat" would be missing from the $0 value. If it were run as "RemoveFiles.bat", then %0 would be the full filename, allowing Java to locate the batch file as the JAR file. Because we make batch files to save us time and typing, they are frequently executed without specifying the ".bat" potion. So, what the %%~n0%%~x0 does is force both the name and extension regardless of what was specified on the command line. The % signs need to be escaped because they are being echoed, which is why there are two of them. In the final batch file, there will only be the one. I hope this helps the next person looking for this...

http://stackoverflow.com/q/23957177
tagged with: ldap-query
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23957271
downvote count: 0
has body: I cannot find a way to get users from LDAP by specific organisational unit. Only able to get all users with: List users = (List&lt;User&gt;) ldapTemplate.search(base, "(&amp;(objectClass=person))", new UserAttributesMapper()); If I add to query something like (memberOf=OU=Users) I get empty results. What is the correct query for this kind of action?
tagged with: ldap
answer count: 3
has answer: http://stackoverflow.com/a/23968045
has answer: http://stackoverflow.com/a/23958244
favorite count: 0
type: UnansweredQuestion
has title: Java LDAP query to retrieve all users in an organisational unit
upvote count: 1

http://stackoverflow.com/a/24033113
type: Answer
has body: If you just want to create a 4-element list with the randomized order of the numbers {0, 1, 2, 3}, you could just create a 4-length array then swap them randomly by specifying the i-th index and a randomized one as per rand.nextInt(4).
score: 0
answers question: http://stackoverflow.com/q/24033003

http://stackoverflow.com/comment/37054121
type: Comment
comment on: http://stackoverflow.com/a/24036132
score: 1
type: AnswerComment
has text: How does this answer the OPs question?

http://stackoverflow.com/a/24027356
has body: The easiest way to do this would be to download the Jar. First, you need to download the jar. Go to the Maven Repository website and click "Download (JAR)." Now, go to Eclipse. Right click on your project, click properties (or Alt-Enter), go to Java Build Path -> Libraries -> Add External JARs. Add the JAR you downloaded. Now you can start using jReddit! What Maven is from the Maven site: Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37038292
has comment: http://stackoverflow.com/comment/37038604
type: Answer
upvote count: 5
has comment: http://stackoverflow.com/comment/37038572
has comment: http://stackoverflow.com/comment/37038620
has comment: http://stackoverflow.com/comment/37038261
has comment: http://stackoverflow.com/comment/37038542
has comment: http://stackoverflow.com/comment/37038600
accepted answer of: http://stackoverflow.com/q/24027229
has comment: http://stackoverflow.com/comment/37038584
answers question: http://stackoverflow.com/q/24027229

http://stackoverflow.com/q/24013492
tagged with: java
tagged with: dom
type: Question
accepted answer: http://stackoverflow.com/a/24014407
has title: Why DocumentBuilder.parse throws SaxParserException
answer count: 1
downvote count: 0
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/24014407
upvote count: 2
tagged with: sax
has body: The typical code snippet to create a DOM from an xml is as below: Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("somefile.xml"); I was wondering why the parse method throws SAXException ? I looked into the code and found that the DOMParser class parse(InputSource inputSource) method originally throws this exception up the chain. Can anyone please help me understand, why DOM creation will need us to catch SaxException ? Isn't it kind of an oximoron?
type: AnsweredQuestion

http://stackoverflow.com/q/24025938
has answer: http://stackoverflow.com/a/24026010
has answer: http://stackoverflow.com/a/24026043
has body: I'm trying to get a two line text in a JButton The text is suppose to display between and also between /> and just like this but for some reason, it is not working in my for loop JButton title[] = new JButton[6]; JButton button[] = new JButton[30]; String[] titleText = {"World Religion", "New Title", "New Title", "New Title", "New Title", "New Title"}; // for (int i=0; i&lt;6; i++) { title[i] = new JButton(); title[i].setText("&lt;html&gt; &lt;br /&gt; &lt;/html&gt;"+titleText[i]); add(title[i]); }
score: 0
accepted answer: http://stackoverflow.com/a/24026010
tagged with: swing
possible better answer: http://stackoverflow.com/a/24026043
tagged with: jbutton
has comment: http://stackoverflow.com/comment/37035693
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37035561
type: Question
answer count: 2
tagged with: for-loop
linked to: http://stackoverflow.com/q/13503280
has title: JButton.setText() in a for loop java
has comment: http://stackoverflow.com/comment/37035570

http://stackoverflow.com/comment/37112854
has text: @ChrisStratton right missed it. probably op should use append
comment on: http://stackoverflow.com/a/24067486
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23978541
tagged with: class
upvote count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: How to save Intents with sharedpreferences?
tagged with: android-intent
score: 2
answer count: 0
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/2812650
type: Question
has comment: http://stackoverflow.com/comment/36946283
has body: So I'm making a launcher which has fixed buttons, and these buttons launch different applications. For the past week I've been trying to figure out how I can choose an intent (Select and app to launch, then launch it). And I've gotten that part right. But what I'm looking for is a way to save these intents, because I am using the same method for my other buttons, but as soon as i select "use as default" in the pop up, this gets assigned to all the buttons and all the buttons open the calculator app. I just want the user to select which app they want as default and then launch it for that button forever. I've been searching this site, google, and many other sites for solutions but I'm out. In my other answer I was told to use a specific method, and then use shared preference to save it. But I don't get it. I would like a simple method where the user gets to select the intent if they haven't already, then as soon as they select it, the selection gets stored so if the user goes back and tap the button again it opens the app they had chosen. Basically a App Chooser/Picker. Different codes I've implemented. @Override public void onClick(View v) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); if (!prefs.getBoolean("FileExplorer", false)) { final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); final List pkgAppsList = getActivity().getPackageManager().queryIntentActivities( mainIntent, 0); startActivity(Intent.createChooser(mainIntent, "Choose your default app")); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("FileExplorer", true); editor.commit(); } } }); And final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); final List pkgAppsList = getActivity().getPackageManager().queryIntentActivities( mainIntent, 0); startActivity(Intent.createChooser(mainIntent, "Choose your default app")); Thanks for…

http://stackoverflow.com/a/24027776
has comment: http://stackoverflow.com/comment/37038933
has comment: http://stackoverflow.com/comment/37039139
downvote count: 0
has comment: http://stackoverflow.com/comment/37039085
has comment: http://stackoverflow.com/comment/37039157
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24027764
has body: The @XmlSchema annotation is a package annotation, so put it in a file called package-info.java, located in the same source directory as Urlset.java, like so: @XmlSchema(namespace = "http://www.sitemaps.org/schemas/sitemap/0.9", elementFormDefault = XmlNsForm.QUALIFIED) Remove that same annotation from your Urlset class.
answers question: http://stackoverflow.com/q/24027764
type: Answer
has comment: http://stackoverflow.com/comment/37039096
upvote count: 5

http://stackoverflow.com/a/23976691
score: 0
has comment: http://stackoverflow.com/comment/36943449
type: Answer
has comment: http://stackoverflow.com/comment/36943445
has body: Why dont you use a loop to create your buttons? Here is mine: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Arrays; import javax.swing.*; public class TicTacToe extends JFrame { JPanel p = new JPanel(); XOButton button[] = new XOButton[9]; JButton clear = new JButton("CLEAR!"); public static void main(String[] args) { new TicTacToe(); } public TicTacToe() { setTitle("Tic Tac Toe!"); setSize(600, 800); setDefaultCloseOperation(EXIT_ON_CLOSE); setResizable(true); p.setLayout(new GridLayout(4,3)); for (int i=0; i&lt;9; i++) { button[i] = new XOButton(); p.add(button[i]); clear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { button[0].setIcon(null); button[1].setIcon(null); button[2].setIcon(null); button[3].setIcon(null); button[4].setIcon(null); button[5].setIcon(null); button[6].setIcon(null); button[7].setIcon(null); button[8].setIcon(null); } }); p.add(clear); add(p); setVisible(true); } } } ====CLASS for IOButton========== import javax.swing.JButton; import javax.swing.ImageIcon; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class XOButton extends JButton implements ActionListener { ImageIcon X,O; byte value=0; public XOButton() { X = new ImageIcon(this.getClass().getResource("X.gif")); O = new ImageIcon(this.getClass().getResource("O.png")); this.addActionListener(this); } public void actionPerformed(ActionEvent e) { value++; value%=3; switch(value) { case 0: setIcon(null); break; case 1: setIcon(X); break; case 2: setIcon(O); break; } } } HAVE A LOOK
has comment: http://stackoverflow.com/comment/36943311
answers question: http://stackoverflow.com/q/23976620

http://stackoverflow.com/comment/37290975
comment on: http://stackoverflow.com/q/24006154
score: 0
has text: http://www.prasannatech.net/2008/10/jython-inheritance-java.html This might be what you need
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24059767
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37098250
answers question: http://stackoverflow.com/q/24059099
score: 1
upvote count: 1
has body: You can use Array of images like private int[] imagesArray = { R.drawable.img_00, R.drawable.img_01, R.drawable.img_02, }; Then u can do Drawable d = getResources().getDrawable(imagesArray[i]); yourImageView.setImageDrawable(d); just change the int i value every time when u want to load image And in xml keep only one Image View that will work..u kept different image view for differentimage hope that will help to u

http://stackoverflow.com/a/24068054
score: 0
type: Answer
has body: Your log statement is just logging the query. Behind the scenes the limit actually gets applied to the cursor, so you're not going to see it using that log statement. Try using the MongoDB profiler (set profile level 2) then query the system.profile collection and you will see that your limit is actually applied to the query, indicated by the ntoreturn field in the profile record.
answers question: http://stackoverflow.com/q/24066432

http://stackoverflow.com/q/24063836
type: Question
has answer: http://stackoverflow.com/a/24064369
answer count: 1
has title: Getting started with the SBT Java EE samples
tagged with: tomcat
has body: I have connected my Eclipse and cloned the https://github.com/OpenNTF/SocialSDK.git I have a Tomcat 7.0 server and the SBT properties file I have added the following web projects to the server: com.ibm.sbt.bootstrap211 com.ibm.sbt.sample.web com.ibm.sbt.web When I open de sample web (http://localhost:8080/sbt.sample.web/home.jsp) I get the page, but selecting a environment does not result in any change. Which means that the pages remain empty... The question is: can someone point me to a document or youtube movie that explains al this (I already have the labs PDF) but I want to get started with the latest build.
score: 0
tagged with: ibm-sbt
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/37125372
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24073830
has text: Even after using toString() i got same exception Caught::java.io.FileNotFoundException: C:\kevin_java\file io\DemoIO.java (The filename, directory name, or volume label syntax is incorrect)

http://stackoverflow.com/q/24023545
has comment: http://stackoverflow.com/comment/37030847
has comment: http://stackoverflow.com/comment/37030940
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24023733
has comment: http://stackoverflow.com/comment/37030884
has answer: http://stackoverflow.com/a/24023774
score: 0
has answer: http://stackoverflow.com/a/24023609
answer count: 3
possible better answer: http://stackoverflow.com/a/24023733
favorite count: 0
has title: Java: JSON (Gson) get values from JSON string
has comment: http://stackoverflow.com/comment/37030906
tagged with: python
accepted answer: http://stackoverflow.com/a/24023774
linked to: http://stackoverflow.com/q/14263114
has comment: http://stackoverflow.com/comment/37030976
upvote count: 2
has body: I have a JSON string printed as: { "result":"_error", "invokeId":2, "data":{ "timestamp":1.401824129758E12, "rootCause":{ "message":"Wrong client version for server", "localizedMessage":"Wrong client version for server", "rootCauseClassname":"login.impl.ClientVersionMismatchException", "substitutionArguments":[ "4.9", "4.8.14_05_16_17_02" ], "errorCode":"LOGIN-0001" }, "headers":{ }, "correlationId":"00E36368-6158-CD63-56CA-4F39493E8ED3", "faultCode":"Server.Processing", "messageId":"D8424EAD-8D0B-5441-820B-775B99812CFD", "faultString":"login.impl.ClientVersionMismatchException : Wrong client version for server", "timeToLive":0.0, "clientId":"D8424E8B-5F0F-1ECD-C29F-C6440488B0FC", "destination":"loginService" }, "version":0 } I know how to do this in Python so I'll show it. Let x be that JSON object as a dictionary in Python. x['data']['rootCause']['substitutionArguments'] will get me "4.8.14_05_16_17_02". How do I get "4.8.14_05_16_17_02" in Java code? I am using Gson as my JSON library for Java.
downvote count: 2
duplicate of: http://stackoverflow.com/q/14263114
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/37257864
comment on: http://stackoverflow.com/a/24143083
type: Comment
has text: @davidfmatheson Right, I think my tomcat version is a bit old, but with such a number of lines in tomcat7.0 changelog, it does not seem to be fully stabilized.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24062716
favorite count: 0
has title: Gradle ivy.xml dependencies not added
tagged with: dependencies
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: gradle
has answer: http://stackoverflow.com/a/24081503
type: Question
has body: I am running into an issue when publishing artifacts to using the 'ivy-publish' plugin. There are multiple modules where I publish a custom jar or a couple custom jars and the ivy.xml file does not add the project dependencies. Would this be because they are custom jars or something else? Here is a sample of how I am publishing. publishing{ publications{ client(IvyPublication){ organisation "${group}" module "${module_name}" revision "${version}" artifact (file("${buildDir}/dist/${module_context}.jar")){ name "${module_name}" extension 'jar' } } } } These are the dependencies that are being used by the project. dependencies{ compile (group:"com.xxxxxxx", name:"xxxx-svcs-common", version:"${xxxx_svcs_common_service_version}", transitive:false) compile (group:"com.xxxxxxx.cache", name:"xxxx-cache", version:"${xxxx_svcs_common_svcs_cache_version}", transitive:false) compile (group:"com.sun.jersey", name:"jersey", version:"1.8", transitive:false) compile (group:"com.oracle", name:"coherence", version:"3.7.1", transitive:false) compile (group:"com.xxxxxxx.cache", name:"xxxx-cache", version:"${xxxx_entsvcs_common_svcs_cache_version}", transitive:false) } And this is the ivy.xml that is generated. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ivy-module version="2.0"&gt; &lt;info organisation="xxx.xxxxxxx" module="xxxx-service-name" revision="xxx2014_jun-201406051004" status="integration" publication="20140605100413"/&gt; &lt;configurations/&gt; &lt;publications&gt; &lt;artifact name="xxxx-service-name" type="jar" ext="jar"/&gt; &lt;/publications&gt; &lt;dependencies/&gt; &lt;/ivy-module&gt; Any help would be greatly appreciated. Thanks.
tagged with: java
tagged with: ivy
accepted answer: http://stackoverflow.com/a/24081503
downvote count: 0
answer count: 1

http://stackoverflow.com/a/23993072
score: 0
answers question: http://stackoverflow.com/q/23988906
type: Answer
has body: Your delete action is only removing it from the scoped variable. public String deleteAction(User user) { userList.remove(user); return null; } You need to also remove it from the database, via the entity manager. em.remove(object)

http://stackoverflow.com/a/24013508
has comment: http://stackoverflow.com/comment/37019636
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37020256
has comment: http://stackoverflow.com/comment/37014243
has comment: http://stackoverflow.com/comment/37018793
has body: Are you sure you want to do this? While NEO4j is nice there are so many other production quality SPARQL solutions out there. That I can't recommend a non standard (sparql http protocol wise), non vendor supported plugin as valid technical solution. You are moving from one of the SPARQL on top of MySQL solutions, that was state of the art in 2010 but not competitive (or maintained) these days. I suggest you look at Virtuoso or something from the OWLIM family instead. If your data not very large (a few million triples) then the solutions from apache jena or open rdf sesame(this is used inside the sparql plugin as well) fit your needs. Scaling wise Systap Bigdata also beat Neo4j performance in my tests. I am listing mostly java based solutions as you are ok with that seeing Neo4j is one as well. In other words look at upgrading to a real SPARQL solution or rewriting for Cypher and Neo4j. Now to your actual question. As you are introducing a context or named graph when loading data you might need to use that in your query as well. { "query" : "SELECT ?x ?y WHERE { GRAPH&lt;http://neo4j.org&gt;{?x &lt;http://neo4j.org#RUN_ON&gt; ?y . }}" } However, a key thing for your customer is that they are probably using sparql over http to access your data. This is exactly where Neo4j sparql is incompatible i.e. neo4jsparql expects a json string while sparql http expects a uri parameter called query. I now think I better understand your question. You used the Neo4J api directly to insert nodes into a neo4j graph. Then you try to use the SPARQL plugin to query over those nodes you inserted. This does not work, as the SPARQL plugin expects a certain graph structure to exist. You either need to carefully study the graph generated by the SPARQL plugin and recreate it exactly or use the: com.tinkerpop.blueprints.oupls.sail.GraphSail addStatement to do so correctly for you.
has comment: http://stackoverflow.com/comment/37018757
has comment: http://stackoverflow.com/comment/37025124
type: Answer
has comment: http://stackoverflow.com/comment/37022188
score: 1
has comment: http://stackoverflow.com/comment/37017341
upvote count: 1
has comment: http://stackoverflow.com/comment/37015534
has comment: http://stackoverflow.com/comment/37061652
accepted answer of: http://stackoverflow.com/q/24010978
answers question: http://stackoverflow.com/q/24010978
has comment: http://stackoverflow.com/comment/37018512
has comment: http://stackoverflow.com/comment/37059965

http://stackoverflow.com/comment/36964056
type: Comment
has text: but we have declared it as .png for image_url. will endsWith method still check for other extension? of course it will go for image_url.endsWith("png").
comment on: http://stackoverflow.com/a/23987843
type: AnswerComment
score: 0

opencv
type: Tag
tags question: http://stackoverflow.com/q/24077140
tags question: http://stackoverflow.com/q/23976766
tags question: http://stackoverflow.com/q/23978887
tags question: http://stackoverflow.com/q/24014491
tags question: http://stackoverflow.com/q/24089400
tag name: opencv
tags question: http://stackoverflow.com/q/24073072
tags question: http://stackoverflow.com/q/24068959
tags question: http://stackoverflow.com/q/23998603
tags question: http://stackoverflow.com/q/23967297

http://stackoverflow.com/comment/36888994
score: 0
type: Comment
has text: i said heap size was an issue because i had that OutOfMemoryError twice after which i increased the memory to 4096M
type: AnswerComment
comment on: http://stackoverflow.com/a/23947538

http://stackoverflow.com/comment/36895719
type: QuestionComment
has text: @MadProgrammer forgot to tag you - see above.
comment on: http://stackoverflow.com/q/23943025
score: 0
type: Comment

http://stackoverflow.com/q/23962533
has comment: http://stackoverflow.com/comment/36917125
tagged with: parameters
type: AnsweredQuestion
tagged with: final
tagged with: java
has title: Compilation effects of declaring method parameters "final"
linked to: http://stackoverflow.com/q/500508
downvote count: 1
type: Question
has body: Marking a method parameter as final is needed to allow for variable access by inner anonymous classes and is a useful coding-tool for enforcing certain variable use conventions within the method. Apart from that, is there some other compilation-related motivation to use the final-keyword? Specifically, does it give the compiler any hints which facilitate some specific optimization that would otherwise not be performed? Or is the compiler smart enough to always recognize if a variable is never modified anyways? For example, I'm thinking whether there is any difference how the variables are passed into the method. E.g. a variable of primitive type (int, byte, etc.) needs to be copied when passed into the method to prevent any modifications to trickle out into the calling code, whereas if the parameter is marked final, it could be "passed by reference" without such concerns, i.e. no copy-operation would be needed. But let's keep the question more general than this example: Are there scenarios where adding final to a method parameter will change the generated byte-code?
has answer: http://stackoverflow.com/a/23964971
has comment: http://stackoverflow.com/comment/36917652
tagged with: bytecode
has comment: http://stackoverflow.com/comment/36978923
score: -1
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36917460
accepted answer: http://stackoverflow.com/a/23964971
has comment: http://stackoverflow.com/comment/36917427
favorite count: 0
linked to: http://stackoverflow.com/q/266806
has comment: http://stackoverflow.com/comment/36917286
has comment: http://stackoverflow.com/comment/36917120
has comment: http://stackoverflow.com/comment/36917511
has comment: http://stackoverflow.com/comment/36917348
has comment: http://stackoverflow.com/comment/36917455
duplicate of: http://stackoverflow.com/q/266806

http://stackoverflow.com/comment/37073415
type: QuestionComment
comment on: http://stackoverflow.com/q/24046205
has text: That's a lot of information. Take each individual concept/module and search for it individually.
type: Comment
score: 1

http://stackoverflow.com/comment/36981770
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23996648
has text: I am working with eclipse
score: 0

http://stackoverflow.com/a/23958916
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/83390494
has comment: http://stackoverflow.com/comment/36910229
has comment: http://stackoverflow.com/comment/56142123
has comment: http://stackoverflow.com/comment/83095606
upvote count: 295
score: 293
has comment: http://stackoverflow.com/comment/99261782
type: Answer
has comment: http://stackoverflow.com/comment/113506186
has comment: http://stackoverflow.com/comment/80325929
downvote count: 2
has comment: http://stackoverflow.com/comment/83095774
has comment: http://stackoverflow.com/comment/83391625
has comment: http://stackoverflow.com/comment/36910008
has comment: http://stackoverflow.com/comment/42362061
has comment: http://stackoverflow.com/comment/113463876
has comment: http://stackoverflow.com/comment/83506028
has body: How about Runnable : @FunctionalInterface public interface Runnable { /** * When an object implementing interface Runnable is used * to create a thread, starting the thread causes the object's * run method to be called in that separately executing * thread. * * The general contract of the method run is that it may * take any action whatsoever. * * @see java.lang.Thread#run() */ public abstract void run(); }
accepted answer of: http://stackoverflow.com/q/23958814
has comment: http://stackoverflow.com/comment/52094675
answers question: http://stackoverflow.com/q/23958814
has comment: http://stackoverflow.com/comment/123292029

http://stackoverflow.com/q/23983276
tagged with: java
score: -1
has title: Android get GPS coords in Async method
type: Question
has answer: http://stackoverflow.com/a/23983850
answer count: 2
upvote count: 0
tagged with: android
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
downvote count: 1
tagged with: gps
has answer: http://stackoverflow.com/a/23983309
has body: i have MainActivty and MyLocationListener classes. MyLocationListener extends AsyncTask implements LocationListener.. Here is code of the Location Listener Class: private class MyLocationListener extends AsyncTask implements LocationListener { @Override public void onLocationChanged(Location location) { // convert coords from double to string String lat = Double.toString(location.getLatitude()); String lon = Double.toString(location.getLongitude()); Log.i(AppHelper.APP_LOG_NAMESPACE, "lat " + lat); Log.i(AppHelper.APP_LOG_NAMESPACE, "lon " + lon); // save actual position into shared preferences storage _appPrefs = new AppPreferences(activityContext); _appPrefs.saveSomeString("lat", lat); _appPrefs.saveSomeString("lon", lon); getAddressByCoords(location.getLatitude(), location.getLongitude()); setPositionToView(activityContext, mView); } /** * Method get string representation of the place in given coords * * @param lat * double * @param lon * double * @return List &lt;Address&gt; * @throws Exception */ public List&lt;Address&gt; getAddressByCoords(double lat, double lon) { Geocoder gCoder = new Geocoder(activityContext); try { addresses = gCoder.getFromLocation(lat, lon, 1); if (addresses != null &amp;&amp; addresses.size() &gt; 0) { Log.d("APP", "LOCATION " + addresses.get(0).getAddressLine(0)); Log.d("APP", "LOCATION " + addresses.get(0).getAddressLine(1)); Log.d("APP", "LOCATION " + addresses.get(0).getAddressLine(2)); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return addresses; } @Override public void onStatusChanged(String provider, int status, Bundle extras) { Toast.makeText(MainActivity.this, provider + "'s status changed to " + status + "!", Toast.LENGTH_SHORT).show(); } @Override public void onProviderEnabled(String provider) { Toast.makeText(MainActivity.this, "Provider " + provider + " enabled!", Toast.LENGTH_SHORT) .show(); } @Override public void onProviderDisabled(String provider) { Toast.makeText(MainActivity.th…

http://stackoverflow.com/a/23958244
has body: If the OU is a sub tree, use that as the base of the search. If it's an attribute, search on (&amp;(objectClass=person)(ou=Users)) Your 'memberOf' search should also work if the memberOf attribute is maintained and up to date, but you need to specify the full DN of Users, not juste RDN.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23957177

http://stackoverflow.com/comment/37171208
comment on: http://stackoverflow.com/a/24095697
score: 0
type: AnswerComment
type: Comment
has text: Fixed it! I did not use a GsonBuilder.excludeFieldsWithoutExposeAnnotation();

http://stackoverflow.com/comment/37185866
type: QuestionComment
comment on: http://stackoverflow.com/q/24063357
has text: @alex1111 seems that you have found another solution, for try to double check the value of `name.of.the.package.OldClassName` and `name.of.the.package.NewClassName` and retry again :)
score: 0
type: Comment

http://stackoverflow.com/comment/37017411
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23993052
has text: I usually use Scala for those solutions. It is compatible with Java, runs on the same VM and is far more efficient.
type: AnswerComment

http://stackoverflow.com/a/24058381
type: Answer
answers question: http://stackoverflow.com/q/24057886
score: 2
downvote count: 0
upvote count: 2
has body: Try this DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); HSSFCell myCell; myCell.setCellValue(dateFormat.format("2014.01.31 14:24:28"));

http://stackoverflow.com/a/24095547
score: 2
has comment: http://stackoverflow.com/comment/37172803
has comment: http://stackoverflow.com/comment/37170513
has body: Could you post the code of the Main.get_ui_font() method? The task to draw the borders of JFrames and JDialogs windows is delegated to an external windowing system so I'm not so sure you can easly change them. Furthermore: Frame.font is not a valid key. TitledBorder.font has nothing to do with the titles in JFrames, take a look to the documentation. OptionPane.font changes the font of the message inside the OptionPane Anyway, for change a font with UIManager.put() you should give as parameters the key and a FontUIResource. So, I'm not sure what your Main.get_ui_font() returns, but considereng the constructors of FontUIResource -- FontUIResource(Font font) and FontUIResource(String name, int style, int size) -- if returns Font than use 1; otherwise, if your method returns FontUIResource, use 2. UIManager.put("key", new FontUIResource(Main.get_ui_font())); UIManager.put("key", Main.get_ui_font()); Remember also that if you want to use a "non standard" font you should register it before to use it. For this use GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(..)
has comment: http://stackoverflow.com/comment/37171608
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24094284

http://stackoverflow.com/comment/37054129
has text: Although the code now outputs a lot of crap i am not able to read - so yet to be fixed
type: AnswerComment
comment on: http://stackoverflow.com/a/24033725
score: 0
type: Comment

http://stackoverflow.com/comment/37105162
score: 1
comment on: http://stackoverflow.com/q/24062104
type: QuestionComment
type: Comment
has text: I don't exactly understand what you are asking. If you have a `Button` in your list that performs some action than of course you need to set a click listener on it. But if the whole list item itself is clickable than you should use `listView.setOnItemClickListener(...);`.

opengl-es-2.0
tags question: http://stackoverflow.com/q/24069880
tag name: opengl-es-2.0
tags question: http://stackoverflow.com/q/23955242
tags question: http://stackoverflow.com/q/24028320
type: Tag

http://stackoverflow.com/comment/48334890
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24079913
has text: I have the same issue and do not find informations on what to do. Can somebody help with infos or a link to infos?

http://stackoverflow.com/comment/37005150
type: QuestionComment
comment on: http://stackoverflow.com/q/24009725
has text: Because I need to use SWT in 32bit mode as my app embed a browser control that needs to use a plugin that it is currently available in 32 bit mode
score: 0
type: Comment

http://stackoverflow.com/a/53866886
downvote count: 0
has body: ArrayDeque are faster in the stack than a Stack or LinkedList. "push()" inserts elements at the front of the Deque protected &lt;T&gt; Stream&lt;T&gt; reverse(Stream&lt;T&gt; stream) { ArrayDeque&lt;T&gt; stack = new ArrayDeque&lt;&gt;(); stream.forEach(stack::push); return stack.stream(); }
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24010109

http://stackoverflow.com/comment/36921986
type: AnswerComment
type: Comment
has text: Of course, I just copied the code from another page.
score: 0
comment on: http://stackoverflow.com/a/23964946

http://stackoverflow.com/a/24011879
answers question: http://stackoverflow.com/q/24011843
has comment: http://stackoverflow.com/comment/37008995
has comment: http://stackoverflow.com/comment/37061109
has body: extRight(args) // extRight() expects an int, you are passing a String[] check public static void extRight(int x) { // expecting int. Also int s = extRight(args); --&gt; this method returns nothing i.e, void x = x % 10; //initially tried `x % 10;` }
has comment: http://stackoverflow.com/comment/37008873
has comment: http://stackoverflow.com/comment/37061636
has comment: http://stackoverflow.com/comment/37060536
has comment: http://stackoverflow.com/comment/37060726
score: 0
has comment: http://stackoverflow.com/comment/37060668
type: Answer
has comment: http://stackoverflow.com/comment/37009098

http://stackoverflow.com/q/23995646
has answer: http://stackoverflow.com/a/23995693
has body: I have trouble counting the rows of my sqltable. Using just the query in MS Studio works fine but when I try in Java I get an sql exception: Connection con = null; Statement stat = null; int result = 0; int i; try { con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;user=sa;password=123456; databaseName=RPA;"); stat = con.createStatement(); result = stat.executeUpdate("select count(*) FROM RPA_Users"); }catch (SQLException e) { System.out.println("cannot connect!"); e.printStackTrace(); } finally { if (con != null) { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } } } return result; Could someone explain me what I'm doing wrong? Thanks in advance EDIT: Nevermind I already found it guys, thanks as usual for the help! My solution if someone is interested: result = stat.executeQuery("select count(*) FROM /tablename/"); result.next(); rowCount = result.getInt(1);
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/23996192
has comment: http://stackoverflow.com/comment/36978823
has comment: http://stackoverflow.com/comment/36978403
tagged with: java
linked to: http://stackoverflow.com/q/8066501
type: Question
has answer: http://stackoverflow.com/a/23995766
has comment: http://stackoverflow.com/comment/36979359
score: 0
answer count: 3
tagged with: sql
has title: Counting rows sql table with jdbc

http://stackoverflow.com/a/24046929
has comment: http://stackoverflow.com/comment/37074816
has body: Historically, switch statements were/could be implemented as jump tables (i.e. a mapping of value to destination address). Depending on the implementation of the table, it may be impossible to have two entries for the same value pointing to different addresses. Even if it were possible, how would you handle that duplicate value? Return from the first handler and then go to second handler? Never execute the second handler? It makes no sense to allow this.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24046801

http://stackoverflow.com/comment/37129376
comment on: http://stackoverflow.com/a/24076635
has text: Great. But how would I implement the fileWrite() method to work on button click?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37153510
has text: No happiness - I can't figure it out. Thank you all who tried to help.
comment on: http://stackoverflow.com/q/24087433
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24024599
has title: reading messages from MQ using java
tagged with: tomcat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37033501
has comment: http://stackoverflow.com/comment/37033451
tagged with: java
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/24024685
type: Question
has body: I need some design and developments inputs on reading messages from queue. i have following requirements and constraints i need read message from queue and inert to db. messages can come at any interval (100's at same time or 1 by one with few mins gap) don't have any MDB container to host (just plain tomcat server) Need to write java application to perform the above. so not very sure how to put this simple application. if is use quartz scheduler to trigger job to read all messages in the queue then not sure before even that complete next instance of scheduler might start and create problem. please suggest me any inputs. this is basically some utility so i don't want to spend too long time nor too much resources on this. thanks &amp; regards LR
score: 0
tagged with: mq
answer count: 1

http://stackoverflow.com/comment/105580553
type: Comment
score: 0
type: AnswerComment
has text: I found `TargetSdkVersion No Longer Supported: Google Play requires that apps target API level 26 or higher.` in my log, i.e. can't set `targetSdkVersion` 25.
comment on: http://stackoverflow.com/a/58240282

http://stackoverflow.com/q/23954581
has comment: http://stackoverflow.com/comment/36901827
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/19154202
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23957336
favorite count: 0
has body: Is there any way to connect DAO files to Servlet.Once Connected we need to get all the database connections in the JSP files used in same project. I tried this but i cannot connect to DAo.
has answer: http://stackoverflow.com/a/23955888
accepted answer: http://stackoverflow.com/a/23955888
has comment: http://stackoverflow.com/comment/36901393
possible better answer: http://stackoverflow.com/a/23957336
downvote count: 1
has title: Code to call DAO file in servlet
type: AnsweredQuestion

http://stackoverflow.com/comment/37159534
type: AnswerComment
score: 0
type: Comment
has text: The new result is ok !!
comment on: http://stackoverflow.com/a/24092580

http://stackoverflow.com/a/24073031
has comment: http://stackoverflow.com/comment/37122779
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37122786
upvote count: 2
answers question: http://stackoverflow.com/q/24072926
has body: Why not be simple about it?: List&lt;Car&gt; cars = new ArrayList&lt;&gt;(carMap.values()); HashMap#values() returns a Collection&lt;T&gt; which you can then supply directly to the ArrayList constructor.
downvote count: 0

http://stackoverflow.com/q/24096545
type: UnansweredQuestion
has body: I'm having trouble when reading to a file, I can get it to read all lines but uses the fist piece of info from the next line or it will add a blank line at the end confusing the array of constructors. import java.io.*; import java.util.*; public class StudentMain { /** * @param args */ //(String fn, String ln, String pn, int id, boolean ft, int phn, boolean lj, String con) //array and sorting variables public static studentConstructor[] stuArrayOrig; private static String[] stuArrayIdSort; private static String[] stuArrayNameSort; private static int i = 0; private static int lineCount = 0; private static int nElms = 0; //studentConstructor variables public static String fn; //First Name public static String ln; //Last Name public static String pn; //Preferred Name public static int id; //Student Id Number public static boolean ft;//Full-time Boolean public static int phn; //Student Phone Number public static boolean lj;//Loving java Boolean public static String con;//Continuing public static void StuRead() { Scanner inFile = null; try { inFile = new Scanner (new FileReader("Res/students.txt")); } catch (FileNotFoundException e) { // TODO Auto-generated catch block System.out.println("File Not Found"); e.printStackTrace(); } while (inFile.hasNextLine()){ inFile.useDelimiter(",|\\n"); //breaks the lines into single info ln = inFile.next(); System.out.println(ln); fn = inFile.next(); System.out.println(fn); pn = inFile.next(); System.out.println(pn); id = inFile.nextInt(); System.out.println(id); ft = inFile.nextBoolean(); System.out.println(ft); phn = inFile.nextInt(); System.out.println(phn); lj = inFile.nextBoolean(); System.out.println(lj); con = inFile.next(); System.out.println(con); studentConstructor st = new studentConstructor(ln, fn, pn, id, ft, phn, lj, con); System.out.println(st); //System.out.println("LINE"); stuArrayOrig[lineCount] = st; inFile.nextLine(); System.out.println(stuArrayOrig[lineCount]); lineCount++;` Example input from file: Angelon Arouca,…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24096590
type: Question
upvote count: 1
tagged with: arrays
downvote count: 0
answer count: 1
has title: Getting blank line when reading from file into a constructor
has comment: http://stackoverflow.com/comment/37166880
favorite count: 0
tagged with: constructor

http://stackoverflow.com/q/23952508
has body: While writing my own custom MultiHashMap, multiTreeMap etc. classes (yes, I know these are available in Guava Library, but I needed to provide some different functionalities, so I completely rewrote these from scratch) I came across the need to write an equals() method that could compare any MultiMap, returning true if and only if the entrySet's of two MultiMaps are equivalent (same key-value mappings, regardless of the order). As I hold the multi-values in an ordinary Map I compared my own method with API method java.util.AbstractMap.equals(), and they turned out to be pretty similar, except that I didn't use any try/catch (Java 7): public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Map)) return false; Map&lt;K,V&gt; m = (Map&lt;K,V&gt;) o; if (m.size() != size()) return false; try { Iterator&lt;Entry&lt;K,V&gt;&gt; i = entrySet().iterator(); while (i.hasNext()) { Entry&lt;K,V&gt; e = i.next(); K key = e.getKey(); V value = e.getValue(); if (value == null) { if (!(m.get(key)==null &amp;&amp; m.containsKey(key))) return false; } else { if (!value.equals(m.get(key))) return false; } } } catch (ClassCastException unused) { return false; } catch (NullPointerException unused) { return false; } return true; } The caught exceptions are RuntimeException's and beside that I can't really figure out under which circumstances they may occur. Any hint ?
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/23952703
has title: java.util.AbstractMap.equals() : what is it for try/catch?
answer count: 3
has answer: http://stackoverflow.com/a/23952758
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25972280

http://stackoverflow.com/comment/36994125
type: Comment
comment on: http://stackoverflow.com/a/23990661
has text: No, it could equivalently `throws` IAE and other unchecked exceptions (and errors, for that matter), but that was not my point anyway (and is irrelevant from the point of view of Java/javac/JVM). Throwing IAE in this case is just adhering to the put() contract with "the" pertinent exception - I don't see it as a "last resort", as the "your only option" wording implies that other options would be preferable.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37117665
score: 1
has text: Why not define a helper class to encapsulate your limits and score delta, stick a bunch in an array, and then just loop?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24070069

alpha-transparency
type: Tag
tag name: alpha-transparency
tags question: http://stackoverflow.com/q/23954634

http://stackoverflow.com/a/24085315
has comment: http://stackoverflow.com/comment/62314286
has comment: http://stackoverflow.com/comment/114840689
upvote count: 4
has comment: http://stackoverflow.com/comment/40276404
accepted answer of: http://stackoverflow.com/q/24085290
score: 4
has body: Sublime Text is a text editor, not an IDE. You'll need to compile it from command line using javac File.java. And it won't highlight errors for you. If you want a simpler text editor how Java, consider jGrasp or NetBeans.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40277089
answers question: http://stackoverflow.com/q/24085290
type: Answer

jung
tags question: http://stackoverflow.com/q/24061404
type: Tag
tags question: http://stackoverflow.com/q/23978746
tag name: jung

http://stackoverflow.com/comment/36937217
has text: TCP is not completely reliable. It will very rarely lose data, but it absolutely does loose data every now and then without reporting any error. How frequent depends on your connection type - with CAT6 Ethernet it will pretty much never happen, with copper phone lines it can happen fairly often. If you have a faulty router somewhere it might happen several times each day.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23973876
type: AnswerComment

http://stackoverflow.com/q/24034244
tagged with: java
answer count: 1
tagged with: quickbooks
score: 0
has title: Unable to update 2 domains at the same time in quickbook via QBWC
has body: i need to update customer &amp; vendor in quickbook at once but i got error. //Here my code package com.company.product.wsai.qb.ws.endpoint; import java.io.StringWriter; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.RequestPayload; import org.springframework.ws.server.endpoint.annotation.ResponsePayload; import com.intuit.developer.SendRequestXML; import com.intuit.developer.SendRequestXMLResponse; import com.intuit.quickbooks.CurrencyAdd; import com.intuit.quickbooks.CurrencyAddRqType; import com.intuit.quickbooks.CustomerAdd; import com.intuit.quickbooks.CustomerAddRqType; import com.intuit.quickbooks.CustomerTypeAdd; import com.intuit.quickbooks.CustomerTypeAddRqType; import com.intuit.quickbooks.VendorAdd; import com.intuit.quickbooks.QBXML; import com.intuit.quickbooks.QBXMLMsgsRq; import com.intuit.quickbooks.VendorAddRqType; import com.company.product.wsai.qb.ws.conf.XmlConfig; import com.company.product.wsai.qb.ws.util.XmlLogManager; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; @Endpoint public class SendRequestXMLEndpoint { // xml logging private static final String SEND_REQUEST_XML = "sendRequestXML"; private static final String SEND_REQUEST_XML_RESPONSE = "sendRequestXMLResponse"; @Autowired com.intuit.developer.ObjectFactory wsObjectFactory; @Autowired com.intuit.quickbooks.ObjectFactory qbObjectFactory; @PayloadRoot(localPart = "sendRequestXML", namespace = XmlConfig.QB_WC_NAMESPACE) @ResponsePayload public SendRequestXMLResponse sendRequestXML(@RequestPayload SendRequestXML sendRequestXML) { String sessionTicket = sendRequestXML.getTicket(); String strCompanyFileName = sendRequestXML.getStrCompan…
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
type: Question
has answer: http://stackoverflow.com/a/24035338
tagged with: qbwc

http://stackoverflow.com/comment/37302097
has text: thanks buddy a lot fr helping me.. I was about to thank you...i had already handled that alert...it worked...same instance... god bless.. :D
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23977179
type: AnswerComment

http://stackoverflow.com/comment/37002783
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24007943
has text: Tried it..but no use. I feel that this might be something related to Fragmented heap space of jvm.

http://stackoverflow.com/comment/37033971
type: AnswerComment
comment on: http://stackoverflow.com/a/24023466
type: Comment
has text: So basically just adding each byte individually. Such a simpel answer and something similar could be done for the operations. I did a performance test and came up with 4876ms vs 342ms (your solution) with 10000000 iterations. This seems significatly faster, contrary to what people say about BigInteger already being optimized. I'll have to double check the results, but this is pretty much exactly what I was looking for. Did you write this yourself or is there an open source implementation of these types of operations somewhere?
score: 0

http://stackoverflow.com/a/24036772
type: Answer
has body: Seems like my issue is similar to this one: How can I map "insert='false' update='false'" on a composite-id key-property which is also used in a one-to-many FK? @JoinColumn(name="PRODUCT_ID", referencedColumnName = "PRODUCT_ID", insertable = false, updatable = false)
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/24019427
upvote count: 3

http://stackoverflow.com/q/23952773
has comment: http://stackoverflow.com/comment/36898383
tagged with: service
has comment: http://stackoverflow.com/comment/36898305
type: UnansweredQuestion
tagged with: gps
has answer: http://stackoverflow.com/a/23952920
tagged with: java
has title: Locations updates stay active when Android app is not longer active
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23957442
has comment: http://stackoverflow.com/comment/36901953
score: 0
tagged with: android
has body: I have the following problem: I send in regular interval GPS data from the mobile to a server. In fact I want this background service only running as long the user is willing to submit data. There should be some sort of confirmation dialog that from now on data are submitted and then these submissions should be active - event if the App is shutdown meanwhile - until the user again confirms that data should be no longer sended: Here is my current entry in the AndroidManifest.xml: .... &lt;receiver android:name="ch.bbcag.jumpin.app.receiver.gps.ConnectivityReceiver" android:process=":gps_process" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt; &lt;action android:name="android.intent.action.USER_PRESENT" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;receiver android:name="ch.bbcag.jumpin.app.service.LocationUpdaterService" android:process=":gps_process" /&gt; &lt;service android:name="ch.bbcag.jumpin.app.service.LocationUpdaterService" android:process=":gps_process" /&gt; .... GcmIntentService.java: public class ConnectivityReceiver extends BroadcastReceiver { private static final int EXEC_INTERVAL = AppConstants.GPS_REPEAT_SECONDS * 1000; private final static String TAG = "ch.bbcag.jumpin.app.receiver.gps.ConnectivityReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received event"); final AlarmManager alarmManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); final PendingIntent wakeupIntent = PendingIntent.getService(context, 0, new Intent(context, LocationUpdaterService.class), PendingIntent.FLAG_UPDATE_CURRENT); final boolean hasNetwork = !intent.getBooleanExtra( ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); if (hasNetwork) { context.startService(new Intent(context,LocationUpdaterService.class)); Calendar now = Calendar.getInstance(); now.add(Calendar.SECOND, AppConstants.GPS_REPEAT_SECONDS); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, now.g…

http://stackoverflow.com/q/24028397
has title: how to make button stick to one place when resizing window in java swing?
tagged with: layout-manager
accepted answer: http://stackoverflow.com/a/24028418
duplicate of: http://stackoverflow.com/q/10764798
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24028418
favorite count: 0
upvote count: 1
tagged with: swing
has body: I am designing a frame in java swing, which has 2 buttons on the end as I resize the window the gap between buttons are spread and they go far. Please provide me solution as i want buttons to be in the bottom corner and the frame is resized the spaces should not increase.
tagged with: jbutton
linked to: http://stackoverflow.com/q/10764798
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37040262
tagged with: layout

http://stackoverflow.com/a/24100717
score: 1
has body: First, your before advice could throw a runtime exception that could eventually be catched by caller. And if the usage of exception is not an option, you will have to use an around advice.
answers question: http://stackoverflow.com/q/24099666
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/23980318
type: Question
accepted answer: http://stackoverflow.com/a/24171630
has comment: http://stackoverflow.com/comment/36949840
downvote count: 0
answer count: 1
has title: Netbeans (OS X) hangs each time when changing arguments
has body: Each time I change project command line arguments within Netbeans, it hangs the moment I click 'Ok'. I have the newest updated version of Netbeans (on newest OS X) and the newest version of Java. The problem occurs within a project with two custom built packages. An answer to this question should at least give an plausible explanation why this problem occurs. I'm anxious if any other people experience this exact same problem. This exact problem isn't mentioned yet in these lists: https://netbeans.org/bugzilla/buglist.cgi?quicksearch=hang https://netbeans.org/bugzilla/buglist.cgi?quicksearch=freeze By using StackOverflow I'm hoping to get a quick response.
favorite count: 0
has answer: http://stackoverflow.com/a/24171630
type: AnsweredQuestion
tagged with: netbeans
score: 1
has comment: http://stackoverflow.com/comment/36949575
tagged with: java
upvote count: 1

http://stackoverflow.com/q/24018250
has comment: http://stackoverflow.com/comment/37021247
has comment: http://stackoverflow.com/comment/37020642
has comment: http://stackoverflow.com/comment/37021468
tagged with: java
has title: null returned while converting data array to ImageInputStream
linked to: http://stackoverflow.com/q/5130553
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37020591
score: 2
has comment: http://stackoverflow.com/comment/37020944
has body: I don't understand why bigInputStream is null, even if data is set well. InputStream in = new ByteArrayInputStream(data); BufferedImage bufferedImage; bufferedImage = ImageIO.read(in); // next instruction has problem ImageInputStream bigInputStream = ImageIO.createImageInputStream(bufferedImage); Iterator&lt;ImageReader&gt; iter = ImageIO.getImageReaders(bigInputStream); if (!iter.hasNext()) { // thow exception here } ImageReader reader = iter.next();
downvote count: 0
has comment: http://stackoverflow.com/comment/37020867
tagged with: image
has comment: http://stackoverflow.com/comment/37023227
has comment: http://stackoverflow.com/comment/37021101
linked to: http://stackoverflow.com/q/11447035
has comment: http://stackoverflow.com/comment/37020688
has answer: http://stackoverflow.com/a/24018935
has comment: http://stackoverflow.com/comment/37021201
favorite count: 0
has comment: http://stackoverflow.com/comment/37021063
has comment: http://stackoverflow.com/comment/37021726
has comment: http://stackoverflow.com/comment/37020614
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37021018
has comment: http://stackoverflow.com/comment/37021965
has answer: http://stackoverflow.com/a/24036192

inputstream
tags question: http://stackoverflow.com/q/24052691
tags question: http://stackoverflow.com/q/24026409
tags question: http://stackoverflow.com/q/23997031
tags question: http://stackoverflow.com/q/23963159
tag name: inputstream
tags question: http://stackoverflow.com/q/24088659
type: Tag
tags question: http://stackoverflow.com/q/24066462
tags question: http://stackoverflow.com/q/23979912

http://stackoverflow.com/a/24045522
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37073073
accepted answer of: http://stackoverflow.com/q/24044847
has comment: http://stackoverflow.com/comment/37073408
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24044847
has comment: http://stackoverflow.com/comment/37072833
has comment: http://stackoverflow.com/comment/37073296
has body: I'm not exactly sure where it occurs...but it only happens when I add the second piece of code I listed in the original post I would add some null pointer checks to be safe. I suspect it's this part that is null: listView.getChildAt(listView.getChildCount() - 1) Try this: if (listView.getLastVisiblePosition() == listView.getAdapter().getCount() - 1 &amp;&amp; listView.getChildAt(listView.getChildCount() - 1) != null &amp;&amp; listView.getChildAt(listView.getChildCount() - 1).getBottom() &lt;= listView.getHeight()) { Toast.makeText(getApplicationContext(), "Bottom!", Toast.LENGTH_LONG).show(); } Just in case you want to take the extra leap of null pointer checks: if (listView != null &amp;&amp; listView.getAdapter() != null &amp;&amp; listView.getChildAt(listView.getChildCount() - 1) != null &amp;&amp; listView.getLastVisiblePosition() == listView.getAdapter().getCount() - 1 &amp;&amp; listView.getChildAt(listView.getChildCount() - 1).getBottom() &lt;= listView.getHeight()) { Toast.makeText(getApplicationContext(), "Bottom!", Toast.LENGTH_LONG).show(); }
type: Answer
has comment: http://stackoverflow.com/comment/37073317

http://stackoverflow.com/comment/100104783
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24092481
type: AnswerComment
has text: I am wondering why you had to lower the version of the hibernate validator? Is this required?

http://stackoverflow.com/q/24030030
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37043084
tagged with: maven
has comment: http://stackoverflow.com/comment/37043152
has answer: http://stackoverflow.com/a/24061669
has comment: http://stackoverflow.com/comment/37053272
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37043599
type: Question
has title: Maven not copying .class files to target while in building though build runs fine in Unix,but the same works in eclipse
has comment: http://stackoverflow.com/comment/37043933
score: 0
has comment: http://stackoverflow.com/comment/37053491
has comment: http://stackoverflow.com/comment/37043739
answer count: 1
has comment: http://stackoverflow.com/comment/37043112
has body: Hi I have the following pom configuration for the maven compiler plugin in my parent pom.xml below <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.test prj-parent 0.0.1-SNAPSHOT pom Parent Parent service web <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.7</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>4.0.4.RELEASE</spring.version> <spring-social.version>1.0.3.RELEASE</spring-social.version> <javax.validation.version>1.0.0.GA</javax.validation.version> <org.projectlombok.version>1.12.6</org.projectlombok.version> 1.7.5 <spring.security.version>3.2.1.RELEASE</spring.security.version> <jackson.version>2.2.2</jackson.version> 2.12.2 2.13.1 5.4.0 <junit.version>4.11</junit.version> <guava.version>14.0.1</guava.version> 28.0.0 2.6 11.2.0.3.0 <httpclient.version>4.3.1</httpclient.version> <mybatis-spring-version>1.2.2</mybatis-spring-version> <oracle.ucp.version>11.2.0.3</oracle.ucp.version> <org.hamcrest.version>1.3</org.hamcrest.version> <atomikos.version>3.9.3</atomikos.version> <spring-data-commons.version>1.8.0.RELEASE</spring-data-commons.version> <jta.version>1.1</jta.version> <rest-assured.version>2.3.1</rest-assured.version> org.apache.maven.plugins maven-compiler-plugin 3.1 ${java.version} ${java.version} ${project.build.sourceEncoding} true true <useIncrementalCompilation>false</useIncrementalCompilation> true org.apache.maven.plugins maven-dependency-plugin install install copy-dependencies org.apache.maven.plugins maven-eclipse-plugin 2.9 true true org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.apache.maven.plugins maven-antrun-plugin [2.4,) run org.apache.maven.plugins maven-dependency-plugin [2.1,) copy-dependencies </lifecycleMappingMetadata> maven-restlet Public online Restlet repo…

mongodb
tags question: http://stackoverflow.com/q/24079365
tags question: http://stackoverflow.com/q/24000813
tags question: http://stackoverflow.com/q/24051445
tags question: http://stackoverflow.com/q/24036096
tags question: http://stackoverflow.com/q/24003281
tag name: mongodb
tags question: http://stackoverflow.com/q/23961215
tags question: http://stackoverflow.com/q/23981036
tags question: http://stackoverflow.com/q/24022694
type: Tag
tags question: http://stackoverflow.com/q/23987988
tags question: http://stackoverflow.com/q/23992723
tags question: http://stackoverflow.com/q/24073241
tags question: http://stackoverflow.com/q/24075537
tags question: http://stackoverflow.com/q/23968401
tags question: http://stackoverflow.com/q/24037580
tags question: http://stackoverflow.com/q/24015337
tags question: http://stackoverflow.com/q/24056776
tags question: http://stackoverflow.com/q/24055669
tags question: http://stackoverflow.com/q/24064723
tags question: http://stackoverflow.com/q/24066432
tags question: http://stackoverflow.com/q/24100075
tags question: http://stackoverflow.com/q/24039423

http://stackoverflow.com/comment/36972676
comment on: http://stackoverflow.com/q/23991775
type: Comment
type: QuestionComment
has text: In your images, they look like they're exactly the same so why do you need to subclass the BaseWindow class when you can just call ```BaseWindow("Deposit")``` and ```BaseWindow("Withdraw")``` and simply use add a separate ActionListener to each BaseWindow's ```getExecuteButton()```?
score: 0

http://stackoverflow.com/q/24023668
score: 4
has answer: http://stackoverflow.com/a/24023857
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37032619
type: AnsweredQuestion
tagged with: java
has title: Is there a tool for identifying outdated/inconsistent JavaDoc comments?
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24023857
has body: I'm looking for a tool (or IDE feature) that can point out incorrect JavaDoc comments. That is, comments that have missing arguments, have the wrong name for arguments, don't document thrown exceptions, etc. I'm aware that there wouldn't be a perfect tool, since a tool can't tell us if the documentation is correct, but I'm hoping that identifying more obvious errors can at least help catch some incorrect JavaDoc comments. Preferably this tool would have the means of ignoring simple getters and setters (I often don't include a @returns on getters, for example, because their summary details everything you'd need to know).
downvote count: 0
tagged with: ide

http://stackoverflow.com/comment/37182588
score: 0
type: Comment
type: QuestionComment
has text: @drewmore if you have a non-abstract subclass of `AbstractRow`, you can do `T t = (T) new SubClassName();`
comment on: http://stackoverflow.com/q/24104094

http://stackoverflow.com/a/23990101
score: 0
type: Answer
has body: You are accessing the boolean array from within the main method which is static, and hence you either need to create an object inside main for the class Risk and then use that object to access the array or you need to declare the array itself as static, based on your need. You can read what static means in java in this link.
answers question: http://stackoverflow.com/q/23990068

http://stackoverflow.com/a/24044476
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24042908
downvote count: 0
has body: I could not find a specific reference but I believe that "/*" root url pattern conflicts with the default mapping in the the global web.xml which could be contributing to your problem. default org.apache.catalina.servlets.DefaultServlet debug 0 listings false 1 default / try adding explicit jsp servlet tag and servlet mapping to avoid processing the jsp through the default mapping which is created with the "/" root url pattern. I'm not sure that this will solve your problem. showpage /pages/show.jsp showpage /show Another more explicit solution would be to create a url pattern that differentiates all of the country geo requests. MyServlet /geo/* So example.com/geo/us etc will map explicitly I attempted the same global setting and had a similar problem where it recursively attempted the request and threw an exception over and over until I stopped the Tomcat server. The problem was resolved when used more specific url pattern.
type: Answer

http://stackoverflow.com/q/24038802
type: Question
linked to: http://stackoverflow.com/q/7212064
tagged with: xsd
upvote count: 6
has title: Generate a XSD from a JAXB-annotated class without using File
has answer: http://stackoverflow.com/a/24041280
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
tagged with: jaxb
answer count: 1
accepted answer: http://stackoverflow.com/a/24041280
score: 6
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I am trying to generate XSD from Java Annotated classes by following code mentioned in this post Is it possible to generate a XSD from a JAXB-annotated class JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); SchemaOutputResolver sor = new MySchemaOutputResolver(); jaxbContext.generateSchema(sor); public class MySchemaOutputResolver extends SchemaOutputResolver { public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { File file = new File(suggestedFileName); StreamResult result = new StreamResult(file); result.setSystemId(file.toURI().toURL().toString()); return result; } } This technique is using File system, My requirement is to get the XML as String without using file system. Is there any possibility the Implementation of SchemaOutputResolver may not write file to disk and return or set some instance variable with the String value.

http://stackoverflow.com/a/23997463
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The problem is here: java.sql.Date date = new java.sql.Date(javaDate.getTime()); java.sql.Date stores the date part of your timestamp. If you want/need to handle both date and time, use java.sql.Timestamp instead: java.sql.Timestamp date = new java.sql.Timestamp (javaDate.getTime()); More info: Date vs TimeStamp vs calendar?
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/23997301
has comment: http://stackoverflow.com/comment/36982509
accepted answer of: http://stackoverflow.com/q/23997301

http://stackoverflow.com/a/24080196
has comment: http://stackoverflow.com/comment/37135676
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24080165
has body: Building project(eclipse) doesn't automatically convert java to java script. In order to see changes you need to compile your project. Not clean&amp;Build. When ever you compile , then only java code converts to GWT.
has comment: http://stackoverflow.com/comment/37135575
has comment: http://stackoverflow.com/comment/37135698

http://stackoverflow.com/q/23963150
upvote count: 2
tagged with: swing
has title: Show the line numbers when the JScrollBar is moved
has answer: http://stackoverflow.com/a/23963932
tagged with: java
score: 2
answer count: 1
tagged with: user-interface
downvote count: 0
has body: In a linux text editor, Kate, there is this nice functionality that when I click and drag the scroll bar it shows the current line numbers that are currently in view in the text component. My question is how can I add this function in Java to my scroll pane containing a JTextArea. Which component can I use to show this notification?
accepted answer: http://stackoverflow.com/a/23963932
type: Question
type: AnsweredQuestion
favorite count: 0

http://stackoverflow.com/a/24103188
type: Answer
score: 1
upvote count: 1
has body: It means that the two objects you are trying to compare can never be equal because their types are not convertible to each other. According to JLS 15.21.3, It is a compile-time error if it is impossible to convert the type of either operand to the type of the other by a casting conversion (§5.5). The run-time values of the two operands would necessarily be unequal. There is no difference between type and class in this context. Do not try to compare two objects that are not convertible to one another. In this case you are comparing Class&lt;CAP#1&gt; with Class&lt;staticParent&gt;. However, if you wanted to "fix" the error, you could use .equals instead, with the understanding that it would always return false. System.out.println(thisobj.getClass().equals(staticParent.class));
downvote count: 0
answers question: http://stackoverflow.com/q/24103122

http://stackoverflow.com/comment/37119985
comment on: http://stackoverflow.com/q/24070917
score: 0
has text: From your given code: 1) Use HTML 5, looks like you're lost in web technology since 2011 (no need of that `"blah..."` senseless code). 2) You need to add ` `s next to each ` ` in your view that will display the error messages for clients. 3) Use Servlet 3.0 or more, so you may take advantage of annotation configuration rather than tedious XML through web.xml. 4) You absolutely don't want to perform such validations in a common POST-FORWARD request, instead using ajax request for a better look-n-feel for your clients.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/67404433
type: Comment
has text: Are you sure curly brackets are unnecessary here? I'm not expert in Java, but in JavaScript and C++ that's not the case.
type: AnswerComment
comment on: http://stackoverflow.com/a/40064691
score: 0

http://stackoverflow.com/comment/47290575
type: Comment
has text: @Todd Anderson can you provide sample application for facebook button widget and login
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24066426

http://stackoverflow.com/comment/36986815
score: 0
comment on: http://stackoverflow.com/q/23998167
type: QuestionComment
type: Comment
has text: If you're generating XML, I'd *consider* XSLT.

http://stackoverflow.com/comment/37095441
type: Comment
has text: Have u tried a Collections.sort().. Pass in a comparator that first makes the string lowercase or uppercase and compares
score: 0
comment on: http://stackoverflow.com/q/24058255
type: QuestionComment

http://stackoverflow.com/a/32999669
type: Answer
answers question: http://stackoverflow.com/q/24104880
upvote count: 2
has comment: http://stackoverflow.com/comment/53824803
has comment: http://stackoverflow.com/comment/59485041
score: 2
has comment: http://stackoverflow.com/comment/59485287
has comment: http://stackoverflow.com/comment/53824467
downvote count: 0
has body: I got stucked on the same point, So I used "Vectors" We all know using Arraylist is much better approach when considering the implementations of Vectors.But when working with jTables, by default you got some easy methods to mange the data flow and fill into the jTable which will ease the coding. So if you have less experiance in coding these scenarios like me, I suggest to use Vectors. Just have to import this and bit of code. import java.util.Vector; To learn, how to use Vectors to work with ResultSet refer this

http://stackoverflow.com/comment/37175135
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24100867
score: 0
has text: See this SO post http://stackoverflow.com/questions/11949248/calling-getintent-method-in-service?rq=1

http://stackoverflow.com/comment/37102431
type: AnswerComment
has text: Thanks a lot for your help. It works perfectly just as I hope it would.
type: Comment
comment on: http://stackoverflow.com/a/24062082
score: 0

http://stackoverflow.com/comment/57005289
type: AnswerComment
score: 0
type: Comment
has text: awesome and simple. Is this from some opensource utilty? (the Estreams thing) or some piece of your code?
comment on: http://stackoverflow.com/a/34621495

http://stackoverflow.com/q/24080321
has comment: http://stackoverflow.com/comment/37140923
tagged with: android
has answer: http://stackoverflow.com/a/24135780
score: 0
tagged with: java
tagged with: overlay
answer count: 1
tagged with: touch-event
type: UnansweredQuestion
has title: How to create a resizable rectangle with user touch events on google map Android?
linked to: http://stackoverflow.com/q/23954209
has body: I am beginner in google map. I want to Draw rectangle with choosing the top left and bottom right coordinates on google map. can anyone provide me example to work with.? Thanks in advance
type: Question
tagged with: android-framelayout

http://stackoverflow.com/a/24037454
has comment: http://stackoverflow.com/comment/37058479
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: The problem is that what you are trying to do works only once. You need to place that logic (and add some more) into a loop. This should do what you need: String Lab = "thorax1 [00400 - 00479]" + "su [00100 - 0022200su] " + "head1 [00100 - 00228] " + "head1 [00100 - 00228] " + "thorax1 [00400 - 00479] " + "lab66 [lab661]"; int first = 0; int last = 0; while(true) { first = Lab.indexOf("[", first) + 1; last = Lab.indexOf("]", first); if(first &lt;= 0) { break; } System.out.println(Lab.substring(first, last)); } Yields: 00400 - 00479 00100 - 0022200su 00100 - 00228 00100 - 00228 00400 - 00479 lab661
has comment: http://stackoverflow.com/comment/37059318
accepted answer of: http://stackoverflow.com/q/24037175
score: 2
answers question: http://stackoverflow.com/q/24037175
downvote count: 0

http://stackoverflow.com/comment/36947407
type: Comment
comment on: http://stackoverflow.com/a/23978923
has text: I call that function each time when I call setX function
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37136468
type: AnswerComment
comment on: http://stackoverflow.com/a/24024605
type: Comment
has text: I have another problem with my first application I put a button in the form but when I press it it didn't work can u help me,plz??? if u say yes I'll upload my app so u can see it
score: 0

http://stackoverflow.com/comment/36928067
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23968369
type: Comment
has text: can I make several view in my game?

http://stackoverflow.com/comment/37142155
score: 1
comment on: http://stackoverflow.com/q/24083697
type: Comment
type: QuestionComment
has text: What is the result and what you expect?

http://stackoverflow.com/q/23979112
has title: access remote hbase in java,masterNotRunning
tagged with: java
has comment: http://stackoverflow.com/comment/57011862
type: Question
tagged with: hadoop
has body: Recently, need to use HBase as a database, so want to research hbase. But recently encountered a problem, many days did not find the answer. First describe my machine. A common PC, system win7, in the win7 installed a virtual machine, virtual machines running ubuntu10, with Hadoop and HBase, they all run successfully. HBase shell and JAVA API in the virtual machine operate HBase successfully. But the problem is that I want to access hbase use the PC machine in the JAVA API (win7) , then failed. Hbase-site.xml is as follows hbase.cluster.distributed false hbase.tmp.dir /opt/tmp hbase.rootdir hdfs://192.168.235.134:9000/hbase hbase.zookeeper.quorum 192.168.235.134 /etc/hosts is as follows 192.168.235.134 localhost ubuntu # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts PC (win7) JAVA API hbase-site.xml as follows hbase.cluster.distributed false hbase.rootdir hdfs://192.168.235.134:9000/hbase hbase.zookeeper.quorum 192.168.235.134 PC JAVA code is as follows. HBaseAdmin.checkHBaseAvailable (HBaseConfiguration.create ()); The following error: Org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.net.ConnectException: Connection refused: no further information In fact, I had look the source code, found in the zookeeper to obtain master address always returns localhost, the issue should be in this. The source code as follows. HConnectionManager.java private Object makeStubNoRetries() throws IOException, KeeperException, ServiceException { ZooKeeperKeepAliveConnection zkw; try { zkw = getKeepAliveZooKeeperWatcher(); } catch (IOException e) { ExceptionUtil.rethrowIfInterrupt(e); throw new ZooKeeperConnectionException("Can't connect to ZooKeeper", e); } try { checkIfBaseNodeAvailable(zkw); !----here always return localhost-----------------------! ServerName sn = MasterAddressTra…
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23989870
favorite count: 0
upvote count: 2
tagged with: hbase
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36956302

http://stackoverflow.com/comment/36954376
score: 0
has text: Ok, i edited it ;-) Please, have a look now. Thank you so much :-)
type: Comment
comment on: http://stackoverflow.com/q/23981858
type: QuestionComment

http://stackoverflow.com/comment/36978865
type: Comment
comment on: http://stackoverflow.com/a/23966531
has text: Thanks [@dened], but I need only the last created file like MAX(archive_file.created), this query don't works for me.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36986948
score: 0
has text: simply post the query at the server side and send back the result back to the client in simple HTML.
type: QuestionComment
comment on: http://stackoverflow.com/q/23999851
type: Comment

http://stackoverflow.com/comment/36897087
type: Comment
type: QuestionComment
score: 0
has text: The author of Total Commander does not give a full working example of writing to a file on the sdcard. He only gives an example to let the mediaschanner deliver an InputStream to you. At that moment the file is created but still 0 bytes. Then you try to write bytes to that stream. I think it fails because the stream does not belong to you so you cannot use it. Ask the author if he ever could in this way. Think you should let the resolver write to that stream.
comment on: http://stackoverflow.com/q/23946664

http://stackoverflow.com/comment/36914826
type: AnswerComment
comment on: http://stackoverflow.com/a/23958289
has text: Like I would do: gl_Position = position * HEIGHT / WIDTH , where position is like: layout(location = 0) in vec4 position, or something along those lines. Would the position array be automatically transferred from the glVertexAttribPointer() into the vertex shader?
score: 0
type: Comment

http://stackoverflow.com/a/24041667
upvote count: 2
has body: You are currently setting your count variable to 0. You should set it to the value that's in the file. Do this just before the while loop: count = f.readFromFile(); while(true) { You should also implement a way to gracefully exit the while loop. For example, if the user enters "q", you can execute the break; statement to exit the while loop. And after your while loop, call key.close(); to close the Scanner object.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24041576
answers question: http://stackoverflow.com/q/24041576
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/comment/37097325
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24058954
score: 0
has text: I hava a class which has a "size() method" for example, and each constructor has its different parameter like "Person(String [])", "Person(int [])" ... and when I new the object of this class and I want call the "size()", I think I hava to know which constructor I am using. (It's not just for getSize())

http://stackoverflow.com/comment/37148091
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24085699
has text: @LuiggiMendoza, I don't know what a _raw_ BlockingQueue is, but the example above uses an ArrayBlockingQueue.
type: AnswerComment

http://stackoverflow.com/comment/36897735
has text: I think my actual reason for this question was more along the lines of "what's the proper way to do it?" and "what syntax do I have to use, i.e. curly braces or not?" - haven't tried anything yet to be honest, as I wanted to hear what others would do and how it would be done "the proper way". I know I'd use curly braces to pass lists into annotations, but wasn't sure what it would look like for a command line argument like -D...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23951410
score: 0

http://stackoverflow.com/comment/49678987
type: AnswerComment
comment on: http://stackoverflow.com/a/25340415
type: Comment
has text: I was having the same problem with spring-boot-starter-jdbc. Tried this suggestion and it fixed my problem.
score: 3

http://stackoverflow.com/comment/37188232
comment on: http://stackoverflow.com/q/24104517
score: 0
type: QuestionComment
type: Comment
has text: It's really hard to understand what you're after. Maybe an example would help?

http://stackoverflow.com/a/24027101
has comment: http://stackoverflow.com/comment/37082460
has comment: http://stackoverflow.com/comment/37078083
type: Answer
answers question: http://stackoverflow.com/q/24023986
upvote count: 1
has body: Instead of duplicating the table, create an updatable view.
has comment: http://stackoverflow.com/comment/37051070
has comment: http://stackoverflow.com/comment/37038211
downvote count: 0
score: 1

javafx
tags question: http://stackoverflow.com/q/23986079
tags question: http://stackoverflow.com/q/24093016
tags question: http://stackoverflow.com/q/23952226
tags question: http://stackoverflow.com/q/24038524
type: Tag
tags question: http://stackoverflow.com/q/23946006
tags question: http://stackoverflow.com/q/23975201
tags question: http://stackoverflow.com/q/24024785
tags question: http://stackoverflow.com/q/24043420
tags question: http://stackoverflow.com/q/24063082
tags question: http://stackoverflow.com/q/23960625
tags question: http://stackoverflow.com/q/24096331
tags question: http://stackoverflow.com/q/24097764
tags question: http://stackoverflow.com/q/24055897
tags question: http://stackoverflow.com/q/24008429
tags question: http://stackoverflow.com/q/24099333
tags question: http://stackoverflow.com/q/24017302
tags question: http://stackoverflow.com/q/24079259
tags question: http://stackoverflow.com/q/24030314
tags question: http://stackoverflow.com/q/23990493
tags question: http://stackoverflow.com/q/24096106
tags question: http://stackoverflow.com/q/24025995
tags question: http://stackoverflow.com/q/24099360
tags question: http://stackoverflow.com/q/23941075
tags question: http://stackoverflow.com/q/24008401
tags question: http://stackoverflow.com/q/23969238
tags question: http://stackoverflow.com/q/23983590
tags question: http://stackoverflow.com/q/23987085
tag name: javafx
tags question: http://stackoverflow.com/q/23979159
tags question: http://stackoverflow.com/q/24087085
tags question: http://stackoverflow.com/q/23965900
tags question: http://stackoverflow.com/q/24000242
tags question: http://stackoverflow.com/q/24104545
tags question: http://stackoverflow.com/q/24004089
tags question: http://stackoverflow.com/q/23998082
tags question: http://stackoverflow.com/q/23985809
tags question: http://stackoverflow.com/q/23998044
tags question: http://stackoverflow.com/q/24082456
tags question: http://stackoverflow.com/q/23970420
tags question: http://stackoverflow.com/q/24053332
tags question: http://stackoverflow.com/q/24047982
tags question: http://stackoverflow.com/q/23983465
tags question: http://stackoverflow.com/q/24042649
tags question: http://stackoverflow.com/q/24101245
tags question: http://stackoverflow.com/q/23959367
tags question: http://stackoverflow.com/q/24027314
tags question: http://stackoverflow.com/q/23982445
tags question: http://stackoverflow.com/q/24005247
tags question: http://stackoverflow.com/q/24074888
tags question: http://stackoverflow.com/q/23997115
tags question: http://stackoverflow.com/q/23976686
tags question: http://stackoverflow.com/q/24074056
tags question: http://stackoverflow.com/q/23979282
tags question: http://stackoverflow.com/q/24095424
tags question: http://stackoverflow.com/q/24013690
tags question: http://stackoverflow.com/q/24077524
tags question: http://stackoverflow.com/q/24018210
tags question: http://stackoverflow.com/q/24082063

http://stackoverflow.com/a/24054136
has body: If your class is a public API the setter needs a defensive copy, because an attacker could maliciously modify the Date passed to the setter after passing it, changing the internal state of your class in an unintended manner. It could bypass checks in the setter, because they work only when the method is called, and not after. The attacker doesn't need to "get" the original Date object: he can simply hold the passed reference and modify it after calling the setter.
answers question: http://stackoverflow.com/q/24033154
score: 0
accepted answer of: http://stackoverflow.com/q/24033154
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23999940
has answer: http://stackoverflow.com/a/24000080
score: -1
has body: I want to read values from csv files, and order them in a table (console output). How can I output all files in a folder and read all content in this files, and get filename while reading files with the content in it? I have so far only this, but I can't become the filename in right way, I become only the last filename and not the content of this file. public static List<Objekt> run() throws IOException { String path2 = "D:\\folder\\files"; File folder = new File(path2); File[] listOfFiles = folder.listFiles(); for (int i = 0; i < listOfFiles.length; i++){ if (listOfFiles[i].isFile()){ files = listOfFiles[i].getName(); if (files.endsWith(".csv")){ files = files.replace(".csv", ""); System.out.println(files); } } } List<Objekt> lines = new ArrayList<Objekt>(); String csvString = "D:\\folder\\files\\file1.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ";"; Objekt objekt = null; String[] hdr = null; int l_count = 0; br = new BufferedReader(new FileReader(csvString)); while ((line = br.readLine()) != null) { if (l_count == 0) { hdr = line.split(cvsSplitBy); } else{ String[] temp = line.split(cvsSplitBy); for (int i = 0; i < temp.length; i++) { objekt = new Objekt(); objekt.setTimestamp(hdr[i] + "\t" + temp[0] + "\t" + temp[i] + "\t" + files + "\n"); lines.add(objekt); } System.out.println(lines); } l_count++; } br.close(); return lines; } This is what I become (I get only that filename, which is at the end of the folder). >tr_klue 06.03.2014 11:30 1389 outfilename >tr_klue_lo 06.03.2014 12:00 1889 outfilename but I need all filenames in this folder with corresponding content and save these in subfolder with filename and datetime with time when this was read, like: tr_klue 06.03.2014 11:30 1389 outfilename >tr_klue_lo 06.03.2014 12:00 1889 outfile1 >tr_klue 06.03.2014 12:30 100 props2 >tr_klue_lo 06.03.2014 13:00 89 colorak Can you please give me some suggestions in which way to go?
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24000080
favorite count: 0
has title: Get filename while reading csv
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/a/24002613
upvote count: 1
has body: Injection only works for managed beans (and a few other objects like servlets). Test classes get instantiated by JUnit and not by the CDI container, so injection does not work out of the box. You need a special JUnit runner that injects dependencies into the instantiated test class - e.g. Pax Exam in CDI mode.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23999326

http://stackoverflow.com/q/24058759
favorite count: 0
score: 9
linked to: http://stackoverflow.com/q/999489
has comment: http://stackoverflow.com/comment/37096822
accepted answer: http://stackoverflow.com/a/33275032
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/75024386
tagged with: java
has title: Creating an executable .jar using Intellij
type: Question
has body: I've got an app which is using few external jars like mail-1.4 and etc. And now I want to execute my app out of IDE (IntelliJ). Also I was following instruction File>Project Structure>Artifacts and so on, but my command prompt says: Exception in thread "main" java.lang.SecurityException: Invalid signature file igest for Manifest main attributes at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source) at sun.security.util.SignatureFileVerifier.process(Unknown Source) at java.util.jar.JarVerifier.processEntry(Unknown Source) at java.util.jar.JarVerifier.update(Unknown Source) at java.util.jar.JarFile.initializeVerifier(Unknown Source) at java.util.jar.JarFile.getInputStream(Unknown Source) at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source) at sun.misc.Resource.cachedInputStream(Unknown Source) at sun.misc.Resource.getByteBuffer(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) My MANIFEST is almost empty: Manifest-Version: 1.0 Main-Class: ru.tenet.smsc.SMSC What is wrong?
upvote count: 9
has answer: http://stackoverflow.com/a/33275032
linked to: http://stackoverflow.com/q/41746177
tagged with: intellij-idea
downvote count: 0
answer count: 1
tagged with: jar

http://stackoverflow.com/a/24071606
type: Answer
has body: I am just wondering - storing a root database password is a bad idea in general. But then again, when someone actually manages to get access to that file on the server, how safe is your database anyway? Would the password still show up if you created a shell script and run it instead? #!/bin/bash ./myApp -D password=myPasswordDontHackPlz
score: 0
answers question: http://stackoverflow.com/q/24070668

http://stackoverflow.com/q/24096472
has title: How Sevlet3 login method work?
type: UnansweredQuestion
tagged with: authentication
type: Question
has body: I am trying to authenticate user by Sevlet3 so did this code in Java class HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); try { request.login(user, password); } catch (ServletException e) { } and in Tomcat server.xml file i made this entry &lt;Realm localDataSource="true" debug="99" className="org.apache.catalina.realm.JDBCRealm" connectionName="hariom" connectionPassword="password" connectionURL="jdbc:mysql://localhost:3306/ccc" digest="md5" driverName="com.mysql.jdbc.Driver" roleNameCol=role_name" userCredCol="password" userNameCol="email_id" userRoleTable="users_list" userTable="user_list_view" /&gt; Here in above code users_list is database table and user_list_view is a database view ..Now i want to know how this code is called and which query fired by login method so that i can check its my issue or i have done some wrong configuration . So how to know which query will be fired and how login method will authenticate user?
tagged with: java
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/24096630
answer count: 1
tagged with: tomcat

http://stackoverflow.com/comment/37104143
has text: What type and version of the JDK are you running?
score: 0
comment on: http://stackoverflow.com/q/24055159
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36928103
type: QuestionComment
has text: @LuiggiMendoza Storing? How?
comment on: http://stackoverflow.com/q/23968371
score: 0
type: Comment

http://stackoverflow.com/comment/36921058
type: Comment
type: QuestionComment
has text: `TreeBasedTable` is not synchronized, you cannot do concurrent writes. Doing so as a side-effect of the mapping is also a bad idéal, IMHO.
score: 0
comment on: http://stackoverflow.com/q/23955837

http://stackoverflow.com/a/24007299
has body: In this specific case, you are not accessing any shared storage such as member variables, static fields, etc. However, you also need to look at any functions you call. Are they thread-safe? In your case, is System.out.print thread-safe? If it is not, then two calls such as: //Thread 1 printMessage(true, "abc"); // Thread 2 printMessage(true, "def"); might print: adebcf because of interleaving. Now, the Javadoc for print makes no mention of thread safety. Hence, assume that it is not thread-safe. It is up to you to decide whether text interleaving is a problem for your use case. If so, then take proper precautions to prevent interleaving of print output.
score: 0
answers question: http://stackoverflow.com/q/24007104
type: Answer

http://stackoverflow.com/comment/36889529
comment on: http://stackoverflow.com/q/23947860
has text: @JamesMassey ` do you want me to go on?` - yes please
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/24065392
answer count: 1
downvote count: 0
tagged with: currency
has answer: http://stackoverflow.com/a/24068734
tagged with: internationalization
favorite count: 0
upvote count: 1
type: Question
type: AnsweredQuestion
has title: Currency Symbol Internationalization Java
has body: I'm trying to get the number format according to current locale but I have a problem with the currency symbol. This is my method: import java.util.Locale; import java.text.NumberFormat; public void i18nCurrency(Locale currentLocale) { Double price = 9876543.21; NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(currentLocale); System.out.println(currencyFormatter.format(price)); } It prints: ¤ 9 876 543,21 for uk and ¤9.876.543,21 for german. The number format is correct, but I need to get the currency symbol as well. Why I can't get the symbol?
accepted answer: http://stackoverflow.com/a/24068734
score: 1
tagged with: java
tagged with: locale
has comment: http://stackoverflow.com/comment/37108668

http://stackoverflow.com/comment/37132460
score: 1
has text: The first level cache is flushed when you run any query. Hibernate has pending changes and any query must go to the DB, so the pending queries need to be flushed so the query returns consistent results.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23974103

http://stackoverflow.com/comment/37151696
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24078865
has text: Read here http://developer.android.com/reference/android/app/Service.html
score: 0

http://stackoverflow.com/comment/36994054
has text: Isn't the whole point of PaaS that you don't have to worry about the configuration of the application server? Just produce a WAR file and deploy? Anyhow, whether it's a WAR file or an exploded WAR directory (like `E:/captcha`), the point is the same: don't edit `conf/server.xml` and add `<Context>` elements. There are better ways to do it.
comment on: http://stackoverflow.com/a/23981165
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37017508
score: 0
type: Comment
type: QuestionComment
has text: You need to use the `Cell#setCellStyle` method.
comment on: http://stackoverflow.com/q/24011225

http://stackoverflow.com/q/24033620
upvote count: 1
type: AnsweredQuestion
tagged with: android-layout
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37049779
type: Question
has title: Android app crashes when I change the default xml layout file to another
has answer: http://stackoverflow.com/a/24033663
downvote count: 0
has body: I am currently just starting to learn android development and have created a basic "Hello world" app that uses "activity_main.xml" for the default layout. I tried to create a new layout xml file called "new_layout.xml" with a text view, a text field and a button and did the following changes in the MainActivity.java file: setContentView(R.layout.new_layout); I did nothing else expect for adding a new_layout.xml in the res/layout folder, I have tried restarting and cleaning the project but nothing. Below is my activity_main.xml file, new_layout.xml file and MainActivity.java activity_main.xml: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="org.example.androidsdk.demo.MainActivity" tools:ignore="MergeRootFrame" /&gt; new_layout.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;/LinearLayout&gt; MainActivity.java file package org.example.androidsdk.demo; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import…
tagged with: android
answer count: 1
score: 1
accepted answer: http://stackoverflow.com/a/24033663
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/37124758
comment on: http://stackoverflow.com/a/24074011
has text: Thank you, I was able to solve the problem using your advice :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37156139
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24090357
has text: @Braj I already have, `Java-specific constructs in the regular expression syntax (e.g. [a-z&&[^bc]], (?<=foo), \A, \Q) work only in the pure Java implementation, not the GWT implementation`

http://stackoverflow.com/comment/37143379
type: Comment
has text: @Niand glad it helped. Don't forget to **accept** your answers. Helps everyone know the response has been closed. And helps everyone who helps you
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24072813

maven-plugin
tags question: http://stackoverflow.com/q/24002081
tags question: http://stackoverflow.com/q/23990663
tags question: http://stackoverflow.com/q/23988066
tag name: maven-plugin
type: Tag

http://stackoverflow.com/a/24087628
score: 0
type: Answer
has body: Exactly. You can manipulate and use arrays without importing java.util.Arrays. The java.util.Arrays contains various static methods for manipulating your arrays - search, fill, sort, etc. The point is that you don't have to write implement these common utility functions - just use the methods in the class.
answers question: http://stackoverflow.com/q/24087510

http://stackoverflow.com/comment/37095027
has text: Ok, but in my ontology I have just one class and the others are NamedIndividual. How coul I detect which NamedIndividual are logically equivalent?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24057314

http://stackoverflow.com/comment/37021728
type: AnswerComment
comment on: http://stackoverflow.com/a/24011464
type: Comment
score: 0
has text: Thanks for the answer, but I don't think Class Load Breakpoint is what I was looking for.

http://stackoverflow.com/comment/36913268
score: 0
comment on: http://stackoverflow.com/q/23960512
type: Comment
type: QuestionComment
has text: android.view.MenuItem was imported in ContentResolverMenuItem. I deleted that line and now it's working. So I should change the class name even though it works now?

http://stackoverflow.com/comment/68018991
comment on: http://stackoverflow.com/a/23994425
score: 1
type: AnswerComment
has text: This bit me as well, and the first comment is wrong. You should only specify it in the $set block, since $set is applied even when it's inserting a new document. They are not mutually exclusive (being familiar with MySQL ON DUPLICATE KEY syntax confused me).
type: Comment

http://stackoverflow.com/comment/36900555
score: 0
type: QuestionComment
type: Comment
has text: @skiwi It's implicitly, of course. At when dealing with immutable objects.
comment on: http://stackoverflow.com/q/23951020

http://stackoverflow.com/a/23970511
has body: i think you need to make your frame width larger to be able to fit all your component on one ligne ,because FLowLayout align component by default unless there is no more space it's jump to the next ligne. or you can use gridLayout one ligne and many columns ,or GridBagLayout but it's painful to use.
score: 0
answers question: http://stackoverflow.com/q/23970044
type: Answer

http://stackoverflow.com/comment/37025702
comment on: http://stackoverflow.com/q/24020223
score: 0
has text: I know the problem. I forgot a return after `if (!userLineInput.isEmpty()) {...}`.
type: QuestionComment
type: Comment

decimalformat
tags question: http://stackoverflow.com/q/24083697
type: Tag
tag name: decimalformat

http://stackoverflow.com/q/24053394
has body: I have some questions about java String pool. String s1 = "welcome" + " to" + " java"; String s2 = new String("HTML"); In the above situation, My question is the intermediate Strings like "welcome to" added to the pool or not. for example, in my thought, the current String pool has contents as below "welcome" " to" "welcome to" " java" " to java" "welcome to java" please tell me if my thought is wrong.
type: UnansweredQuestion
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/24053468
tagged with: java
has answer: http://stackoverflow.com/a/24053467
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37086477
has title: The contents in the java String pool
downvote count: 0
tagged with: string
favorite count: 0

http://stackoverflow.com/q/24030853
tagged with: eclipse-plugin
type: UnansweredQuestion
tagged with: java
has body: I have written comments in English in my Java files but now my client wants it in Spanish, So is there any tool/Plugin available in RAD or ECLIPSE IDE to convert all the comments in other language. I am using google translator to convert comments manually.
has title: Translate English to some other Language in RAD or Eclipse
type: Question
has answer: http://stackoverflow.com/a/60725054
tagged with: eclipse
score: 0
tagged with: rad
has answer: http://stackoverflow.com/a/24055192
answer count: 3
has answer: http://stackoverflow.com/a/36203673
linked to: http://stackoverflow.com/q/24040110
tagged with: ide

http://stackoverflow.com/comment/37048122
has text: Masud,how can i integrate this with servlet,could you please give me an idea?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24032892

http://stackoverflow.com/q/23992395
has title: Application has crashed using sensor accelrometer and bluetooth
has comment: http://stackoverflow.com/comment/36982830
has comment: http://stackoverflow.com/comment/36972131
has comment: http://stackoverflow.com/comment/36979193
has comment: http://stackoverflow.com/comment/36979031
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/23653778
answer count: 0
has comment: http://stackoverflow.com/comment/36972732
has comment: http://stackoverflow.com/comment/36973129
type: Question
has comment: http://stackoverflow.com/comment/36972329
tagged with: java
tagged with: bluetooth
score: 0
tagged with: accelerometer
has comment: http://stackoverflow.com/comment/36973412
has body: i have no error when compiling the app but the app has crashed immediately after i run it on my android phone. can anyone help me? logcat error 06-02 17:08:14.925: D/AndroidRuntime(4653): Shutting down VM 06-02 17:08:14.925: W/dalvikvm(4653): threadid=1: thread exiting with uncaught exception (group=0x40b8c930) 06-02 17:08:14.935: E/AndroidRuntime(4653): FATAL EXCEPTION: main 06-02 17:08:14.935: E/AndroidRuntime(4653): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sensormobileaty/com.example.sensormobileaty.MainActivity}: java.lang.NullPointerException 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308) 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.app.ActivityThread.access$600(ActivityThread.java:153) 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247) 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.os.Handler.dispatchMessage(Handler.java:99) 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.os.Looper.loop(Looper.java:137) 06-02 17:08:14.935: E/AndroidRuntime(4653): at android.app.ActivityThread.main(ActivityThread.java:5227) 06-02 17:08:14.935: E/AndroidRuntime(4653): at java.lang.reflect.Method.invokeNative(Native Method) 06-02 17:08:14.935: E/AndroidRuntime(4653): at java.lang.reflect.Method.invoke(Method.java:511) 06-02 17:08:14.935: E/AndroidRuntime(4653): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) 06-02 17:08:14.935: E/AndroidRuntime(4653): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) 06-02 17:08:14.935: E/AndroidRuntime(4653): at dalvik.system.NativeStart.main(Native Method) 06-02 17:08:14.935: E/AndroidRuntime(4653): Caused by: java.lang.NullPointerException 06-02 17:08:14.935: E/AndroidRuntime(4…

http://stackoverflow.com/q/24098693
type: Question
tagged with: android
answer count: 1
score: 0
tagged with: java
has title: Intent betwen 2 applications
has body: I ask if I can pass to an other application some data using intent. If it's possible, how can I do clicking a button and passing to an other application? b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intention = new Intent(?????); startActivity(intention); } });
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37170808
has answer: http://stackoverflow.com/a/24098717
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37170754
linked to: http://stackoverflow.com/q/3872063
favorite count: 0
has comment: http://stackoverflow.com/comment/37170848

http://stackoverflow.com/comment/37157752
score: 0
type: Comment
type: QuestionComment
has text: Next time please post also your error message
comment on: http://stackoverflow.com/q/24091557

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

http://stackoverflow.com/comment/37173409
type: Comment
has text: Thanks for the reply. Is it possible to change the returning value? Suppose the return value is `1` and I want to return `Male` then is it possible to change the value from `1` to `Male` in the `after-returning` method?
type: AnswerComment
comment on: http://stackoverflow.com/a/24100005
score: 0

http://stackoverflow.com/q/24009372
tagged with: encryption
tagged with: jasypt
has comment: http://stackoverflow.com/comment/37055872
score: 3
upvote count: 3
tagged with: java
type: Question
has title: Password encryption/decryption for logback configuration
has answer: http://stackoverflow.com/a/42455241
has answer: http://stackoverflow.com/a/55864683
tagged with: logback
has comment: http://stackoverflow.com/comment/37005111
answer count: 2
has comment: http://stackoverflow.com/comment/37055954
has body: I'm using logback's DBAppender to store my logs into an oracle database. I'd also like to add security to my login credentials by encrypting and decrypting my password. So i was recomended a java library jasypt. I have few questions and I'm unable to access http://jasypt.org/ too. Can I use jasypt for encrypting logback.xml's DBAppender database credentials? How will the decryption done on other end(Oracle Database)?
tagged with: jce
downvote count: 0
has comment: http://stackoverflow.com/comment/37004873
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37072509
type: AnswerComment
has text: So, I didn't know what CXF was until just now, but a quick peek at their documentation, they explain how to define a truststore: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-ConfiguringSSLSupport
score: 0
comment on: http://stackoverflow.com/a/24043671
type: Comment

http://stackoverflow.com/q/24056173
tagged with: x509certificate
accepted answer: http://stackoverflow.com/a/24062860
favorite count: 0
tagged with: client-certificates
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: Java ftps connection, TrustManager explaination (using filezilla server)
has body: I have written a program (obviously COPIED from the net, and modified it little according to my needs!) for file download/upload using apache ftp api and by creating a local server using Filezilla server. Everything is working FINE. The problem is I didn't get the part where we have to create a trust manager. Code: FTPSClient ftpsClient= null; SSLContext sslContext = SSLContext.getInstance(protocol); TrustManager tm = new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { System.out.println("getAcceptedIssuers------"); return null; } @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { // TODO Auto-generated method stub System.out.println("checkClientTrusted------"); } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { // TODO Auto-generated method stub System.out.println("checkServerTrusted------"); } }; sslContext.init(null, new TrustManager[] { tm }, null);//new SecureRandom()); ftpsClient = new FTPSClient(true, sslContext); public X509Certificate[] getAcceptedIssuers() this method according to the documentation returns the list of certificate issuer authorities which are trusted for authentication of peers. But here in the code, the method is returning null. Also while setting the configuration for ftps in the Filezilla Server, I had to create a certificate. Seeing all this I didn't get why the certificate was created as we are not passing or returning the certificate. Or does the server or library handles it internally. Can someone explain me thoroughly about this issue.
tagged with: filezilla
type: Question
answer count: 1
downvote count: 0
tagged with: ftps
has answer: http://stackoverflow.com/a/24062860

http://stackoverflow.com/a/32920481
downvote count: 1
answers question: http://stackoverflow.com/q/24009042
has body: You can just use @GeneratedValue(strategy = GenerationType.TABLE) if you just need to be able to auto increment the value for attributes such as some ID which is primary key of your table. It worked for me. Hope it helps.
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/q/23989295
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23989440
score: 0
answer count: 1
has body: I have tried auto-update date function in hibernate and followed this link Interface import entity.TechnicalColumns; public interface EntityWithTechnicalColumns { public TechnicalColumns getTechnicalColumns(); public void setTechnicalColumns(TechnicalColumns technicalColumns); } Implemention import java.sql.Timestamp; import javax.persistence.Column; import javax.persistence.Embeddable; @Embeddable public class TechnicalColumns { @Column(name="UPDATE_TS", insertable=false, updatable=true,nullable = false) private Timestamp dateMaj; @Column(name="CREATION_TS", insertable=true, updatable=false,nullable = false) private Timestamp dateCrea; /** * @return the dateMaj */ public Timestamp getDateMaj() { return dateMaj; } /** * @param dateMaj the dateMaj to set */ public void setDateMaj(Timestamp dateMaj) { this.dateMaj = dateMaj; } /** * @return the dateCrea */ public Timestamp getDateCrea() { return dateCrea; } /** * @param dateCrea the dateCrea to set */ public void setDateCrea(Timestamp dateCrea) { this.dateCrea = dateCrea; } } Listener class import java.sql.Timestamp; import java.util.Date; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import interfaces.EntityWithTechnicalColumns; public class TimestampEntityListener { @PrePersist void onCreate(Object entity) { if(entity instanceof EntityWithTechnicalColumns) { EntityWithTechnicalColumns eact = (EntityWithTechnicalColumns)entity; if(eact.getTechnicalColumns() == null) { eact.setTechnicalColumns(new TechnicalColumns()); } eact.getTechnicalColumns().setDateCrea(new Timestamp((new Date()).getTime())); } } @PreUpdate void onPersist(Object entity) { if(entity instanceof EntityWithTechnicalColumns) { EntityWithTechnicalColumns eact = (EntityWithTechnicalColumns)entity; if(eact.getTechnicalColumns() == null) { eact.setTechnicalColumns(new TechnicalColumns()); } eact.getTechnicalColumns().setDateMaj(new Timestamp((new Date()).getTime())); } } } My Test class @Entity @Table(name = "Test") public class…
has title: (Hibernate)Caused by: java.sql.SQLException: Field 'UPDATE_TS' doesn't have a default value
type: UnansweredQuestion
type: Question

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/23993691
tags question: http://stackoverflow.com/q/24041022
type: Tag
tags question: http://stackoverflow.com/q/23981460

http://stackoverflow.com/comment/36986498
score: 0
type: QuestionComment
type: Comment
has text: My Goal is to pass the variable customer_name_field, what ever text that the user types in the JTextField in GUI, I want to send that variable to the printer class and use that variable in the print method. I don't know why it's not working. I am badly stuck.
comment on: http://stackoverflow.com/q/23999290

http://stackoverflow.com/a/24012132
type: Answer
has comment: http://stackoverflow.com/comment/37010000
upvote count: 1
has body: try below code:- change below code Intent intent = new Intent("com.coded.sandeep.Another"); to Intent intent = new Intent(MainActivity.this,Another.class);
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24012068

http://stackoverflow.com/comment/37141325
type: Comment
has text: Using JS for access control is a bad idea. Too easy to manipulate. Not to mention that the link/library you have referenced is specific to SharePoint.
comment on: http://stackoverflow.com/a/24083265
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37197023
has text: This appears to be a fragment of your working code; your [short, complete example](http://stackoverflow.com/help/mcve) should focus on the problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24096543
score: 0

http://stackoverflow.com/q/24052258
has comment: http://stackoverflow.com/comment/37084755
tagged with: java
has comment: http://stackoverflow.com/comment/37084807
accepted answer: http://stackoverflow.com/a/26379595
type: Question
has comment: http://stackoverflow.com/comment/37084444
has comment: http://stackoverflow.com/comment/37084661
linked to: http://stackoverflow.com/q/3971832
possible better answer: http://stackoverflow.com/a/24052271
has answer: http://stackoverflow.com/a/24052315
has title: Can JavaScript files be used in Android?
has answer: http://stackoverflow.com/a/24052271
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/37084545
answer count: 6
has body: I need to add some JavaScript code to my program. Is it possible to add .js files in Android? If so, can you tell me the way how to do it, and extract the codes.
has answer: http://stackoverflow.com/a/26863295
has answer: http://stackoverflow.com/a/26379912
has comment: http://stackoverflow.com/comment/37084507
favorite count: 0
tagged with: android
score: 2
has answer: http://stackoverflow.com/a/26379595
upvote count: 2
has answer: http://stackoverflow.com/a/26927672
has comment: http://stackoverflow.com/comment/37084869
type: AnsweredQuestion

http://stackoverflow.com/a/23958802
has body: Pseudocodish. You will have to settle on files that haven't beed modified in three weeks via FTPClient interface for (FTPFile f : client.listFiles()) { Long t = f.getTimeStamp(); if t is more than three weeks ago delete f }
accepted answer of: http://stackoverflow.com/q/23958548
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23958548
score: 0

http://stackoverflow.com/a/23959809
accepted answer of: http://stackoverflow.com/q/23959760
has comment: http://stackoverflow.com/comment/37664941
answers question: http://stackoverflow.com/q/23959760
has comment: http://stackoverflow.com/comment/42785803
has comment: http://stackoverflow.com/comment/37364782
has comment: http://stackoverflow.com/comment/37656110
has body: On Button click you can call viewPager.setCurrentItem(position); or if you want a smooth scroll you can use viewPager.setCurrentItem(position,true);
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42782469
type: Answer
has comment: http://stackoverflow.com/comment/37668287
has comment: http://stackoverflow.com/comment/37368927
downvote count: 0
score: 7

http://stackoverflow.com/comment/130625286
comment on: http://stackoverflow.com/a/24092481
type: AnswerComment
score: 0
type: Comment
has text: Same here. I noticed this broken down between 6.2.5.Final and 7.0.0.Alpha. 6.2.5.Final is the last where validation annotation are respected during mvc tests.

http://stackoverflow.com/comment/36933719
has text: @BrianGoetz I wanted to demonstrate why to the compilation error occurred. Please feel free to add to the answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23964689
type: AnswerComment

http://stackoverflow.com/q/24086163
tagged with: maven
has answer: http://stackoverflow.com/a/24087740
tagged with: git
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37156035
tagged with: libusb
answer count: 1
has body: Running WINDOWS 7 but ran into same problem on Ubuntu 14.0.4 Very possible given my limited experience with these sorts of things that I am doing something very wrong. I was trying to build the LibUSB directory using the suggestion of running mvn install from the /libusb/ directory, but it didn't work. I downloaded the LibUSB latest GIT from https://github.com/libusb/libusb and placed it in the javax-usb-libusb1-master/libusb-git folder, and then changed over to the javax-usb-libusb1-master/libusb directory and ran mvn install. Before when I tried this I received a great deal of information about things being downloaded and ultimately ended up in failure. This time when I tried it after having GITten the latest LibUSB build and placed it into the libusb-git directory, there was less information, but it still ended with the same error: Y:\Development Tools\Java\javax-usb-libusb1-master\libusb>mvn install [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Javalibusb1 :: libusb 1.0.1-1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ libusb --- [WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.home" is required for this build. [WARNING] Rule 2: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.cflags" is required for this build. [WARNING] Rule 3: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "libusb.configure.args" is required for this build. [WARNING] Rule 4: org.apache.maven.plugins.enforcer.RequireProperty failed with message: Property "nar.optionSet.c" is required for this build. [WARNING] Rule 5: org.apache.mave…
score: 0
has title: Maven mvn install on javax-usb-libusb1, I get this error
has comment: http://stackoverflow.com/comment/37147142
type: UnansweredQuestion

http://stackoverflow.com/a/23992215
answers question: http://stackoverflow.com/q/23990607
has comment: http://stackoverflow.com/comment/36971872
has comment: http://stackoverflow.com/comment/36972371
score: 0
type: Answer
has body: I believe, in android, inside a project 'A', you can only refer a class 'b' from the library 'B', if and only if 'B' is directly added to 'A' , as library or project reference. Either make the two libraries to One or add both to main project.

http://stackoverflow.com/comment/37095327
has text: What mean "Rather than feed you with the code."?
comment on: http://stackoverflow.com/q/24057499
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24001862
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24001747
answers question: http://stackoverflow.com/q/24001747
has body: As stated, the two choices will both run in O(n) time (I think). However, the second option (i.e. your initial implementation) will likely have better constant factors due to the fact that moving a group of elements all at once can be (and probably will be) more efficient than moving elements one at a time, especially if you have to move large groups of elements. So I would say that your initial implementation was more efficient, unless your final insertion point is almost always near the end of the array, at which point the overhead of System.arraycopy() may dominate the time needed to do the actual work -- but not by much. I suppose you can think of the two situations as approximately comparing a single iteration of bubblesort (suggested implementation) and insertion sort (initial implementation). Both have the same time complexity, but a single iteration of insertion sort will almost always (or maybe always?) run faster due to fewer operations. Take this for an example (assuming resizable arrays for simplicity): int[] a = new int[] {1, 2, 4, 5}; and say you want to insert 3. Your initial implementation would go something like this: Find the index to insert at. 3 comparisons to find index == 2. Shift elements at indices > 2. 2 operations: Shift 5 over one place, and shift 4 over one place. (this might be one operation, depending on how System.arraycopy() is implemented). Result is {1, 2, 0, 4, 5} Insert element. 1 Operation. Final result is {1, 2, 3, 4, 5}. Total: 3 comparisons, 3 operations. Your new implementation would go something like this: Insert element at end. 1 operation. Result is {1, 2, 4, 5, 3}. Compare to see if need to swap. 1 comparison. Swap needed. Swap. 3 operations: Assign 5 to temp variable, assign 3 to index 3, assign temp variable to index 4. Result is {1, 2, 4, 3, 5} Compare to see if need to swap. 1 comparison. Swap needed. Swap. 3 operations: Assign 4 to temp variable, assign 3 to index 2, assign temp variable to index 3. Result is {1, 2, …
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23945219
tagged with: decorator
has comment: http://stackoverflow.com/comment/36884536
answer count: 0
type: UnansweredQuestion
tagged with: compile-time
tagged with: object
tagged with: java
has title: How can sub-classing affects all instance of original object?
has body: I was trying to learn decorator pattern from wiki it states The decorator pattern is an alternative to subclassing. Subclassing adds behavior at compile time, and the change affects all instances of the original class; decorating can provide new behavior at run-time for individual objects. I have this doubt, if i create one class Original original=new Original(); then how come subclassing it as SubClass extends Original will affect the original reference of the object of class Original, it should remain intact?
type: Question
score: 0
tagged with: runtime
has comment: http://stackoverflow.com/comment/36884663

http://stackoverflow.com/comment/36988150
type: AnswerComment
has text: Grab the fragment using the FragmentManager. You will have to cast to your subclass of ListFragment to get access to your new method, or else you can just cast to a ListFragment, call getListAdapter() on that and then cast the result of that to your ListAdapter type.
type: Comment
comment on: http://stackoverflow.com/a/24000101
score: 1

http://stackoverflow.com/q/24087605
type: Question
tagged with: projection
has comment: http://stackoverflow.com/comment/37151012
tagged with: criteria
downvote count: 0
linked to: http://stackoverflow.com/q/14970524
has comment: http://stackoverflow.com/comment/37151172
has comment: http://stackoverflow.com/comment/37150935
favorite count: 0
has title: Hibernate Criteria Projection of non scalar values
type: UnansweredQuestion
has body: Is there any way to project multiple values for an root entity object using Criteria? Assume we have these classes (With the proper mappings): class Boss { private String name; private List&lt;Employee&gt; employees; // setters and getters and more stuff } class Employee { private String name; // setters and getters and more stuff } Then i am trying to do this : public void test() { Criteria criteria = this.getSession().createCriteria(Boss.class); criteria.createAlias("employees","employees"); ProjectionList projectionList = Projections.projectionList(); projectionList.add(Projections.property("name"), "name"); projectionList.add(Projections.property("employees.name"), "subordinatesNames"); criteria.setProjection(projectionList); criteria.setResultTransformer(new AliasToBeanResultTransformer(BossBean.class)); List&lt;BossBean&gt; results = criteria.list(); // fails here for (BossBean bossBean : results) { System.out.println (bossBean); } } This is how the Bean looks like (nothign special, just for grouping values) : public static class BossBean { private String name; private List&lt;Strings&gt; subordinatesNames; public String getName() { return name; } public void setName(String name) { this.name = name; } public List&lt;Strings&gt; getSubordinatesNames() { return subordinatesNames; } public void setSubordinatesNames(List&lt;Strings&gt; subordinatesNames) { this.subordinatesNames = subordinatesNames; } } The exception is this : 2014-06-06 13:37:38 [main] ERROR org.hibernate.property.BasicPropertyAccessor - expected type: java.util.List, actual value: java.lang.String. I Guess is trying to fit the String returned from Boss(root object) -> (A)Employee(association) ->name(value) into a List. I want to auto magically get all inserted in the List. Is there a way to achieve this using Criteria? If not, how i can achieve it? Thanks in advance! Grettings Víctor
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/37151445
tagged with: java
has comment: http://stackoverflow.com/comment/37163640
tagged with: hibernate
upvote count: 1

http://stackoverflow.com/comment/37001407
type: QuestionComment
comment on: http://stackoverflow.com/q/24007671
has text: Check out this article on advanced enum usage. http://javarevisited.blogspot.com/2011/08/enum-in-java-example-tutorial.html.
score: 0
type: Comment

http://stackoverflow.com/comment/36994713
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24003949
has text: Are you talking about the comment on the question, which says it is "cheating"?
score: 0

http://stackoverflow.com/q/24038968
has comment: http://stackoverflow.com/comment/37059435
has comment: http://stackoverflow.com/comment/37059674
downvote count: 1
tagged with: arraylist
type: Question
has body: What will be the complexity of adding like 100000 elements to the end of an ArrayList which was created with a default size? Ok, adding an element to the end of ArrayList will be O(1), but what would be a total complexity of adding like 100 000 elements to the end? I thought it would be O(n), but some people say it should be O(n^2). What is correct and why?
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24039092
has title: Time complexity of adding a lot of new items to the back of an ArrayList
tagged with: big-o
favorite count: 0
has comment: http://stackoverflow.com/comment/37059334
upvote count: 2
has comment: http://stackoverflow.com/comment/37059594
answer count: 2
possible better answer: http://stackoverflow.com/a/24039342
has comment: http://stackoverflow.com/comment/37059391
has answer: http://stackoverflow.com/a/24039342
has comment: http://stackoverflow.com/comment/37059383
tagged with: java
accepted answer: http://stackoverflow.com/a/24039092
has comment: http://stackoverflow.com/comment/37059669

http://stackoverflow.com/a/24054328
type: Answer
has body: I wish I could comment instead of answer but unfortunately I can't so I have to just do an answer. What you said doesn't actually work - as if it started with those characters, it would end up as String [] parts={"1p", "qrn", "qr2", "qst" ,"1a1", "4at" ,"qa", "qb1" ,"st1", "sp", "su"}; so to answer your actual question, [0-9aqs]\w+ should work as you want. If that's not what you want, clarify how they are split, because how you split doesn't fit "Elements of 'parts' start with char 0-9, a,q,s."
answers question: http://stackoverflow.com/q/24054132
score: 0

http://stackoverflow.com/q/23990261
has answer: http://stackoverflow.com/a/23990295
linked to: http://stackoverflow.com/q/9031832
has answer: http://stackoverflow.com/a/23990320
answer count: 4
has body: I was writing my android libraries. I have an interface called IActivity, I have many methods in this interface. Now, I do not use couple methods in this interface, seems really unnecessary. I deprecated them. However, this is a shared library for may apps. All my apps started the complain. Is there a way to a deprecation of a method in an interface which will prevent implementation of the method (but also possible to override for old apps) for future applications ?
has answer: http://stackoverflow.com/a/23990455
downvote count: 1
has title: How to deprecate a method in interface?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36968183
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/23990295
type: Question
has answer: http://stackoverflow.com/a/23990333
score: 4
favorite count: 0
duplicate of: http://stackoverflow.com/q/9031832
possible better answer: http://stackoverflow.com/a/23990320

http://stackoverflow.com/a/23992100
type: Answer
has body: Create a connection string to connect to the DB from your code. Then Run a query to fetch records from the DB table like this: Connection con = //create a connection string; Statment smt = con.createStatement(); ResultSet rs = smt.executeQuery("Your SQL"); Now retrieve records from your ResultSet and populate in your Jtable while (rs.next()) { //Populate table }
has comment: http://stackoverflow.com/comment/36971610
has comment: http://stackoverflow.com/comment/36971649
has comment: http://stackoverflow.com/comment/36980100
answers question: http://stackoverflow.com/q/23990131
score: 0

http://stackoverflow.com/comment/36880287
score: 3
comment on: http://stackoverflow.com/q/23942954
type: Comment
type: QuestionComment
has text: Here's a performance optimization tip; start at 999 and work backward. The first palindrome is then your largest palindrome.

http://stackoverflow.com/q/23941774
answer count: 0
tagged with: java
tagged with: orm
type: Question
has comment: http://stackoverflow.com/comment/36877899
has body: I am using Eclipse link and I want to delete all entities with a clause. But when I am doing it I get StackOverFlow error. Here is the method I use for deleteting. What is wrong in it ? EntityManager em = getEntityManager(); try { ACLEntry acle = new ACLEntry(); TypedQuery&lt;ACLEntry&gt; q = em.createQuery("DELETE from ACLEntry acle where acle.acl=:acl ", ACLEntry.class); q.setParameter("acl", acl); } catch (Exception ex) { LOG.throwing("DAO", "removeAllACLEntries", ex); // em.getTransaction().rollback(); } finally { em.close(); } } Here is ACLEnrty entity: /* * 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 com.cisco.onepk_web.entity; import java.io.Serializable; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; /** * * @author abondar */ @Entity @SequenceGenerator(name = "aclE_seq", sequenceName = "aclE_seq", initialValue = 1, allocationSize=1) public class ACLEntry implements Serializable { private static final long serialVersionUID = 1L; @GeneratedValue(strategy = GenerationType.AUTO, generator="aclE_seq") @Id private Long id; @ManyToOne(targetEntity = ACL.class) private ACL acl; private Integer seqNumber; private String action; private String protocol; private String srcAddr; private String dstAddr; private String srcWcard; private String dstWcard; private Integer srcPort; private Integer dstPort; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public ACL getAcl() { return acl; } public void setAcl(ACL acl) { this.acl = acl; } public Integer getSeqNumber() { return seqNumber; } public void setSeqNumber(Integer seqNumber) { this.seqNumber = seqNumber; } public String getProtocol() { return protocol;…
score: 0
has comment: http://stackoverflow.com/comment/36877988
tagged with: eclipselink
type: UnansweredQuestion
has title: Stackoverflow while deleting an entity

http://stackoverflow.com/q/24012068
type: Question
has comment: http://stackoverflow.com/comment/37009156
has comment: http://stackoverflow.com/comment/37009299
has answer: http://stackoverflow.com/a/24012177
has comment: http://stackoverflow.com/comment/37009248
downvote count: 0
has answer: http://stackoverflow.com/a/24012132
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/24012348
has answer: http://stackoverflow.com/a/24012199
answer count: 5
has answer: http://stackoverflow.com/a/24012118
upvote count: 1
has comment: http://stackoverflow.com/comment/37010478
has comment: http://stackoverflow.com/comment/37041156
has body: i have to send a details of the MainActivity.java to the Another Activity and print it there i have created an onclick event in the mainActivity with some text into that but when i click the button the app is crashing inside the emulator and getting the exception in the logcat MainActivity.java Button buy_button = (Button)convertView.findViewById(R.id.buy_global); buy_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Context context; Intent intent = new Intent("com.coded.sandeep.Another"); intent.putExtra("message", "Hello From MainActivity"); Bundle extras = new Bundle(); extras.putString("status", "Data Received!"); intent.putExtras(extras); context.startActivity(intent); } }); Another.java public class Another extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.another); // 1. get passed intent Intent intent = getIntent(); // 2. get message value from intent String message = intent.getStringExtra("message"); // 3. show message on textView ((TextView)findViewById(R.id.tvMessage)).setText(message); // 5. get status value from bundle String status = bundle.getString("status"); // 6. show status on Toast Toast toast = Toast.makeText(this, status, Toast.LENGTH_LONG); toast.show(); } } LOGCAT 06-03 05:41:52.249: W/dalvikvm(1644): threadid=1: thread exiting with uncaught exception (group=0xb4a38ba8) 06-03 05:41:52.379: E/AndroidRuntime(1644): FATAL EXCEPTION: main 06-03 05:41:52.379: E/AndroidRuntime(1644): Process: com.coded.sandeep, PID: 1644 06-03 05:41:52.379: E/AndroidRuntime(1644): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.coded.sandeep.Another (has extras) } 06-03 05:41:52.379: E/AndroidRuntime(1644): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632) 06-03 05:41:52.379: E/AndroidRuntime(1644): at android.app.Instrumentation.execStartActivity(Instrumenta…
accepted answer: http://stackoverflow.com/a/24012199
has title: Android:Send the data to another Activity giving Fatal Exception
tagged with: fatal-error
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24012118
has comment: http://stackoverflow.com/comment/37009383
score: 1
tagged with: java

http://stackoverflow.com/q/24092495
upvote count: 2
tagged with: wrapper
accepted answer: http://stackoverflow.com/a/24092580
answer count: 1
favorite count: 0
has body: I want to pass Java array as parameter to c dll throw JNA , here is my code : import com.sun.jna.*; public class Javatest { public interface CLibrary extends Library { CLibrary INSTANCE = (CLibrary) Native.loadLibrary( "test", CLibrary.class); void test(Pointer p,int width); } public static void main(String[] args) { Pointer p = new Memory(5*Native.getNativeSize(Double.TYPE)); for (int i = 0; i &lt; 5; i++) { p.setDouble(i*Native.getNativeSize(Double.TYPE),5); } CLibrary.INSTANCE.test(p,5); } } C code : #include &lt;stdio.h&gt; __declspec(dllexport) int test(double *a,int width){ for(int i =0 ; i&lt;width;i++){ printf("%d",a[i]); } return 0; } RESULT : 00000 Looks like the Pointer doest's points at the right memory place .
tagged with: jna
has answer: http://stackoverflow.com/a/24092580
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has title: Passing array from java to dll function with JNA
tagged with: dll
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/comment/36981168
comment on: http://stackoverflow.com/a/23996254
type: AnswerComment
type: Comment
score: 1
has text: The percentage calculation is faulty - ((99/100)*100) == 0

http://stackoverflow.com/comment/37266622
has text: I went to see the javadoc of RpcRB and it states this: * HTTP requests issued by RPC proxy objects may override the protected * doXyz methods and pass an instance of the subclass to * {@link ServiceDefTarget#setRpcRequestBuilder}.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24005567
type: Comment

http://stackoverflow.com/comment/36893848
score: 0
has text: Your code looks fine. I did not observed the problem you are getting.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23949972

http://stackoverflow.com/comment/37260261
type: AnswerComment
score: 0
has text: Yes I'm doing this now. But I wanted to know if this results in getting DB connection for every request. Lets say I add this in a controller. I dont want a new DB connection to be fetched every time a request comes in
type: Comment
comment on: http://stackoverflow.com/a/24135089

http://stackoverflow.com/a/31025291
has body: The line "java.lang.NoClassDefFoundError: javax.management.MBeanServerFactory is a restricted class. Please see the Google App Engine developer's guide for more details." in your error message is due to the Google app engine's restriction. Reference App engine doesn't allow your application to access javax.management.* .
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24006848

http://stackoverflow.com/a/24035247
score: 0
answers question: http://stackoverflow.com/q/24034906
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24034906
type: Answer
has body: If you want to make sure the progress is saved, try looking into the RuntimeHook as said here: Intercepting java machine shutdown call? And what you need to do is store the data in a file, the current count. This can be done fairly easily with the following code: public void saveToFile(int count) { BufferedWriter bw = null; try { bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("countStorage")))); bw.write(count); } catch(IOException e) { e.printStackTrace(); } finally { if(bw != null) { try { bw.close(); } catch(IOException e) {} } } } public int readFromFile() { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("countStorage")))); String line = br.readLine(); int count = Integer.parseInt(line); return count; } catch(IOException e) { e.printStackTrace(); } finally { if(br != null) { try { br.close(); } catch(IOException e) {} } } }

http://stackoverflow.com/a/23946066
score: 0
answers question: http://stackoverflow.com/q/23945973
type: Answer
has body: First, you need to use SimpleDateFormat to parse the Date String to a Java.util.Date Object. Second, After getting the Date Object, you can easily add/substract some time, and get another Date Object. Last, you can use another SimpleDateFormat object to format the Date Object you got in second step to String. SimpleDateFormat is very useful in Processing Date Strings. You can refer to the Javadoc in JDK or search some examples by Google.

http://stackoverflow.com/comment/36955866
type: QuestionComment
has text: Please elaborate with an example.
score: 0
comment on: http://stackoverflow.com/q/23983464
type: Comment

http://stackoverflow.com/a/24082041
answers question: http://stackoverflow.com/q/24077682
upvote count: 1
downvote count: 1
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37169081
has body: This sounds more like a bug report than a question, you may do better raising this on the mailing list or bug tracker: mailing list: https://dev.eclipse.org/mailman/listinfo/paho-dev bug tracker: https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;classification=Technology&amp;list_id=4625660&amp;order=Bug%20Number&amp;product=Paho&amp;query_format=advanced
has comment: http://stackoverflow.com/comment/37139085

http://stackoverflow.com/comment/36898446
score: 0
has text: I got the code as an String and i tried to manipulate the string using methods like StartsWith, contains and replace.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23952744

http://stackoverflow.com/q/23969615
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36930009
tagged with: java
has comment: http://stackoverflow.com/comment/36929914
linked to: http://stackoverflow.com/q/2745265
type: Question
has comment: http://stackoverflow.com/comment/36929965
duplicate of: http://stackoverflow.com/q/2745265
tagged with: inheritance
score: 0
tagged with: abstract-class
has title: Can an abstract super class hold the reference to child class's object in java?
has body: I have created a child class InheritanceTest which extends parent class Parent. Parent class is an abstract class and InheritanceTest class overrides the abstract method abstractMethod(). When I write, Parent P = new InheritanceTest();, it is working fine. But when I write, List&lt;Number&gt; num = new ArrayList&lt;Integer&gt;();, it is giving me compilation error saying that "Type mismatch: cannot convert from ArrayList&lt;Integer&gt; to ArrayList&lt;Number&gt;" Note: Number is an abstract class which is extended by Integer class in jdk. Please find below my code: import java.util.ArrayList; import java.util.List; abstract class Parent { public void test() { System.out.println("parent version of test called"); } public abstract void abstractMehod(); } public class InheritanceTest extends Parent{ /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ArrayList&lt;Number&gt; num = new ArrayList&lt;Integer&gt;(); Parent parent = new InheritanceTest(); } public void test() { System.out.println("child version of test called"); } @Override public void abstractMehod() { // TODO Auto-generated method stub } } Please explain me the reason behind this behavior.
answer count: 0

http://stackoverflow.com/q/23971457
has answer: http://stackoverflow.com/a/23971648
score: -2
has comment: http://stackoverflow.com/comment/36933526
has title: How to add different values in same TextView in Android
downvote count: 2
answer count: 2
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23971693
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 0
has body: A want to develop a project in android using SOAP service protocol. So that i get XML and parse it into String array. I want to show one String (Like String[0]) in one TextView then when a user click the next button next String (Like String[1]) will show on the same page and the same TextView. How how could i do that?
tagged with: java
has answer: http://stackoverflow.com/a/23971693
type: Question
possible better answer: http://stackoverflow.com/a/23971648

http://stackoverflow.com/comment/37126792
has text: @CurlyFries I've added the codes to : StringWriter total = new StringWriter(bytesAvailable); IOUtils.copy(mInput,total,encoding); String message = total.toString(); but it's error for the "encoding" and "system.out.println"
score: 0
comment on: http://stackoverflow.com/q/24066462
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23993805
has answer: http://stackoverflow.com/a/23998619
type: AnsweredQuestion
downvote count: 0
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/50386091
has answer: http://stackoverflow.com/a/34275170
has answer: http://stackoverflow.com/a/24449587
type: Question
has answer: http://stackoverflow.com/a/33495629
possible better answer: http://stackoverflow.com/a/24449587
tagged with: apache-camel
has title: Camel Blueprint - Gave up waiting for Service exception
has answer: http://stackoverflow.com/a/32867262
has body: I have a bunch of unit tests that test some routing/camel implementation in Blueprint. These test run absolutely fine 95% of the time however every so often (1 in 20 or so) I get a Camel Runtime exception: I am running the latest version of Fabric8 with Camel 2.12 java.lang.RuntimeException: Gave up waiting for service (objectClass=org.apache.camel.CamelContext) at org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:240) at org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:198) at org.apache.camel.test.blueprint.CamelBlueprintTestSupport.createCamelContext(CamelBlueprintTestSupport.java:304) at org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:247) at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:217) at org.apache.camel.test.blueprint.CamelBlueprintTestSupport.setUp(CamelBlueprintTestSupport.java:133) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun…
upvote count: 7
answer count: 7
favorite count: 0
accepted answer: http://stackoverflow.com/a/23998619
tagged with: maven
has answer: http://stackoverflow.com/a/46290089

http://stackoverflow.com/q/23942685
tagged with: java
tagged with: java-ee-7
tagged with: weblogic
score: 8
has answer: http://stackoverflow.com/a/24029543
tagged with: weblogic12c
has body: As we know, WebLogic Server 12c supports natively Java EE 7. However, if we take a look at the WebLogic 12c documentation of standards there will be a lot of versions differences. Such as: Java EE 7: Servlet 3.1, JPA 2.1, EL 3.0, JAX-RS 2.0, EJB 3.2, JMS 2.0 WLS 12c: Servlet 3.0, JPA 2.0, EL 2.2, JAX-RS 1.1, EJB 3.1, JMS 1.1 It's just a matter of importing the libraries? Or there is any restriction to use these latest versions? Thanks a lot!
has comment: http://stackoverflow.com/comment/36905547
accepted answer: http://stackoverflow.com/a/24029543
type: AnsweredQuestion
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/30162787
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/30162787
answer count: 2
has comment: http://stackoverflow.com/comment/54981832
has title: Weblogic 12c and Java EE 7 Features

http://stackoverflow.com/q/23963597
downvote count: 0
has body: I'm trying to get metadata about a NameNode from a running Hadoop cluster using Java. Specifically, I would like to get the size of fsimage, the last checkpoint time, and number and size of the edit log files. I'm aware that I can use the Offline Image Viewer to dump the contents of the fsimage file and I can also go to the dfs.namenode.name.dir directory to get the size of the fsimage files and the edit logs files. However, I haven't found a way to get this information using the Hadoop Java API. Is there a way to do this? Any ideas?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
answer count: 0
tagged with: java
type: Question
tagged with: hadoop
has title: Getting NameNode's fsimage size using Java

http://stackoverflow.com/a/24034745
score: 5
has comment: http://stackoverflow.com/comment/37051534
has comment: http://stackoverflow.com/comment/37051480
has body: You can use varargs to achieve this: public TestBean(String... args) { field1 = ""; field2 = ""; field3 = ""; if (args.length &gt;= 1) field1 = args[0]; if (args.length &gt;= 2) field2 = args[1]; if (args.length &gt;= 3) field3 = args[2]; } and initialize your object this way: new TestBean("abc", "foo"); String[] array = new String[]{"abc", "foo"}; new TestBean(array); // or this way if the array already exists
answers question: http://stackoverflow.com/q/24034636
upvote count: 5
has comment: http://stackoverflow.com/comment/37052091
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37051891

http://stackoverflow.com/comment/37003580
comment on: http://stackoverflow.com/q/24008912
type: Comment
has text: For Eclipse it's as simple as altering something in the source code and saving after having launched in debugging mode
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37002381
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24005165
score: 0
has text: Thanks Gas, at least I'm not getting the same error. Now I have a problem about casting from stub interfaces to objects (in the line next to the lookup method), I'm going to post this problem tomorrow. Thanks !

http://stackoverflow.com/comment/37010393
has text: Yes, I was just checking that * and ? are allowed - but the path will always start with '/'
type: Comment
comment on: http://stackoverflow.com/a/24009697
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37051874
type: QuestionComment
has text: write to a file and store it on your hard disk.. I don't think we need a DB for this..
type: Comment
score: 3
comment on: http://stackoverflow.com/q/24034906

http://stackoverflow.com/comment/36980875
has text: since the types are Integer and String, can you make some meaningful examples? like what do you have as input and what result do you want to have after sort. I've read your question and your codes, cannot understand what do you want.
comment on: http://stackoverflow.com/q/23996735
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24001717
has comment: http://stackoverflow.com/comment/37012377
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23991074
answers question: http://stackoverflow.com/q/23991074
downvote count: 0
score: 1
has body: It will send it across the network to a supervisor where the bolt is running. Nimbus will not even be that involved in the process other than just telling the supervisor where it should send the tuples.

http://stackoverflow.com/comment/36980301
has text: this is a nice introduction: http://www.vogella.com/tutorials/JavaWebTerminology/article.html
comment on: http://stackoverflow.com/a/23995644
score: 0
type: AnswerComment
type: Comment

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/23974610
tags question: http://stackoverflow.com/q/24024385

http://stackoverflow.com/comment/132345373
has text: great answer, but it won't be bad to mention spurious wake-ups as a third reason.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/70234894

http://stackoverflow.com/q/23950032
has body: I am trying to make communication between 2 application : In 1st app I have do something like this and working without no error, it's working or not that i don't no. public class Main { public static void main(String[] args) { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/new_tutorial.xml"); applicationContext.registerShutdownHook(); } } XML configuration for it : &lt;int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''"&gt; &lt;int:poller fixed-delay="60000" /&gt; &lt;/int:inbound-channel-adapter&gt; &lt;int:channel id="quakeinfo.channel"&gt; &lt;int:queue capacity="10"/&gt; &lt;/int:channel&gt; &lt;int:channel id="quakeinfotrigger.channel" /&gt; &lt;int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''"&gt; &lt;int:poller fixed-delay="60000" /&gt; &lt;/int:inbound-channel-adapter&gt; &lt;int-ip:udp-outbound-channel-adapter id="metoo" channel="quakeinfotrigger.channel" port="11111" host="localhost"/&gt; &lt;int:logging-channel-adapter id="messageLogger" log-full-message="true" channel="quakeinfo.channel" level="ERROR"&gt; &lt;int:poller fixed-delay="5000" /&gt; &lt;/int:logging-channel-adapter&gt; In second application I am doing like this : public class InboundESB { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("/getinbound.xml"); } } in xml code of second application : &lt;int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''"&gt; &lt;int:poller fixed-delay="60000" /&gt; &lt;/int:inbound-channel-adapter&gt; &lt;int:channel id="quakeinfotrigger.channel" /&gt; &lt;int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''"&gt; &lt;int:poller fixed-delay="60000" /&gt; &lt;/int:inbound-channel-adapter&gt; &lt;int-ip:udp-inbound-channel-adapter id="metoo" port="11111" channel="quakeinfotrigger.channel"/&gt; when I execute second application after first one it's give m…
tagged with: spring-mvc
tagged with: spring-integration
upvote count: 1
has title: Spring Integration IP UDP - IN/OUTBOUND Error
type: Question
has answer: http://stackoverflow.com/a/23955405
tagged with: java
has answer: http://stackoverflow.com/a/23956431
answer count: 2
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23958873
upvote count: 2
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24039578
tagged with: eclipse
answer count: 1
downvote count: 0
has title: TextView causing app to crash
favorite count: 0
accepted answer: http://stackoverflow.com/a/24039578
has body: For some reason when I call the TextView function it crashes my app. I have looked through the answers of questions similar to mine but I could not narrow down my problem. This is the first time I am making an app, first time I am using Java for that matter. Previously I only have experience with C++/C. From my Android Manisfest File &lt;activity android:name="sg.blogspot.ce9005project.LegalNoticesActivity" android:label="@string/action_legalnotices" &gt; &lt;/activity&gt; From the .xml file: &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textId"/&gt; My java file: package sg.blogspot.ce9005project; import com.google.android.gms.common.GooglePlayServicesUtil; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.app.Activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import android.os.Build; public class LegalNoticesActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_legal_notices); //Original line below ((TextView) findViewById(R.id.textId)).setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this)); //The 2 lines below were modified by me but still do not work //TextView textView = (TextView) findViewById(R.id.textId); //textView.setText("TEST"); //The below line works. The problem, that means, lies with TextView //Toast.makeText(this, GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this), Toast.LENGTH_SHORT).show(); } }
tagged with: android
score: 2

http://stackoverflow.com/q/24051476
tagged with: maven
tagged with: unit-testing
upvote count: 28
tagged with: guava
downvote count: 0
has answer: http://stackoverflow.com/a/24051826
tagged with: java
has answer: http://stackoverflow.com/a/40815218
type: Question
has body: My intent is to do unit test of private methods and I understand on how to import the @VisibleForTesting and use it for a private method. I have done a quite a bit of search but unable to see a complete example that demonstrates this feature. For eg: class MyClass { @VisibleForTesting private double[] getWorkArray(double[] values,int length) { : : return &lt;some double array&gt; } } Now in JUnit, I must be able to do @Test public void testProvateMethod() { MyClass object = new MyClass(); assertNotNull(object.getWorkArray(...); } But the difficult part is I am unable to comprehend/do the following a) Snippet of maven compiler plugin for including the relevant annotation processor b) Actually be able to test a private method. (since it throws error related to visibility of method) I am unable to do it in action while I write a test in JUnit (due to the private access error). For eg: mvn clean test Please provide a complete example to really all steps involved in getting the JUnit test of private methods done.
has comment: http://stackoverflow.com/comment/37125669
favorite count: 0
has title: Guava @VisibleForTesting : Help me with a complete example
answer count: 3
has comment: http://stackoverflow.com/comment/37125547
has answer: http://stackoverflow.com/a/36963957
score: 28
has comment: http://stackoverflow.com/comment/37090533
type: UnansweredQuestion

http://stackoverflow.com/comment/36991962
has text: @DavidSchwartz It's easy to access using `Map` when needed based on `Position`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24002382
score: 0

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/23996555
type: Tag
tags question: http://stackoverflow.com/q/24042456

http://stackoverflow.com/q/23973048
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23978138
type: Question
tagged with: zlib
has title: SYNC_FLUSH/FULL_FLUSH parameters in Java Deflater: relation to DEFLATE blocks?
has body: In Java 7, Deflater has added support for some compression parameters (modes: FULL_FLUSH, SYNC_FLUSH). I guess that they correspond to Zlib similar constants in the standard API (though this one has more modes). My doubt is how those modes are related to the "blocks" of the DEFLATE stream (these blocks are compressed independently, except that a pointer inside a block might point to a raw substring of a previous block). Does one (or both) of these modes implies that a flush terminates a (non final) DEFLATE block? Can the caller predict and/or suggest these block boundaries? Specifically, I'd wish to tell the Deflater object the following: "I will feed you with N raw bytes in sections of predetermined length (M), and because I know that these sections are quite long and statistically different, and because I know that there is little to loose and something to gain in compressing them independently, I suggest you that compress them in separated DEFLATE blocks". Can I do this?
linked to: http://stackoverflow.com/q/14744692
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23978138
tagged with: deflate

http://stackoverflow.com/a/24002086
score: 1
type: AcceptedAnswer
downvote count: 0
has body: You can use this method to split string into two parts: String[] parts = value.toString().split(";", 2); outKey.set(parts[0].trim()); outValue.set("B" + parts[1]);
accepted answer of: http://stackoverflow.com/q/23998414
answers question: http://stackoverflow.com/q/23998414
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37005671

http://stackoverflow.com/comment/36968189
score: 0
comment on: http://stackoverflow.com/q/23990116
has text: Please can add the contents of your hibernate configuration file, and the two files you are mapping?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23995555
type: Answer
answers question: http://stackoverflow.com/q/23994904
has body: Actually, if you use Quartz and store it's data in DB, then there is ready solution for it: org.quartz.jobStore.isClustered=true
has comment: http://stackoverflow.com/comment/36980284
score: 0

http://stackoverflow.com/q/23966378
has body: I am new to web development. My job is to get data from the server and plot them using amcharts every 1 or 2 seconds. This is what i have so far: Submit Once I enter device and type and click the submit button, it will run the Java method get_data(). The method will search the database and return data that matches the device name, but the thing is it will display is the data in another page, for example www.somepage/getdata. The above html is in www.somepage/data page. I tried using jquery .post() but the thing is it requires an url, I tried passing /getdata to it but didn't work. My question is: is there a way to save the data we get from the @routes.DataApplication.get_data() action without reloading the page? By the way, I am using play framework to develop the webpage. UPDATE Ok, making some progresses now, I tried using ajax post, but the data return (in console) is like this: [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object] Here I got 11 objects. If i don't use ajax post (using the original post form method), I get 11 data points too. Here is my code: What get_data() does is just take the user input data (which is the form) and get corresponding data from the database and return ok(node);. This node is JsonNode Any help would be appreciated..
has comment: http://stackoverflow.com/comment/36942408
tagged with: javascript
tagged with: ajax
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/11133059
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23976762
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36924436
linked to: http://stackoverflow.com/q/4935632
has answer: http://stackoverflow.com/a/23976690
has comment: http://stackoverflow.com/comment/36924434
has answer: http://stackoverflow.com/a/23992575
score: 0
answer count: 3
tagged with: playframework
has title: how to get data from server without refreshing the page

lemmatization
type: Tag
tags question: http://stackoverflow.com/q/24003616
tag name: lemmatization

http://stackoverflow.com/q/23941688
tagged with: yourkit
tagged with: performance-testing
answer count: 1
accepted answer: http://stackoverflow.com/a/42014313
favorite count: 0
has comment: http://stackoverflow.com/comment/36877750
tagged with: memory-management
has title: YourKit - The retained size of an object doesn't equal the retained size of all the objects referred by it
score: 13
upvote count: 13
type: AnsweredQuestion
has body: The retained size of an object doesn't equal the retained size of all the objects referred by it. Here is what is happening: Using YourKit to capture memory snapshot. click on an object &amp; show instances by class type let's say the instance's retained memory is A bytes (600mb) expand and sum the retained size for the underlying instances let's say the sum is B (300mb) A >> B
tagged with: java
has answer: http://stackoverflow.com/a/42014313
type: Question
has comment: http://stackoverflow.com/comment/36878095
downvote count: 0

clone
tags question: http://stackoverflow.com/q/24009608
tags question: http://stackoverflow.com/q/24041037
tag name: clone
type: Tag

http://stackoverflow.com/comment/36910343
type: Comment
type: QuestionComment
has text: But you want it the sharefprefs one element per array value?
comment on: http://stackoverflow.com/q/23958792
score: 0

http://stackoverflow.com/a/23990852
has body: I would use an ArrayList in your case but if you want to stick with your array you can do the following: int count = 0; for(int i = 0; i &lt; test.length; i++){ if (test[i] == 10) { count++; } } int[] newTest = new int[count]; count = 0; for( int = 0; i &lt; test.length; i++){ if(test[i] != 10){ newTest[count++] = test[i]; } } i didn't test it
answers question: http://stackoverflow.com/q/23990634
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24102816
score: 3
has title: Fedora OpenJDK Set JAVA_HOME
upvote count: 3
tagged with: java
tagged with: fedora
type: Question
has answer: http://stackoverflow.com/a/46143039
has body: I am using Fedora(actually Pidora since I am trying to set up hadoop on a cluster of raspberrypi). I installed oopenjdk on all of the nodes using ansible. However, when I tried to set up the JAVA_HOME environment variable, I got really confused looking at the folder of /usr/lib/jvm: [root@datafireball1 jvm]# ls java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.arm jre jre-1.7.0 jre-1.7.0-openjdk jre-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.arm jre-openjdk [root@datafireball1 jvm]# ls -alth total 80K drwxr-xr-x 3 root root 4.0K Jun 7 21:07 . lrwxrwxrwx 1 root root 35 Jun 7 21:07 jre-1.7.0-openjdk -&gt; /etc/alternatives/jre_1.7.0_openjdk lrwxrwxrwx 1 root root 27 Jun 7 21:07 jre-1.7.0 -&gt; /etc/alternatives/jre_1.7.0 lrwxrwxrwx 1 root root 29 Jun 7 21:07 jre-openjdk -&gt; /etc/alternatives/jre_openjdk lrwxrwxrwx 1 root root 21 Jun 7 21:07 jre -&gt; /etc/alternatives/jre lrwxrwxrwx 1 root root 48 Jun 7 21:07 jre-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.arm -&gt; java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.arm/jre drwxr-xr-x 4 root root 4.0K Jun 7 21:06 java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.arm Why there are so many folders for Java and which folder should I use as the Java home? [root@datafireball1 bin]# which java /usr/bin/java [root@datafireball1 bin]# ls -alSh /usr/bin/ | grep java lrwxrwxrwx 1 root root 22 Jun 7 21:07 java -&gt; /etc/alternatives/java Thanks!
has answer: http://stackoverflow.com/a/24102845
answer count: 3
tagged with: environment-variables
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26866982
tagged with: linux
type: UnansweredQuestion

log4j
tags question: http://stackoverflow.com/q/24065988
tags question: http://stackoverflow.com/q/24014955
tags question: http://stackoverflow.com/q/23970310
tags question: http://stackoverflow.com/q/24080736
tags question: http://stackoverflow.com/q/24020916
tags question: http://stackoverflow.com/q/24052884
tags question: http://stackoverflow.com/q/24075976
tag name: log4j
tags question: http://stackoverflow.com/q/24015397
tags question: http://stackoverflow.com/q/24084834
tags question: http://stackoverflow.com/q/23959965
tags question: http://stackoverflow.com/q/24057258
type: Tag
tags question: http://stackoverflow.com/q/24051421
tags question: http://stackoverflow.com/q/23965429
tags question: http://stackoverflow.com/q/24013133
tags question: http://stackoverflow.com/q/24066299

http://stackoverflow.com/a/23982519
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23982437
has body: It is a constant and you will not want to have one copy of the variable for each instance of the class,so make it static. Also, if you want to use them from a static method, make it static. Static variables are those variables which are common for all the instances of a class.If one instance changes it, then value of static variable would be updated for all other instances. If you do not want this behavior, keep it non-static.
downvote count: 0
type: Answer

http://stackoverflow.com/a/24040427
has comment: http://stackoverflow.com/comment/37062323
answers question: http://stackoverflow.com/q/24040208
has body: If you are using Spring you could avoid persistence.xml file and declare instead an entity manager factory like this: All the entities in com.testApp.domain package (marked with @Entity annotation) will be loaded without declaring them in XML. UPDATE You need to declarate a data source, for example: Then you can use the entityManager exactly as you were doing. I suppose you are using something similar in your DAO classes: @PersistenceContext private EntityManager em;
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37062729
accepted answer of: http://stackoverflow.com/q/24040208
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37062859
has comment: http://stackoverflow.com/comment/37062507

http://stackoverflow.com/comment/37141463
type: AnswerComment
comment on: http://stackoverflow.com/a/24083190
has text: ViewScope variables!!! That sounds like an option. I will try that and get back to you. Cheers
score: 0
type: Comment

http://stackoverflow.com/q/24104833
tagged with: spring
has comment: http://stackoverflow.com/comment/37185300
has answer: http://stackoverflow.com/a/27021587
has title: Cannot convert value of type [com.sun.proxy.$Proxy32 ScopedObject
score: 6
upvote count: 7
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/61252150
answer count: 2
has body: I am using spring batch, below are the configurations. &lt;beans:bean id="symfonyJob" class="com.st.symfony.Symfony" p:dir="${symfony.dir}" p:consolePath="${symfony.console.path}" p:strUtil-ref="strUtil" p:logFilePath="${batch.log.file.path}.#{jobParameters[batch_id]}" scope="step"/&gt; &lt;beans:bean id="importExchangesItemWriter" class="com.st.batch.foundation.ImportExchangesItemWriter" p:symfony-ref="symfonyJob" p:replyTimeout="${import.exchanges.reply.timeout}" scope="step"/&gt; &lt;beans:bean id="importExchangesFileItemReader" class="org.springframework.batch.item.file.MultiThreadedFlatFileItemReader" p:resource="file:${spring.tmp.batch.dir}/#{jobParameters[batch_id]}/exchanges.txt" p:lineMapper-ref="stLineMapper" p:startAt="#{stepExecutionContext['startAt']}" p:maxItemCount="#{stepExecutionContext['itemsCount']}" scope="step" /&gt; &lt;step id="importExchangesStep"&gt; &lt;tasklet transaction-manager="transactionManager"&gt; &lt;chunk reader="importExchangesFileItemReader" writer="importExchangesItemWriter" commit-interval="${import.exchanges.commit.interval}" /&gt; &lt;/tasklet&gt; &lt;/step&gt; &lt;job id="importExchangesJob" restartable="true"&gt; &lt;step id="importExchangesStep.master"&gt; &lt;partition partitioner="importExchangesPartitioner" handler="importExchangesPartitionHandler" /&gt; &lt;/step&gt; &lt;/job&gt; Everything was working before I change the scope of symfonyJob and importExchangesItemWriter to scope="step". As soon as I changed scope, I am getting ERROR: org.springframework.batch.core.step.AbstractStep - Encountered an error executing step importExchangesStep in job importExchangesJob org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.importExchangesItemWriter' defined in file [/home/vishal/install/sts-bundle/vfabric-tc-server-developer-2.9.6.RELEASE/base-instance/wtpwebapps/spring/WEB-INF/classes/META-INF/spring/batch/jobs/foundation/steps/import-exchanges.xml]: Initialization of bean fa…
favorite count: 0
tagged with: spring-batch
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24107580

http://stackoverflow.com/comment/43449815
type: Comment
type: QuestionComment
has text: Running again into this problem with total different code... If i read this right: "http://neo4j.com/docs/stable/configuration-io-examples.html#configuration-batchinsert" the batch inserter can only insert data that fits completely into memory ??
comment on: http://stackoverflow.com/q/24065884
score: 0

http://stackoverflow.com/comment/37060030
comment on: http://stackoverflow.com/q/24036928
score: 0
type: Comment
type: QuestionComment
has text: I think you would be better of with extruded tiles in your atlas. http://stackoverflow.com/questions/24038033/why-do-textures-flicker-when-camera-moves/24039064#24039064

http://stackoverflow.com/comment/37067800
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24043361
has text: @RomanC ok but how do i change the fill color of the circle?

http://stackoverflow.com/comment/37132180
type: QuestionComment
comment on: http://stackoverflow.com/q/24076877
has text: ah it is a custom runnable - sorry will need also the HTTPThread class which at this point is the main culprit. can you change the custom stop await with thread joins? http://docs.oracle.com/javase/tutorial/essential/concurrency/join.html
score: 1
type: Comment

http://stackoverflow.com/q/23982971
has body: I have written a Java applet to read in the HTML from one of our intranet systems. My code is as follows: public static String getOrdersInProvisioning(){ try{ URL url = new URL("https://www.internalsystem.net/system//src/order/OrderProvList.cfm"); URLConnection connection = url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; String result; StringBuilder a = new StringBuilder(); while ((inputLine = reader.readLine()) != null) { a.append(inputLine); a.append("\r\n"); } reader.close(); result = a.toString(); return result; }catch (Exception e){ return e.toString(); } } This idea being that I can read in the HTML Source Code (the same code I see when I log into the system, right click on the page and select "View Page Source") and use the resulting string to extract things like order numbers, due dates etc for my applet. I can successfully do this for SOME pages on this intranet system (the URL changes as you move from page to page) but not on others. I must be logged in to the system as a valid user for it to work. On pages where this fails, the resulting HTML code seems to indicate my applet was redirected to some kind of log in page by JavaScript: &lt;SCRIPT LANGUAGE="JavaScript"&gt; self.location='/system//src/Login.cfm?redirect=1'; &lt;/SCRIPT&gt; I have double checked that I am logged into the system and that my applet is running under the correct user account. But for some reason it will only work for particular pages. Upon looking at the HTML source for the pages where this fails, it looks like there a particular piece of JavaScript that I'm guessing is the cause of this redirect. My question is, is there a way to avoid this redirection - or is this Javascript there to prevent exactly what I am trying to do? I have tried using Jsoup with followRedirects(false) and httpConn.addRequestProperty(...) options but all to no avail.
type: Question
tagged with: jsoup
answer count: 1
tagged with: javascript
tagged with: applet
has title: Avoid redirection when reading html source from an Applet
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23997309
score: 1
tagged with: java

http://stackoverflow.com/comment/82811974
type: AnswerComment
type: Comment
has text: Not a proper solution for problem of a main question, but if you're facing that issue during writing tests (like I did), then IMO this is pretty good solution.
comment on: http://stackoverflow.com/a/25340415
score: 0

http://stackoverflow.com/a/24225297
answers question: http://stackoverflow.com/q/24102741
upvote count: 5
has comment: http://stackoverflow.com/comment/58101684
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24102741
type: Answer
has body: You can't use @Path on @Root-Element: The Path annotation is used to specify an XML path where an XML element or attribute is located. ( Source ) Since you want nested data, from somewhere deep in the xml, there are two solutions: Map the whole XML structure Use a Converter that cut's mapping down to few classes and map just those And here's what to do if you choose No. 2: The Plan A SOAPEnvelope class builds just the root-element (<soap:Envelope>...</soap:Envelope>) and holds the list of vehicles A SOAPEnvelopeConverter implements a Converter for SOAPEnvelope - there the serialization is reduced to vehicles list only A class Vehicle holds all the data of those elements (incl. a class Position for the ... elements) A class Vehicles maps the vehicles-tag only (= list of vehicle elements). (Names have no convention) The Implementation I've written an implementation as a reference so you can see how my suggested solution works. Please add error checking etc. All data fields are handled as String's here, replace their types with proper ones. Only the vehicles list is deserialized, all other values are ignored. Constructors, getter / setter etc. are only shown as they are required for this example. The deserialized vehicles list is stored into the envelope's object. This is not the best way and used for example only. Please write a better implementation here (eg. introduce a class for the soap body where you can manage contents). Note: Some classes are implemented as inner classes - this is optional, code as you prefer. Class SOAPEnvelope / Class SOAPEnvelopeConverter (inner) @Root(name = "Envelope") @Namespace(prefix = "soap") // Set the converter that's used for serialization @Convert(value = SOAPEnvelope.SOAPEnvelopeConverter.class) public class SOAPEnvelope { // Keep the content of vehicles list here private Vehicles vehicles; public Vehicles getVehicles() { return vehicles; } protected void setVehicles(Vehicles vehicles) { this.vehicles = vehicles; } // The converte…
has comment: http://stackoverflow.com/comment/58222015

http://stackoverflow.com/q/23948722
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: I'm new in the site and this is my first question. I have and Arduino UNO and i want to build an android app that communicates with a c# web server and the web server sends the data to arduino and the opposite. Arduino does not have any shield (ethernet or wifi) is connected to the laptop with a USB. I have some code where i need a help to fix it and make it work. Here is the c# code: /*************************SERVER*************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading; using System.IO; namespace SocketServer { class Program { static void Main(string[] args) { IPEndPoint ip = new IPEndPoint(IPAddress.Any, 18001); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Bind(ip); socket.Listen(10); Console.WriteLine("Waiting for a client..."); Socket client = socket.Accept(); IPEndPoint clientep = (IPEndPoint)client.RemoteEndPoint; Console.WriteLine("Connected with {0} at port {1}", clientep.Address, clientep.Port); string welcome = "HELLO 1 FROM SERVER"; /*read*/ byte[] data = new byte[200]; int receiveddata = client.Receive(data); Console.WriteLine("Received data from CLIENT1: {0}", System.Text.ASCIIEncoding.ASCII.GetString(data).Trim()); /*write*/ ASCIIEncoding asen = new ASCIIEncoding(); byte[] data2 = new byte[200]; data2 = asen.GetBytes(welcome); int sentdata = client.Send(data2, data2.Length, SocketFlags.None); Console.WriteLine("Sent data from SERVER: {0}", welcome); /*read*/ byte[] data3 = new byte[200]; Console.WriteLine("Receiving data from CLIENT : {0}", "..."); receiveddata = client.Receive(data3); Console.WriteLine("Received data from CLIENT2: {0}", System.Text.ASCIIEncoding.ASCII.GetString(data3).Trim()); /*write*/ byte[] data4 = new byte[200]; data4 = asen.GetBytes("HELLO 2 FROM SERVER"); sentdata = client.Send(data4, data4.Length, SocketFlags.None); client.Close(); socket.Close(); Con…
upvote count: 0
has comment: http://stackoverflow.com/comment/36891249
type: Question
tagged with: c#
tagged with: java
has comment: http://stackoverflow.com/comment/36891218
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36927666
answer count: 1
downvote count: 1
favorite count: 0
has title: control arduino UNO with android app through a c# server
has answer: http://stackoverflow.com/a/28779897

http://stackoverflow.com/q/24099284
upvote count: 0
has answer: http://stackoverflow.com/a/24099293
favorite count: 0
has body: package test; public class test { public static void main(String[] args){ System.out.println(" _______________\n"); System.out.println(" .--H--.| |\n"); System.out.println(" _//_|| || Παγωτά |\n"); System.out.println("[ -| |'--;--------------'\n "); System.out.println(" '-()-()----()"()^^^^^^^()"()' "); } } I have this but i have a problem at: System.out.println(" '-()-()----()"()^^^^^^^()"()' "); Exception: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Syntax error on token "" \'-()-()----()"", invalid Name Syntax error on tokens, delete these tokens at test.test.main(test.java:11) Can anyone help me?? how i solve the prob??
type: UnansweredQuestion
tagged with: syntax
tagged with: java
has title: Java syntax error tokens
has comment: http://stackoverflow.com/comment/37171888
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24099299
score: -1
answer count: 2
tagged with: token

http://stackoverflow.com/a/23965563
downvote count: 0
score: 17
has comment: http://stackoverflow.com/comment/67971044
has comment: http://stackoverflow.com/comment/36927638
answers question: http://stackoverflow.com/q/23955924
upvote count: 17
has comment: http://stackoverflow.com/comment/68079646
has comment: http://stackoverflow.com/comment/79178283
type: Answer
has body: OkHttp doesn't use async sockets at this time. If you're using the async API with enqueue(), the Dispatcher will spin up multiple threads and make multiple concurrent requests. If you use the same OkHttp client for all requests it will limit itself to 5 connections per host.

http://stackoverflow.com/comment/36953765
score: 0
type: Comment
has text: Thanks for your advice, I agree. However, it is a legacy system, we don't have the complete documents, we don't have complete source codes neither. So we have to find a way to fix the OOM problem without changing the original architecture too much. Thanks for any further suggestion.
type: AnswerComment
comment on: http://stackoverflow.com/a/23981271

http://stackoverflow.com/q/24029037
has comment: http://stackoverflow.com/comment/37042420
has answer: http://stackoverflow.com/a/24029094
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37042390
type: UnansweredQuestion
tagged with: multithreading
has title: How to pause and resume a thread in Java game development
upvote count: 0
has comment: http://stackoverflow.com/comment/37074320
tagged with: java
has comment: http://stackoverflow.com/comment/37051634
has comment: http://stackoverflow.com/comment/37043916
type: Question
has answer: http://stackoverflow.com/a/24030592
answer count: 2
has comment: http://stackoverflow.com/comment/37044248
has comment: http://stackoverflow.com/comment/37041351
tagged with: wait
has comment: http://stackoverflow.com/comment/37041437
score: -1
tagged with: notify
has body: I need to know how to pause a thread and resume it after checking a condition. Thread t = new Thread () { public void run() { while(true) { update(); repaint(); try { Thread.sleep(50); } catch(InterruptedException e){} } } }; The above code is my game loop and I need this to be pause and resumed if any condition is checked. I think the thread can be started only once, so we cannot use suspend() nor resume()as it is deprecated. // all imports goes here /** Bouncing Ball (Animation) via custom thread */ public class JavaApplication12 extends JFrame implements KeyListener{ // Define named-constants private static final int CANVAS_WIDTH = 640; private static final int CANVAS_HEIGHT = 600; private static final int UPDATE_INTERVAL = 10; milliseconds int xx = 200; int yy = 500; Shape a1; Shape a2; float das[] = {10.0f}; int f = 20; boolean r = true; Font font = new Font("Arial",Font.ROMAN_BASELINE,f); BasicStroke color = new BasicStroke (10,BasicStroke.CAP_ROUND,BasicStroke.JOIN_BEVEL,10.0f,das,0.0f); GradientPaint dash = new GradientPaint(0,0,Color.BLUE,100,0,Col or.CYAN); Rectangle2D a3; Rectangle2D a12; Rectangle2D a4; Rectangle2D a5; Rectangle2D a6; Rectangle2D a7; Rectangle2D a8; Rectangle2D a9; Rectangle2D a10; Rectangle2D a11; Rectangle2D a13; Rectangle2D a14; Rectangle2D a15; Rectangle2D a16; Rectangle2D a17; Rectangle2D a18; Rectangle2D a19; Rectangle2D a20; Rectangle2D a21; Rectangle2D a22; Rectangle2D a23; Rectangle2D a25; ArrayList s = new ArrayList(); Color c2 = Color.RED; private DrawCanvas canvas; //the drawing canvas (extends JPanel) // Attributes of moving object // top-left (x, y) private int x = 200; private int y = 480; //width and height private int size = 20; //moving speed in x and y directions private int xSpeed = 3; //displacement per step in x and y private int ySpeed = 5; /** Constructor to setup the GUI components */ public JavaApplication12() { canvas = new DrawCanvas(); canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT)); this.…
has comment: http://stackoverflow.com/comment/37052466
has comment: http://stackoverflow.com/comment/37051303

http://stackoverflow.com/q/24082077
has answer: http://stackoverflow.com/a/28819552
type: Question
has comment: http://stackoverflow.com/comment/37139470
tagged with: network-programming
has title: Java - Find Server in network
score: 0
has comment: http://stackoverflow.com/comment/37140319
has comment: http://stackoverflow.com/comment/37139336
has comment: http://stackoverflow.com/comment/37139167
answer count: 1
has comment: http://stackoverflow.com/comment/37139166
has comment: http://stackoverflow.com/comment/37139346
type: UnansweredQuestion
has body: I want to find my Server in my network, when I don't know the ip. So that's the code I have, but it takes really (!) long to test all IPs: for (int j = 1; j &lt; 255; j++) { for (int i = 1; i &lt; 255; i++) { String iIPv4 = "192.168." + j + "."; try { Socket socket = new Socket(); SocketAddress address = new InetSocketAddress(iIPv4 + i, 2652 ); socket.connect(address, 5); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); String fromServer; while ((fromServer = in.readLine()) != null) { if (fromServer.equals("Connected to CC3000")) { System.out.println("CC3000 found! : " + iIPv4 + i); return iIPv4 + i; } } } catch (UnknownHostException e) { } catch (IOException e) { } } } so, whats a better way to find the server? regards
tagged with: sockets
tagged with: java

http://stackoverflow.com/comment/37125531
score: 2
comment on: http://stackoverflow.com/q/24074485
has text: Can you explain why you think it should be 59? (I obviously don't know that language.)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23995209
answers question: http://stackoverflow.com/q/23994321
has body: My aim is to click the input box, which is right next to it To select the following input (ignoring any div structure) elements you can use: //span[contains(text(),'Volume')]/following::input That step will select select zero or more input elements that follow the span selected in the first location step. If you want only the next input, use: //span[contains(text(),'Volume')]/following::input[1]
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36979203
has comment: http://stackoverflow.com/comment/36979444
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36979001
accepted answer of: http://stackoverflow.com/q/23994321
has comment: http://stackoverflow.com/comment/36978377
type: Answer

http://stackoverflow.com/a/23957514
has body: Turns out that Heroku doesn't clean up the build if you don't explicitly configure it using heroku config:set SBT_CLEAN=true as described here.
type: Answer
accepted answer of: http://stackoverflow.com/q/23957174
answers question: http://stackoverflow.com/q/23957174
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/37241107
comment on: http://stackoverflow.com/a/24078182
type: AnswerComment
has text: @emeryville: I elaborate the idea behind the solution. I hope can be useful.
score: 0
type: Comment

http://stackoverflow.com/a/23996797
score: 5
has comment: http://stackoverflow.com/comment/36981879
has comment: http://stackoverflow.com/comment/36981909
has comment: http://stackoverflow.com/comment/36981653
upvote count: 5
has comment: http://stackoverflow.com/comment/36981559
has comment: http://stackoverflow.com/comment/36981058
has comment: http://stackoverflow.com/comment/36981553
downvote count: 0
has body: I would create the new out before closing the old one: PrintStream old = System.out; out = new FileOutputStream(outputfilename, true); System.setOut(new PrintStream(out)); old.close(); This way the old PrintStream is not closed until the new one is created and assigned. At all times there is a valid PrintStream in System.out. There is no need for synchronized block, because everything is in the same thread.
type: Answer
has comment: http://stackoverflow.com/comment/36981000
has comment: http://stackoverflow.com/comment/36982198
has comment: http://stackoverflow.com/comment/36982022
answers question: http://stackoverflow.com/q/23996666

http://stackoverflow.com/q/24059661
type: UnansweredQuestion
has title: Overriding onTouch of Scrollview and call superclass method
has comment: http://stackoverflow.com/comment/37097979
tagged with: touch-event
tagged with: java
has comment: http://stackoverflow.com/comment/37098060
type: Question
has body: I have overridden the onTouch-Event from my activity and the onTouch-Event of my scrollview. Because i've implemented a sliding menu animation. But know the scrollview doesn't scoll. I tried to call the onTouch-Method (of scrollview) from the superclass but it doesn't works. Can i first call the superclass method in the onTouch-Event (of Scrollview) and then call my own method (overridden onTouch of activity) for the sliding menu? svMetaData.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { ScrollView sv = (ScrollView)v; sv.onTouchEvent(event); return onTouchEvent(event); } }); The onTouch-Method behind the return statement is the overridden method (onTouch of activity). Without overriding the onTouch-Event of the scrollview, the sliding animation only works when i touch the screen outside of the scrollview.
has comment: http://stackoverflow.com/comment/37097800
has comment: http://stackoverflow.com/comment/37099235
score: 0
tagged with: android
tagged with: events
has comment: http://stackoverflow.com/comment/37097923
tagged with: scrollview
answer count: 0

http://stackoverflow.com/q/24092482
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/24092755
has comment: http://stackoverflow.com/comment/37159424
favorite count: 0
tagged with: android
upvote count: 1
possible better answer: http://stackoverflow.com/a/24109712
has body: it seems as though i cannot get the draw method to work??? it seems as though the bullet.draw(batcher) does not work and i cannot understand why as the bullet is a sprite. i have made a Sprite[] and added them as animation. could that be it? i tried batcher.draw(AssetLoader.bulletAnimation.getKeyFrame(runTime), bullet.getX(), bullet.getY(), bullet.getOriginX() / 2, bullet.getOriginY() / 2, bullet.getWidth(), bullet.getHeight(), 1, 1, bullet.getRotation()); but that dont work, the only way it draws is this batcher.draw(AssetLoader.bulletAnimation.getKeyFrame(runTime), bullet.getX(), bullet.getY()); below is the code. // this is in a Asset Class texture = new Texture(Gdx.files.internal("SpriteN1.png")); texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); bullet1 = new Sprite(texture, 380, 350, 45, 20); bullet1.flip(false, true); bullet2 = new Sprite(texture, 425, 350, 45, 20); bullet2.flip(false, true); Sprite[] bullets = { bullet1, bullet2 }; bulletAnimation = new Animation(0.06f, bullets); bulletAnimation.setPlayMode(Animation.PlayMode.LOOP); // this is the GameRender class public class GameRender() { private Bullet bullet; private Ball ball; public GameRenderer(GameWorld world) { myWorld = world; cam = new OrthographicCamera(); cam.setToOrtho(true, 480, 320); batcher = new SpriteBatch(); // Attach batcher to camera batcher.setProjectionMatrix(cam.combined); shapeRenderer = new ShapeRenderer(); shapeRenderer.setProjectionMatrix(cam.combined); // Call helper methods to initialize instance variables initGameObjects(); initAssets(); } private void initGameObjects() { ball = GameWorld.getBall(); bullet = myWorld.getBullet(); scroller = myWorld.getScroller(); } private void initAssets() { ballAnimation = AssetLoader.ballAnimation; bulletAnimation = AssetLoader.bulletAnimation; } public void render(float runTime) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); batcher.begin(); // Disable transparency // This is good for performanc…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24109712
has title: libgdx won't draw sprite or animation
has comment: http://stackoverflow.com/comment/37159363
tagged with: java
has answer: http://stackoverflow.com/a/24092755
tagged with: draw
type: Question
answer count: 2
tagged with: libgdx

http://stackoverflow.com/comment/36904270
has text: Hmm that surely is a possibility but with friends... that is not appropriate for the project I'm working on. These classes are _entirely_ independant of eachother and the classes that utilize this Oeuvre should not know _anything_ about the objects except to make instances of them... unless I make some class that stores Objects, but that would be redundant and inefficient... why make copies of a variable? Its has already been stored/initialized once.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23954987

http://stackoverflow.com/q/24048046
has comment: http://stackoverflow.com/comment/37078015
has comment: http://stackoverflow.com/comment/37077000
has answer: http://stackoverflow.com/a/24060330
has comment: http://stackoverflow.com/comment/37077762
has comment: http://stackoverflow.com/comment/37077818
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37077508
tagged with: java
has answer: http://stackoverflow.com/a/24060329
has title: IllegalArgumentException from drawImage in Graphics2D on Windows
has comment: http://stackoverflow.com/comment/37077292
type: Question
tagged with: graphics
answer count: 2
has body: I'm getting following error on windows (but not on OSX): Exception in thread "Engine" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be &lt;= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) at java.awt.image.BufferedImage.&lt;init&gt;(Unknown Source) at sun.java2d.pipe.DrawImage.renderImageXform(Unknown Source) at sun.java2d.d3d.D3DDrawImage.renderImageXform(Unknown Source) at sun.java2d.pipe.DrawImage.transformImage(Unknown Source) at sun.java2d.pipe.DrawImage.scaleImage(Unknown Source) at sun.java2d.pipe.DrawImage.scaleImage(Unknown Source) at sun.java2d.pipe.ValidatePipe.scaleImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at sun.java2d.SunGraphics2D.drawImage(Unknown Source) at simpleEngine.graphics.GameGraphics.drawGameObject(GameGraphics.java:27) with the following code: public void drawGameObject(GameObject obj, BufferedImage image) { graphics2d.rotate(obj.getRotation(), obj.getX() + obj.getWidth()/2, obj.getY() + obj.getHeight()/2); graphics2d.drawImage(image, (int) obj.getX(), (int) obj.getY(), (int) obj.getWidth(), (int) obj.getHeight(), null); graphics2d.rotate(-obj.getRotation(), obj.getX() + obj.getWidth()/2, obj.getY() + obj.getHeight()/2); } GameObject is an object to represent in a space. It has the fields position (double x and y), size (double width and height) and rotation (double in rads) and getters and setters for mentioned fields. What I don't understand is where the zero height and width comes from. In this instance the obj has the width and height of 30, the image has the width and height of 535. Any and all help will be appreciated! Thanks in advance! EDIT: The reference to the Graphics2D object is supplied when the class is initiated. The class which this method is from is a wrapper around Graphics2D with methods that simplify work in my project. When I retrieve the Graphics2D I wrap it in this class and pass that along. (Thanks to MadProgrammer to point o…
score: 0

http://stackoverflow.com/a/24066668
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24066550
upvote count: 1
has body: This is the culprit: public static void addEmployeeToList(Employee e) { for (int loop = 0; loop &lt; employees.length; loop++) { // check there is a space if (employees[loop] == null) { // add it to free space employees[loop] = e; } } } It just sets all the employees in the list to the argument with which the function is first called; when you first call it, employees is full of null elements, so the condition is always true; but the second, third etc. time you call it, all the elements are set to the generalEmployee. A quick fix would be: public static void addEmployeeToList(Employee e) { for (int loop = 0; loop &lt; employees.length; loop++) { // check there is a space if (employees[loop] == null) { // add it to free space employees[loop] = e; break; } } } But I strongly suggest using an ArrayList. ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); //here you declare a dinamically resizing list. employees.add(e) //this is how you add a new Employee to the list.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24066550
has comment: http://stackoverflow.com/comment/37112703
type: Answer

http://stackoverflow.com/comment/37021018
type: QuestionComment
comment on: http://stackoverflow.com/q/24018250
has text: @PaulRichter I try to get the image Format : PNG, JPG,...
score: 0
type: Comment

http://stackoverflow.com/q/23958969
has body: I am trying to encrypt some simple message with pidCrypt in browser, then decrypt it with java crypto on the server. But I kept getting the error message: javax.crypto.IllegalBlockSizeException: Data must not be longer than 128 bytes Keys: keys are generated with openssl genrsa (sslery). The private key then converted to pkcs#8 der format and read into java code JS code snippet: /*---* ENCRYPT: RSA 1024 bit ---------*/ // public key var params = certParser(publickey); var key = pidCryptUtil.decodeBase64(params.b64); // new RSA instance var rsa = new pidCrypt.RSA(); /* RSA encryption * get the modulus and exponent from certificate (ASN1 parsing) * pem(Array of Bytes) */ // ASN1 parsing var asn = pidCrypt.ASN1.decode(pidCryptUtil.toByteArray(key)); var tree = asn.toHexTree(); // setting the public key for encryption with retrieved ASN.1 tree rsa.setPublicKeyFromASN(tree); /*** encrypt */ var crypted = rsa.encrypt(plaintext); //var crypted64 = pidCryptUtil.encodeBase64(crypted); java code snippet: Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, myPrivKey); byte[] descryptedData = cipher.doFinal(cyphertext.getBytes());
linked to: http://stackoverflow.com/q/10007147
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36913297
answer count: 0
has title: rsa js pidCrypt encryption java decryption
tagged with: java
tagged with: rsa
upvote count: 1
downvote count: 1
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/36911945
has comment: http://stackoverflow.com/comment/36911921
tagged with: pidcrypt
tagged with: openssl
score: 0

http://stackoverflow.com/comment/36961828
type: Comment
has text: I do thank you for the clarification on it, but that was essentially my understanding up to this point already. My main issue is why Java has this (apparent) limitation, and potential workarounds
comment on: http://stackoverflow.com/a/23986674
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37087809
type: Comment
has text: Thank you for your valuable information. I just heard that Apache cxf with osgi is also good to use for this situation. May i konw which one is best?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24052309

http://stackoverflow.com/a/23965204
answers question: http://stackoverflow.com/q/23965046
accepted answer of: http://stackoverflow.com/q/23965046
type: AcceptedAnswer
has body: Here is the code I used (almost exactly copy/pasted) which gives a correct answer: public class Testtest { public static void main(String[] args) { char a[] = "NO70JE3A4Z28X1GBQKFYLPDVWCSHUTM65R9I".toCharArray(); // line added to have array "a" int rcounter = 1; int ccounter = 1; Map&lt;String, String&gt; soup = new HashMap&lt;String, String&gt;(); for (int i = 0; i &lt; a.length; i++) { if (ccounter == 7) { ccounter = 1; rcounter++;} String row = Integer.toString(rcounter); String column = Integer.toString(ccounter); soup.put(new String(""+a[i]), row + column); // line changed to add a String, not a Char, to HashMap ccounter++; if (i == 36) { break; } System.out.println(row+column); } System.out.println("result: " + soup.get("N") + soup.get("I")); // changed to display result, rather than return it } } With this code, with almost no changes, and using the String you provided, I get a correct result: result: 1166 I believe, as hinted by @alfasin, that the problem is in the way you're initialising your char array a, and that one parasite character is appearing at the first place, right at the beginning of the string.
downvote count: 0
has comment: http://stackoverflow.com/comment/36924138
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36922321
score: 1

http://stackoverflow.com/comment/36942125
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23976071
has text: Thanks a lot man, it works much better now! :D however, when I tried for example 6.6 * 6, the result became 39,5999999994 instead of just 39.6 Why? :/ With some values it doesn't do that (e.g. 2.4*2 = 4.8)

http://stackoverflow.com/comment/37012019
comment on: http://stackoverflow.com/q/24009149
score: 0
type: QuestionComment
type: Comment
has text: I should have thought of that. I don't think it will solve the problem, but still a very good point, thanks.

http://stackoverflow.com/comment/37066270
has text: @Speakwithsystem: If you **only** want to open the file for view, then why do you want to save it too (and btw, doesn't your question say that you **don't** want to create a file). And why should a file be uploaded, that's just been retrieved from the server?
type: QuestionComment
comment on: http://stackoverflow.com/q/24042095
score: 0
type: Comment

http://stackoverflow.com/q/23985036
has body: I'm having trouble on how to make this program be put on a JFrame. I'm not sure exactly how to do it. It would be great if anyone gave me some help. Thank you very much I appreciate it. Help anyone :/? package VendMach; import java.util.Scanner; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JFrame; public class VendMachMain extends JComponent { public static class groceryshopping{ public static void main(String args[]){ Scanner input = new Scanner(System.in); int choice = 1; double subtotal = 0; double price = 0; double discount = 0; do { System.out.println( "Quick Deli" + "\n" +"1. Lunchables $ 1.99 per box" + "\n" + "2. Chips $ 0.99 per bag" + "\n" + "3. Chocolate Bars $ 0.99 each" + "\n" + "4. Soda $ 0.99 a can" + "\n" + "5. Cold Cut Sandwiches $ 2.99 each" + "\n" + "6. Apple Slices $ 0.75 per bag" + "\n" + "7. Juice Boxes $ 0.99 each" + "\n" + "8. Cinnabons $ 0.99 each" + "\n" + "9. Cookies $ 1.99 per bag" + "\n" + "10.Gum $ 1.15 per pack" + "\n" + " " + "\n" + "0. Quit" + "\n" + " " + "\n" + "Your subtotal is $ " +(int)(subtotal * 100) / 100.0 + "\n" ); System.out.println("What would you like to purchase? \nIf you have completed your checkout, enter 0."); choice = input.nextInt(); if (choice == 0) break; System.out.println("How many do you want?"); int qty = input.nextInt(); switch (choice) { case 1: price = 1.99; break; case 2: price = 0.99; break; case 3: price = 0.99; break; case 4: price = 0.99; break; case 5: price = 2.99; break; case 6: price = 0.75; break; case 7: price = 0.99; break; case 8: price = 0.99; break; case 9: price = 1.99; break; case 10: price = 1.15; } subtotal = subtotal + (qty * price); } while(choice &gt; 0); System.out.println("Do you have the special discount card? (Y/N)"); String discountInput = input.next(); char discountClub = discountInput.charAt(0); if (discountClub == 'y' || discountClub == 'Y'){ discount = subtotal * .20; } double tax = ((subtotal - discount) * 0.075); double finalCost = subto…
has comment: http://stackoverflow.com/comment/36958809
answer count: 3
upvote count: 0
accepted answer: http://stackoverflow.com/a/23985286
has title: How to put this program on a Jframe?
favorite count: 0
linked to: http://stackoverflow.com/q/21025171
tagged with: joptionpane
linked to: http://stackoverflow.com/q/21010799
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23985081
tagged with: jframe
possible better answer: http://stackoverflow.com/a/23985222
has answer: http://stackoverflow.com/a/23985222
has answer: http://stackoverflow.com/a/23985286
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36960677
has comment: http://stackoverflow.com/comment/36960385
tagged with: java
tagged with: jpanel
score: -1

http://stackoverflow.com/a/24022218
score: 2
has comment: http://stackoverflow.com/comment/37028836
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24021890
accepted answer of: http://stackoverflow.com/q/24021890
upvote count: 2
type: Answer
has body: if json string starts with [ then its array if json string starts with { then its object ["friends": ===> is array thus: JsonArray jsonArr = new JsonArray(json); JsonObject jsonObj = jsonArr.getJSONObject(0);

http://stackoverflow.com/a/24035781
has comment: http://stackoverflow.com/comment/37053583
has comment: http://stackoverflow.com/comment/37059886
has comment: http://stackoverflow.com/comment/37061401
has comment: http://stackoverflow.com/comment/37058529
has comment: http://stackoverflow.com/comment/37061555
has comment: http://stackoverflow.com/comment/37060570
upvote count: 3
has comment: http://stackoverflow.com/comment/37058932
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37061560
has body: public class TheCompany extends Activity implements OnMenuItemClickListener{ public static final float screen_width; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.the_company); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); screen_width = metrics.widthPixels; } } Then in your page do this : ImageView imageView = (ImageView) findViewById(R.id.imageView2); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { float scale = TheCompany.screen_width / view.getWidth(); if(view.getScaleX() == 1) { view.setScaleY(scale); view.setScaleX(scale); }else{ view.setScaleY(1); view.setScaleX(1); } } });
has comment: http://stackoverflow.com/comment/37060862
accepted answer of: http://stackoverflow.com/q/24035473
has comment: http://stackoverflow.com/comment/37058600
has comment: http://stackoverflow.com/comment/37058726
answers question: http://stackoverflow.com/q/24035473
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/37058636
has comment: http://stackoverflow.com/comment/37060150
has comment: http://stackoverflow.com/comment/37060527

http://stackoverflow.com/q/24047560
tagged with: java
has comment: http://stackoverflow.com/comment/37076148
has comment: http://stackoverflow.com/comment/37076025
score: 0
has answer: http://stackoverflow.com/a/24047742
accepted answer: http://stackoverflow.com/a/24047742
has body: I am writing a program to emulate the windows calculator in java. I have most of the graphics down, but when I add in the text area (the display), it destroys the formatting, and doesn't even put a display in. One interesting thing is that before the text area is put in, most of the buttons only display "..." instead of their actual value. Presumably, this is because the text is too big for the buttons, however, with the display added in, those buttons suddenly get big enough to display the full text on the button and it becomes too wide for the frame. import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Calculator extends JFrame implements ActionListener { public static Scanner in = new Scanner(System.in); //sets up each JButton JButton[] button = new JButton[28]; JTextArea display = new JTextArea(1,20); //sets up all the text to put on the buttons String[] buttonString = {"MC", "MR", "MS", "M+", "M-", "&lt;-", "CE", "C", "+/-", "squ", "7", "8", "9", "/", "%", "4", "5", "6", "*", "1/x", "1", "2", "3", "-", "=", "0", ".", "+"}; //sets up the boolean values for the different operations boolean[] function = {false,false,false,false}; //temporary double values for each number to be for each operation double temp1 = 0, temp2 = 0; //set all font to Times New Roman size 13 Font font = new Font("Times New Roman", Font.PLAIN, 12); public static void main(String[] args) { //creates calculator Calculator calc = new Calculator(); } public Calculator() { //makes a calculator with title and size super("Calculator"); setDesign(); setSize(210,261); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(3,2,2,3); int count = 0; /*c.gridx = 0; c.gridy = 0; display.setEditable(false); display.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); display.setPreferredSize(new Dimension(190,50)); c.gridwidth = 5; displa…
upvote count: 1
answer count: 1
downvote count: 1
tagged with: calculator
favorite count: 0
has title: Why does my calculator program break when a display is added?
type: AnsweredQuestion
tagged with: jframe
type: Question
linked to: http://stackoverflow.com/q/23974009
has comment: http://stackoverflow.com/comment/37076081
tagged with: jtextarea

http://stackoverflow.com/q/23988043
has comment: http://stackoverflow.com/comment/36967302
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36966398
tagged with: playframework
has body: I am having problems with accessing file in public directory after deployment. The stage command give me a folder target\universal\bin where my .exe file is. In development mode I used to upload my files to public\uploads\pictures and access them from this location. But, after deployment I am unable to upload the pictures. I read this Stack Link that has two options. Is it possible to define a folder directory that is not absolute. Application Conf myUploadPath="public/Upload/Pictures/" Accessing folder String myUploadPath = Play.application().configuration() .getString(myUploadPath); Please tell me a solution to overcome this..
downvote count: 0
answer count: 1
tagged with: playframework-2.2
favorite count: 0
has title: Playframework 2.2 : Uploaded Files in Public directory not accessible
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11451246
has answer: http://stackoverflow.com/a/23989892
score: 1
tagged with: java

http://stackoverflow.com/q/24042908
has comment: http://stackoverflow.com/comment/37067087
tagged with: java
tagged with: url-pattern
has answer: http://stackoverflow.com/a/24057509
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/24044702
downvote count: 0
tagged with: tomcat
has title: url-pattern /* serves jsp files and static assets as seperate requests
accepted answer: http://stackoverflow.com/a/24057509
has answer: http://stackoverflow.com/a/24044476
has comment: http://stackoverflow.com/comment/37066932
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24054892
tagged with: web.xml
has comment: http://stackoverflow.com/comment/37067234
upvote count: 2
possible better answer: http://stackoverflow.com/a/24044476
has body: I have a simple servlet which renders different content based on different geo locations for example: example.com/us example.com/de example.com/uk example.com/.. so actually the servlet should supports all geo locations as url-pattern. So thats why I defined the rule below in my web.xml file: &lt;servlet-mapping&gt; servlet-name&gt;MyServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; this is how the servlet look like: public class MyServlet extends HttpServlet{ String showPage = "/pages/show.jsp"; public void doGet(HttpServletRequest request, HttpServletResponse response){ System.out.println("servlet initiated... ~&gt; "+request.getRequestURI()); ... request.getRequestDispatcher(showPage).forward(request, response); } } As soon as I try to forward the page, the servlet starts again and again; it tries to also handle the request /page/show.jsp. So I get such an ouput when I try to access example.com/us: servlet initiated... ~&gt; /us servlet initiated... ~&gt; /page/show.jsp Exception... servlet initiated... ~&gt; /page/show.jsp Exception... servlet initiated... ~&gt; /page/show.jsp ... It throws an exception because my servlet is not expecting such a url-pattern /page/show.jsp but it triggers because I have define /* url-pattern in my web.xml file. Any idea? how can I skip or exclude the unwanted requests like the one above? Thanks.
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/23954876
has answer: http://stackoverflow.com/a/23955554
has body: I tried to use read() method from InputStream class but it blocks the thread, and i tried readLine() method that blocks the thread too. After this attempts I used this: public static void main(String[] args) throws IOException{ Socket s = new Socket(); String host = ""; s.connect(new InetSocketAddress(host, 23)); Response response = new Response(s); response .start(); if(response .isInterrupted()){ System.out.println(response .getSb().toString()); } } public class Response extends Thread { Socket s; BufferedReader s_in = null; InputStream in = null; private StringBuffer sb = new StringBuffer(); public Response(Socket s){ this.s = s; } @Override public void run() { try { s_in = new BufferedReader(new InputStreamReader(s.getInputStream())); in = s.getInputStream(); char ch; int i; while(!Thread.currentThread().isInterrupted()){ i = s_in.read(); ch = (char) i; System.out.print(ch); getSb().append(getSb()); } System.out.print(getSb()); } catch (IOException ex) { Logger.getLogger(Response.class.getName()).log(Level.SEVERE, null, ex); } } public StringBuffer getSb() { return sb; } } public class Message extends Thread{ Socket s; PrintWriter s_out = null; public Message(Socket s){ this.s = s; } @Override public void run(){ try { s_out = new PrintWriter(s.getOutputStream(), true); } catch (IOException ex) { Logger.getLogger(Message.class.getName()).log(Level.SEVERE, null, ex); } } } But when I run the application the socket does not have enough time to send all the data to InputStream. So, I might verify when the stream ends. To start reading. Thanks for helping !
tagged with: telnet
tagged with: java
tagged with: stream
has title: Read data from InputStream using Threads
type: Question
score: 0
answer count: 1
type: UnansweredQuestion

junit
type: Tag
tags question: http://stackoverflow.com/q/23955273
tags question: http://stackoverflow.com/q/24052474
tags question: http://stackoverflow.com/q/23979578
tags question: http://stackoverflow.com/q/24043349
tags question: http://stackoverflow.com/q/24004597
tags question: http://stackoverflow.com/q/24038853
tags question: http://stackoverflow.com/q/24012699
tags question: http://stackoverflow.com/q/23941763
tags question: http://stackoverflow.com/q/24042592
tags question: http://stackoverflow.com/q/24084973
tags question: http://stackoverflow.com/q/24077002
tags question: http://stackoverflow.com/q/23958611
tags question: http://stackoverflow.com/q/24054581
tags question: http://stackoverflow.com/q/23963155
tags question: http://stackoverflow.com/q/24053861
tags question: http://stackoverflow.com/q/24084573
tag name: junit
tags question: http://stackoverflow.com/q/24011673
tags question: http://stackoverflow.com/q/24093000
tags question: http://stackoverflow.com/q/23984756
tags question: http://stackoverflow.com/q/24026830
tags question: http://stackoverflow.com/q/24014456
tags question: http://stackoverflow.com/q/24061849
tags question: http://stackoverflow.com/q/23960060
tags question: http://stackoverflow.com/q/23979065
tags question: http://stackoverflow.com/q/24099056
tags question: http://stackoverflow.com/q/24039184
tags question: http://stackoverflow.com/q/24096723
tags question: http://stackoverflow.com/q/23985235
tags question: http://stackoverflow.com/q/23993645
tags question: http://stackoverflow.com/q/23984002
tags question: http://stackoverflow.com/q/23959976
tags question: http://stackoverflow.com/q/24077703
tags question: http://stackoverflow.com/q/23960202
tags question: http://stackoverflow.com/q/24038842
tags question: http://stackoverflow.com/q/24030470
tags question: http://stackoverflow.com/q/24032092
tags question: http://stackoverflow.com/q/23996168
tags question: http://stackoverflow.com/q/24072579
tags question: http://stackoverflow.com/q/24053886
tags question: http://stackoverflow.com/q/24096532
tags question: http://stackoverflow.com/q/23945969
tags question: http://stackoverflow.com/q/24001032
tags question: http://stackoverflow.com/q/24045109
tags question: http://stackoverflow.com/q/24084265
tags question: http://stackoverflow.com/q/24017089
tags question: http://stackoverflow.com/q/23945073
tags question: http://stackoverflow.com/q/23983907
tags question: http://stackoverflow.com/q/23959039

http://stackoverflow.com/comment/126706112
type: AnswerComment
comment on: http://stackoverflow.com/a/30836489
type: Comment
has text: This won't work if the stream is parallel.
score: 1

node.js
tags question: http://stackoverflow.com/q/24039017
tags question: http://stackoverflow.com/q/24081179
tags question: http://stackoverflow.com/q/24084155
tags question: http://stackoverflow.com/q/24013245
type: Tag
tags question: http://stackoverflow.com/q/24059028
tag name: node.js
tags question: http://stackoverflow.com/q/24065089

http://stackoverflow.com/q/24054469
has answer: http://stackoverflow.com/a/25865982
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: How to add and in XML prepared by Jaxb
has answer: http://stackoverflow.com/a/25832468
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25846965
tagged with: cdata
tagged with: java
has answer: http://stackoverflow.com/a/25880474
tagged with: jaxb
type: Question
score: 12
upvote count: 12
linked to: http://stackoverflow.com/q/3136375
downvote count: 0
has body: How to prepare XML with CDATA , I am preraring this response via Jaxb, &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"&gt; &lt;SOAP-ENV:Header/&gt; &lt;soapenv:Body&gt; &lt;tem:RequestData&gt; &lt;tem:requestDocument&gt; &lt;![CDATA[ &lt;Request&gt; &lt;Authentication CMId="68" Function="1" Guid="5594FB83-F4D4-431F-B3C5-EA6D7A8BA795" Password="poihg321TR"/&gt; &lt;Establishment Id="4297867"/&gt; &lt;/Request&gt; ]]&gt; &lt;/tem:requestDocument&gt; &lt;/tem:RequestData&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; But from Jaxb i am not getting CDATA , how to put CDATA inside &lt;tem:requestDocument&gt; element. Here is my Java Code : public static String test1() { try { initJB(); String response = null; StringBuffer xmlStr = null; String strTimeStamp = null; com.cultagent4.travel_republic.gm.Envelope envelope = null; com.cultagent4.travel_republic.gm.Header header = null; com.cultagent4.travel_republic.gm.Body body = null; com.cultagent4.travel_republic.gm.RequestData requestData = null; com.cultagent4.travel_republic.gm.RequestDocument requestDocument = null; com.cultagent4.travel_republic.gm.RequestDocument.Request request = null; com.cultagent4.travel_republic.gm.RequestDocument.Request.Authentication authentication = null; com.cultagent4.travel_republic.gm.RequestDocument.Request.Establishment establishment = null; ObjectFactory objFact = new ObjectFactory(); envelope = objFact.createEnvelope(); header = objFact.createHeader(); envelope.setHeader(header); body = objFact.createBody(); requestData = objFact.createRequestData(); requestDocument = objFact.createRequestDocument(); request = new RequestDocument.Request(); authentication = new RequestDocument.Request.Authentication(); authentication.setCMId("68"); authentication.setGuid("5594FB83-F4D4-431F-B3C5-EA6D7A8BA795"); authenticati…
answer count: 6
has answer: http://stackoverflow.com/a/25833721
has answer: http://stackoverflow.com/a/25766358

http://stackoverflow.com/a/24088845
type: Answer
has body: Just to have this answered here as well: The native libraries can not be packed directly into a JAR (or rather: They can currently not be loaded if they are only contained in the JAR). Although the infrastructure of the JCuda LibUtils class basically offers the possibility to do this, it is not "officially" supported. One reason for that is that this would only make sense when all native libraries for all operating systems were available (in 32 and 64 bit). Then it would be possible to put all these libraries into a JAR, and unpack and load them transparently at runtime. It usually takes a while until all native libraries are available. The problem may be alleviated with things like https://github.com/MysterionRise/mavenized-jcuda , which manages the dependencies to the native libraries.
score: 2
answers question: http://stackoverflow.com/q/24085347
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24085347
upvote count: 2

http://stackoverflow.com/comment/37096152
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24058657
has text: Right, I forgot to describe the transaction management. Please look at the XML I pasted into the question. About the interfaces - every class in my project use the interface based approach. And I autowire with the interface as well.
type: AnswerComment

http://stackoverflow.com/q/24001821
has title: Regular expression to filter URLs that have more than one ampersand "&"
accepted answer: http://stackoverflow.com/a/24001870
tagged with: regex
has body: I am using a web-crawler(called Nutch) which crawls the web when I feed in a bunch of urls into it. I set certain regular expression filters to control the crawler to specific domains and specific filters. # skip URLs containing a back slash -[\\] # skip URLS containing more than 6 levels -^http://([a-zA-Z.-]+)/(?:[^/]+/){6,}.*$ # crawl only domain abc +^http://www.abc.xx.yyy.zzz/pubs/([a-z]+) Issue: Within the specific domain, my crawler is crawling all search form urls with all the pagination and query parameters which I don't want. Examples are: http://www.abc.xx.yyy.zzz/pubs/biblio_results.asp?Library=ABC&amp;SubjectScope=keyword&amp;SubjectMode=contains&amp;SubjectText=abc_archive&amp;URLs=yes&amp;Order=year&amp;SortOrder=DESC&amp;Abstracts=no I am not sure how to set a regular expression to let my crawler ignore any such URL like the example above that has more than one "&amp;" sign in its URL path. On a side note, is it a good idea to ignore such URLs while building a search engine?
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24001857
tagged with: nutch
type: Question
possible better answer: http://stackoverflow.com/a/24001867
tagged with: java
has answer: http://stackoverflow.com/a/24001870
has answer: http://stackoverflow.com/a/24001867
answer count: 3

http://stackoverflow.com/q/24039229
tagged with: user-interface
has body: Is there any way to find the center of the round rectangle? And keeping in mind that the round rectangle changes its co-ordinates using a key listener. a= new RoundRectangle(10,10,10,10,10,10)
has comment: http://stackoverflow.com/comment/37059916
favorite count: 0
has comment: http://stackoverflow.com/comment/37060273
has comment: http://stackoverflow.com/comment/37061114
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24039429
tagged with: java
has title: finding the center of round rectangle in java game programming
type: Question
tagged with: graphics
upvote count: 2
has answer: http://stackoverflow.com/a/24039306
accepted answer: http://stackoverflow.com/a/24039306
score: 0
possible better answer: http://stackoverflow.com/a/24039429
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/37060305

http://stackoverflow.com/q/23977538
has comment: http://stackoverflow.com/comment/36944557
type: Question
tagged with: keyvaluepair
possible better answer: http://stackoverflow.com/a/23977576
answer count: 2
has answer: http://stackoverflow.com/a/23977591
has answer: http://stackoverflow.com/a/23977576
downvote count: 0
has comment: http://stackoverflow.com/comment/36944553
tagged with: substring
has comment: http://stackoverflow.com/comment/36944542
favorite count: 0
accepted answer: http://stackoverflow.com/a/23977591
has title: How to parse pipe-separated Attribute=Values pairs?
has body: I have string b="Name=Paul Roberts|Telephone=|Address=|City=LA"; I have been trying all day to get the output Attribute-Value pairs without equal and pipes signs. I have more then 4 results but this is what I want to achieve: Output (separate each pair because I have to put those two values into the fields of some table): Name Paul Roberts Telephone Address City LA So you can notice that VALUE can be null(empty). I tried with SUBSTRING (maybe there is better way) but getting wrong results: static String b="Name=Paul Roberts|Telephone=|Address=|City=LA"; public static void main(String[] args) { System.out.println("b="+b); String match = "="; int i =0; while((i=(b.indexOf(match,i)+1))&gt;0) { String c=b.substring(0,i-1); String d=b.substring(i); String match2="|"; int k=b.indexOf(match2); System.out.println("Attribute="+c); int j=d.indexOf(match2); if (j&gt;-1) { String e=d.substring(0,j); System.out.println("Value="+e); } if (k&gt;-1) { b=b.substring(k+1,b.length()); } } } I am close to the correct result but this is what I am getting: b=Name=Paul Roberts|Telephone=|Address=|City=LA Attribute=Name Value=Paul Roberts Attribute=Telephone Value= Attribute=Address=|City So you can notice that last row is not correct and I am missing two rows. Also is this with SUBSTRING most efficient way?
tagged with: indexing
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/36896970
type: Comment
comment on: http://stackoverflow.com/q/23952068
score: 2
type: QuestionComment
has text: First problem: you're trying to run a program that doesn't compile. Always fix compilation errors *before* running the code. That way you don't have to get as far as the broken part to find out it's broken...

http://stackoverflow.com/a/24008804
answers question: http://stackoverflow.com/q/24008676
score: 1
upvote count: 1
type: Answer
has body: try (//div[@class='ctrl-column']/span[@data-bind='html: DisplayTotalrenewalFee'])[1] (//div[@class='ctrl-column']/span[@data-bind='html: DisplayTotalrenewalFee'])[2] for the first and second values respectively.
downvote count: 0

http://stackoverflow.com/q/23963362
tagged with: eclipse
tagged with: apache-storm
type: Question
has comment: http://stackoverflow.com/comment/36918876
score: 0
has comment: http://stackoverflow.com/comment/36933339
has body: I got the following output after doing command "mvn eclipse:eclipse". It showed that the build is successful but no java project was built there. I could not figure out why. [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for storm.cookbook:hello-world:jar:0.0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 105, column 9 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building hello-world 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] &gt;&gt;&gt; maven-eclipse-plugin:2.9:eclipse (default-cli) @ hello-world &gt;&gt;&gt; [INFO] [INFO] &lt;&lt;&lt; maven-eclipse-plugin:2.9:eclipse (default-cli) @ hello-world &lt;&lt;&lt; [INFO] [INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ hello-world --- [INFO] Using Eclipse Workspace: null [INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER [INFO] Wrote settings to /home/junfu/RESEARCH/HelloWorld/.settings/org.eclipse.jdt.core.prefs [INFO] Wrote Eclipse project for "hello-world" to /home/junfu/RESEARCH/HelloWorld. [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.896 s [INFO] Finished at: 2014-05-30T15:55:26-06:00 [INFO] Final Memory: 10M/114M [INFO] ------------------------------------------------------------…
type: UnansweredQuestion
tagged with: maven
has title: Using Maven to build Storm project but cannot find the resulted java project
tagged with: build
has comment: http://stackoverflow.com/comment/36918692
answer count: 0
tagged with: java

multidimensional-array
tags question: http://stackoverflow.com/q/24008589
type: Tag
tags question: http://stackoverflow.com/q/24032698
tags question: http://stackoverflow.com/q/24062494
tags question: http://stackoverflow.com/q/23951001
tags question: http://stackoverflow.com/q/24056448
tags question: http://stackoverflow.com/q/23985057
tags question: http://stackoverflow.com/q/24102910
tags question: http://stackoverflow.com/q/24075240
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/24094572
tags question: http://stackoverflow.com/q/23951999

http://stackoverflow.com/comment/36902452
comment on: http://stackoverflow.com/a/23952920
score: 0
type: Comment
has text: @user1408341: At the point when "the user again confirms that data should be no longer sended", call `cancel()` on `AlarmManager`. You will probably *also* want to persist this information, so you know on a reboot whether you should be setting up the alarms or not.
type: AnswerComment

android-asynctask
tags question: http://stackoverflow.com/q/24092915
tags question: http://stackoverflow.com/q/24066487
tags question: http://stackoverflow.com/q/24002066
type: Tag
tags question: http://stackoverflow.com/q/24012575
tags question: http://stackoverflow.com/q/24010499
tags question: http://stackoverflow.com/q/24049716
tag name: android-asynctask
tags question: http://stackoverflow.com/q/23962774
tags question: http://stackoverflow.com/q/24076625
tags question: http://stackoverflow.com/q/23946833
tags question: http://stackoverflow.com/q/23979225
tags question: http://stackoverflow.com/q/23970272
tags question: http://stackoverflow.com/q/23960025
tags question: http://stackoverflow.com/q/23979766
tags question: http://stackoverflow.com/q/24022925
tags question: http://stackoverflow.com/q/23983276
tags question: http://stackoverflow.com/q/23974711
tags question: http://stackoverflow.com/q/24020171
tags question: http://stackoverflow.com/q/24084145
tags question: http://stackoverflow.com/q/24094686
tags question: http://stackoverflow.com/q/24026734
tags question: http://stackoverflow.com/q/23950393
tags question: http://stackoverflow.com/q/24062864
tags question: http://stackoverflow.com/q/24086645
tags question: http://stackoverflow.com/q/23968784
tags question: http://stackoverflow.com/q/24000709
tags question: http://stackoverflow.com/q/24013169
tags question: http://stackoverflow.com/q/23946482
tags question: http://stackoverflow.com/q/24011849
tags question: http://stackoverflow.com/q/24093746

http://stackoverflow.com/comment/36918878
has text: Is your `if` inside `for (int x = 0; i < 8; x += 30)` loop?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23963218

http://stackoverflow.com/q/23962074
has comment: http://stackoverflow.com/comment/36916236
has answer: http://stackoverflow.com/a/23962175
answer count: 2
tagged with: for-loop
upvote count: 0
has body: I have a "for" loop that is creating a variable each time through the loop. I am attempting to insert the results into an empty array at the index of the "i" in the loop. From the best I can tell it seems I need to create a ArrayList vs. an Array to make this happen. int varNum = 10; Array someArr = new Array (); for (int i = 0; i &lt; 10; i++){ varNum = varNum +i; someArr[i] = varNum; } On the first loop I want the 10 to be inserted in my array at the "0 index", 11 inserted at "1 index", 12 at the "2 Index". **The important part is that the Array is not a set size, because I do not know how many indexes I will need in the array, so I want to add them as I needed.
score: -2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/23962135
favorite count: 0
has answer: http://stackoverflow.com/a/23962135
accepted answer: http://stackoverflow.com/a/23962175
downvote count: 2
has title: How do I insert data of a for loop in a specific index?
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/24082541
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24080077
type: Answer
accepted answer of: http://stackoverflow.com/q/24080077
score: 2
has body: I suspect the problem is simply that on deserialization, nothing is populating the floatone and floattwo fields. You're trying to populate the data within objects that don't exist. This: public void readFields(DataInput in) throws IOException { this.floatone.readFields(in); this.floattwo.readFields(in); } should probably be: public void readFields(DataInput in) throws IOException { floatone = new FloatWritable(); floattwo = new FloatWritable(); floatone.readFields(in); floattwo.readFields(in); } Alternatively, change both write and readFields: public void write(DataOutput out) throws IOException { out.writeFloat(floatone.get()); out.writeFloat(floattwo.get()); } public void readFields(DataInput in) throws IOException { floatone = new FloatWritable(in.readFloat()); floattwo = new FloatWritable(in.readFloat()); } That looks clearer and potentially more efficient to me.
upvote count: 2

http://stackoverflow.com/a/65123774
upvote count: 6
has body: Minio offers (in my opinion) the best set of features, flexibility and ease of use. It is available as a docker container or binary for major OSes. To start with minio, it is as easy as: Download Start the binary minio server /data Use it It works flawlessly with s3cmd and it has nice documentation for popular programming languages.
type: Answer
answers question: http://stackoverflow.com/q/23991694
downvote count: 0
score: 6

http://stackoverflow.com/q/23953330
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/36899595
type: UnansweredQuestion
has title: Rebounding Object Off Wall / Reversing Velocity in Java
has body: I have an object with velocity of -5 going towards a wall. When it hits the wall, I want it to get a velocity of 5, thus reversing directions and rebounding. However, when I run it, it is not working. I've used several variations, I guess I am making a syntactical error. public void action(int t) { setVY(-5); //works - no surprises sets velocity to -5 . . if(getY() &lt;= 0 ) { setVY(5); //THIS METHOD DOESN'T WORK setVX(5); // works no surprises , ball goes right hooks.setMessage("hits wall", 25); //no surprises } } This does compile and run with no errors. The object now goes north and then veers north/east at 45 degrees.
type: Question
has comment: http://stackoverflow.com/comment/36903861
has comment: http://stackoverflow.com/comment/36903745
has answer: http://stackoverflow.com/a/23953650
has comment: http://stackoverflow.com/comment/36899553
has answer: http://stackoverflow.com/a/23953637

http://stackoverflow.com/comment/37173981
comment on: http://stackoverflow.com/q/24100204
score: 0
has text: Just write `private` methods. Those methods are part of the initialization procedure of the outer class, not some inner class.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24068532
score: 1
has body: I just started to play around with OpenDolphin. I'm using the maven jumpstart project and would like to write a value on the server into the presentation model. This value should than be displayed on the client: I tried: actionRegistry.register(ApplicationConstants.COMMAND_ID, new CommandHandler&lt;Command&gt;() { public void handleCommand(Command command, List&lt;Command&gt; response) { System.out.println("Server reached."); Object text = getServerDolphin().getAt("input").getAt("text").getValue(); System.out.println("server text field contains: " + text); getServerDolphin().getAt("input").getAt("text").setValue("test"); } }); The value is received but not transfered back to the client. The textfield is bound like this: PresentationModel input = clientDolphin.presentationModel("input", new ClientAttribute("text")); JFXBinder.bind("text").of(field).to("text").of(input);
favorite count: 0
has answer: http://stackoverflow.com/a/24417557
type: UnansweredQuestion
tagged with: java
has title: opendolphin: textfield not updated on client
upvote count: 1
type: Question
tagged with: opendolphin
answer count: 1
downvote count: 0

http://stackoverflow.com/q/23998044
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24000003
answer count: 1
tagged with: button
downvote count: 0
has comment: http://stackoverflow.com/comment/36988005
has title: JavaFX button gives error when button text is clicked
favorite count: 0
accepted answer: http://stackoverflow.com/a/24000003
type: AnsweredQuestion
score: 1
tagged with: javafx
upvote count: 1
has body: I have a 4 buttons that when clicked, give an error when I click on the text of the button, but when I click on the button portion without text it works. Here is the event code: @FXML public void starClick(MouseEvent event){ event.consume(); try{ Button btn = (Button)event.getTarget(); }catch(Exception e){ e.printStackTrace(); } //UIActions.setStarClick(Integer.parseInt(btn.getText())); } Here is the XML of one of the buttons: &lt;Button fx:id="star1" disable="false" focusTraversable="false" minHeight="0.0" minWidth="0.0" mnemonicParsing="false" onMouseClicked="#starClick" onMouseEntered="#starHover" onMouseExited="#starExit" prefHeight="20.0" prefWidth="25.0" styleClass="button-star" text="1" textFill="TRANSPARENT" visible="true"&gt; &lt;stylesheets&gt; &lt;URL value="@../css/button.css" /&gt; &lt;/stylesheets&gt; &lt;/Button&gt; Here is the output when clicked: java.lang.ClassCastException: com.sun.javafx.scene.control.skin.LabeledText cannot be cast to javafx.scene.control.Button at phantom.DocumentController.starClick(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1763) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1651) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.ja…

http://stackoverflow.com/a/23953970
answers question: http://stackoverflow.com/q/23951975
score: 1
downvote count: 0
type: Answer
has body: Over Engineered abstract class Filter { public static String errorMsg = null; public abstract boolean check(); } class CheckError extends Filter { @Override public boolean check() { return (errorMsg != null); } } abstract class DoBunchOfStuff { public String somethingElse = null; private static int counter = 0; public DoBunchOfStuff() { somethingElse = "doBunch" + ++counter; } public abstract void ofStuff(Filter filter); } class Follower { private Filter filter; private List&lt;DoBunchOfStuff&gt; stuff = new ArrayList&lt;&gt;(); public Follower(Filter filter) { this.filter = filter; } public void add(DoBunchOfStuff bunchOf) { stuff.add(bunchOf); } public String call() { for (DoBunchOfStuff doBunch : stuff) { doBunch.ofStuff(filter); if (filter.check()) { return filter.errorMsg + doBunch.somethingElse; } } return "OK"; } } public class YourClass { public String myMethod() { Follower executor = new Follower(new CheckError()); DoBunchOfStuff doBunch1 = new DoBunchOfStuff() { @Override public void ofStuff(Filter filter) { // } }; DoBunchOfStuff doBunch2 = new DoBunchOfStuff() { @Override public void ofStuff(Filter filter) { // } }; DoBunchOfStuff doBunch3 = new DoBunchOfStuff() { @Override public void ofStuff(Filter filter) { // filter.errorMsg = "Error !!! "; } }; executor.add(doBunch1); executor.add(doBunch2); executor.add(doBunch3); return executor.call(); }
upvote count: 1

http://stackoverflow.com/comment/36998108
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24005698
has text: The `List<Object>` is given to me by an external library as the result of a database query that contains mixed types. You all have convinced me that `instanceof` is the way to go, so I am satisfied with that and it will suit my purposes just fine. I was just thinking that maybe there was a way to adapt the visitor pattern to my purposes, but I was mistaken.
type: Comment

http://stackoverflow.com/q/23947297
type: AnsweredQuestion
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/23947413
upvote count: 1
has answer: http://stackoverflow.com/a/23947413
type: Question
score: -1
answer count: 3
has body: I am trying to create an web application using java and java server pages .I want the output of java file to display on jsp(web page)..I am fairly new to jsp so don't know how to include a java program into a jsp file and output its variables...I have searched it but didn't found anything that could help me...any code or link to tutorial would be very helpful.... consider my filename is: xyz.java and I want to display value of one of its variable.
has title: How to direct the output of java program through HTML/CSS?
tagged with: jsp
has answer: http://stackoverflow.com/a/23947381
favorite count: 0
has answer: http://stackoverflow.com/a/23947508
accepted answer: http://stackoverflow.com/a/23947381

http://stackoverflow.com/q/24080560
downvote count: 1
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/24080624
upvote count: 0
score: -1
has title: how to parse Xml file through Linux
answer count: 1
tagged with: unix
favorite count: 0
tagged with: linux
has body: javax.jdo.option.ConnectionUserName pass username to use against metastore database javax.jdo.option.ConnectionPassword pass`enter code here` password to use against metastore database how can we get javax.jdo.option.ConnectionUserName -pass and javax.jdo.option.ConnectionPassword -pass
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/37028475
score: 0
type: AnswerComment
has text: @JNPW That makes no sense; `length` is a field for array objects and no methods need to be called to retrieve its value. Unless you're saying `toArray()` requires `size()`...
type: Comment
comment on: http://stackoverflow.com/a/24022079

http://stackoverflow.com/q/24081869
answer count: 2
tagged with: jsf
tagged with: primefaces
tagged with: java
has title: lazy datatable's rowselect event object is always null
has answer: http://stackoverflow.com/a/24085724
type: AnsweredQuestion
downvote count: 0
tagged with: jsf-2.2
favorite count: 0
tagged with: nullpointerexception
type: Question
has answer: http://stackoverflow.com/a/24084990
score: 3
accepted answer: http://stackoverflow.com/a/24085724
possible better answer: http://stackoverflow.com/a/24084990
has body: I'm trying to use the p:datatable to list a previously search result and then select a row to get displayed on a show dialog (as shown in showcase, http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml). But SelectEvent.getObject() of ajax event "rowSelect" returns always null and current row is never selected. This is the stack trace: Caused by: java.lang.NullPointerException at com.gestion.projet.web.jsf.ProjetComponentImpl.onRowSelect(ProjetComponentImpl.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy58.onRowSelect(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.support.Deleg…
upvote count: 3

http://stackoverflow.com/comment/36938908
score: 0
type: AnswerComment
has text: Nowhere in the code `Bitmap` instances appear to be created. This is really a memory issue due to the `String` class, as already explained in the question, similar to others already documented in various SO pages.
type: Comment
comment on: http://stackoverflow.com/a/23971915

http://stackoverflow.com/comment/37123529
type: Comment
has text: When you call hm.get("Name"), it retrieves the value stored under the key "Name". This is how a HashMap works. The HashMap temporarily stores your fields while you are parsing them. Will it create 3,000 courses? That depends. Does your WHILE loop display all 3,000 courses?
comment on: http://stackoverflow.com/a/24073079
score: 0
type: AnswerComment

http://stackoverflow.com/a/29974599
has comment: http://stackoverflow.com/comment/48068963
answers question: http://stackoverflow.com/q/24088625
upvote count: 2
score: 0
downvote count: 2
has body: InputStream jasper1 = getClass().getResourceAsStream("src/ie/test/OMACYTDReportFinalpg1.jasper"); InputStream jasper2 = getClass().getResourceAsStream("src/ie/test/OMACYTDReportFinalpg2.jasper");
type: Answer
has comment: http://stackoverflow.com/comment/107296143

http://stackoverflow.com/a/24055806
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24055653
accepted answer of: http://stackoverflow.com/q/24055653
upvote count: 9
has body: To get this string: "+33146290800"&lt;CR&gt;Please call me soon.&lt;ctrl-Z&gt; You use this string literal: String s = "\"+33146290800\"\rPlease call me soon.\u001A"; \" is the Java string literal escape sequence for a double quote, \r is escape sequence a carriage return, and \u0026 is the Java string literal Unicode escape sequence for character x1A (decimal 26), e.g., Ctrl+Z. More to explore in the JLS.
score: 9

http://stackoverflow.com/q/24074312
tagged with: endianness
has comment: http://stackoverflow.com/comment/37125297
has answer: http://stackoverflow.com/a/24074510
type: Question
has comment: http://stackoverflow.com/comment/37125339
tagged with: int
has comment: http://stackoverflow.com/comment/37125403
has comment: http://stackoverflow.com/comment/37125036
answer count: 2
has comment: http://stackoverflow.com/comment/37125077
has title: Java Byte[] to int (Big Endian) using << Weirdness
has comment: http://stackoverflow.com/comment/37125251
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24074850
tagged with: byte
has comment: http://stackoverflow.com/comment/37125170
has answer: http://stackoverflow.com/a/24074850
has comment: http://stackoverflow.com/comment/37125152
accepted answer: http://stackoverflow.com/a/24074510
upvote count: 1
has comment: http://stackoverflow.com/comment/37125137
has comment: http://stackoverflow.com/comment/37125127
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37125202
has body: Suppose we have the following byte[4]: 44 a4 8a c6 So in what's wrong with the following code: public static int asIntBigEndian(byte[] raw, int offset){ int result = 0; for(int i=offset; i&lt;offset+4; ++i){ result = (result &lt;&lt; 4) | raw[i]; } return result; } The result of calling asIntBigEndian(raw, 0) is: ff ff ff e6 What I have noticed is that if I were to read the first byte and print it out, I get: 44 I would get the same result if I were to do this: System.out.println(Integer.toHexString(raw[0] &lt;&lt; 24)); 0x44000000 So If I were to continue the logic ... System.out.println(Integer.toHexString( (raw[0] &lt;&lt; 24)|(raw[1] &lt;&lt; 16) ); 0xffa40000 Basically the first byte turned into 0xff while the 2nd byte 0xa4 has been "xor" onto the right position. Why is this happening?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37125107
has comment: http://stackoverflow.com/comment/37125359

http://stackoverflow.com/comment/36980213
has text: possible duplicate of [Similarity String Comparison in Java](http://stackoverflow.com/questions/955110/similarity-string-comparison-in-java)
type: Comment
comment on: http://stackoverflow.com/q/23996097
type: QuestionComment
score: 2

http://stackoverflow.com/a/24085911
upvote count: 4
has body: Use Class#getMethods: Returns an array containing Method objects reflecting all the public methods of the class or interface represented by this Class object, including those declared by the class or interface and those inherited from superclasses and superinterfaces. public static List&lt;String&gt; getPublicMethods(Class&lt;?&gt; clazz) { Method[] publicMethods = clazz.getMethods(); List&lt;String&gt; methodNames = new ArrayList&lt;&gt;(); for (Method method : publicMethods) { methodNames.add(method.getName()); } return methodNames; } If you want it strictly as an array, use the above method altogether with List#toArray: public static String[] getPublicMethods(Class&lt;?&gt; clazz) { Method[] publicMethods = clazz.getMethods(); List&lt;String&gt; methodNames = new ArrayList&lt;&gt;(); for (Method method : publicMethods) { methodNames.add(method.getName()); } return methodNames.toArray(new String[publicMethods.length]); }
downvote count: 0
has comment: http://stackoverflow.com/comment/37146882
score: 4
type: Answer
answers question: http://stackoverflow.com/q/24085881
has comment: http://stackoverflow.com/comment/37146966
has comment: http://stackoverflow.com/comment/37147013
has comment: http://stackoverflow.com/comment/37146703

http://stackoverflow.com/q/24024340
has answer: http://stackoverflow.com/a/24024453
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5621338
tagged with: jscrollpane
tagged with: jtextarea
tagged with: layout-manager
score: 0
has title: Scroll bar not showing in JTextArea - Swing GUI
has comment: http://stackoverflow.com/comment/37039518
type: UnansweredQuestion
has body: The scroll bar doesn't show. I've tried most of the codes people replied with in previous questions like this one. frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); textArea_2 = new JTextArea(); textArea_2.setRows(200); textArea_2.setBounds(0, 22, 434, 120); textArea_2.setEditable(false); JScrollPane scrollv2 = new JScrollPane (textArea_2); frame.add(scrollv2); frame.getContentPane().add(textArea_2); scrollv2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); frame.setVisible (true);
tagged with: swing
has answer: http://stackoverflow.com/a/24024442
linked to: http://stackoverflow.com/q/17874717
tagged with: java

http://stackoverflow.com/comment/88987940
type: Comment
has text: I'm using the 2.7.18 version of the cxf library i'm still facing the same issue, but ur solution is for spring framework and I'm not using any framework, is there an alternative solution or approach that i can try ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24064842

http://stackoverflow.com/a/24065623
score: 1
has body: I don't exactly understand what you are trying to get but you could possibly use: if ( type.isInstance(obj) ) { //do something } http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#isInstance%28java.lang.Object%29
has comment: http://stackoverflow.com/comment/37109241
answers question: http://stackoverflow.com/q/24065436
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37110194
downvote count: 0

http://stackoverflow.com/q/23949625
type: UnansweredQuestion
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/23949783
answer count: 2
tagged with: jsp
has title: Retrieve map attribute from page to page JSP
has answer: http://stackoverflow.com/a/23949788
has body: i am trying to get retrieve attributes which are being put into a map. However i keep getting null when i try to debug it by putting it in an alert. Any help will be appreciated, thank you! First jsp &lt;% //Map newSurvey = new LinkedHashMap(); Map newSurvey = new HashMap(); newSurvey.put("description", request.getParameter("description")); newSurvey.put("startDate", request.getParameter("start_datetime")); newSurvey.put("endDate", request.getParameter("end_datetime")); newSurvey.put("maxParticipant", request.getParameter("max_participant")); newSurvey.put("minAge", request.getParameter("min_age")); newSurvey.put("maxAge", request.getParameter("max_age")); newSurvey.put("preSurveyText", request.getParameter("pre_survey_text")); request.setAttribute("myMap", newSurvey); %&gt; window.location = 'Survey_Questions.jsp'; Second jsp (to retrieve) i used a javascript to see if i am able to retrieve it function testGet(){ &lt;% Map myMap = (Map)request.getParameter("myMap"); String description = (String) myMap.get("description"); %&gt; alert(&lt;%=description%&gt; }
tagged with: dictionary

http://stackoverflow.com/q/24061404
score: 0
has comment: http://stackoverflow.com/comment/37108049
has answer: http://stackoverflow.com/a/24071786
answer count: 1
tagged with: jung
tagged with: subtree
type: UnansweredQuestion
has body: I am using Java JUNG 2.0.1 version. I understand basics of JUNG API. I have a tree with root vertex as 1 [see Input graph]. Basically, I want to remove an edge (from:1 to:3) i.e. have sub-tree where root is vertex 3 and add it below vertex 2 and vertex 5 separately [see Output graph]. I used getSubTree() and addSubTree() of TreeUtils.java. But, it gives error with stack trace : java.lang.IllegalArgumentException: Tree must not already contain child a.b.c at edu.uci.ics.jung.graph.DelegateTree.addChild(DelegateTree.java:182) at edu.uci.ics.jung.graph.DelegateTree.addEdge(DelegateTree.java:102) at edu.uci.ics.jung.graph.util.TreeUtils.addFromSubTree(TreeUtils.java:139) at edu.uci.ics.jung.graph.util.TreeUtils.addSubTree(TreeUtils.java:100) Input graph : Output graph :
tagged with: java
has comment: http://stackoverflow.com/comment/37127659
type: Question
has comment: http://stackoverflow.com/comment/37149193
has title: add subtree below more than one nodes in a graph

http://stackoverflow.com/q/24038853
tagged with: junit
answer count: 1
downvote count: 0
favorite count: 0
has title: How to send input to System.console.readLine(...) in Junit?
accepted answer: http://stackoverflow.com/a/24039298
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37059447
tagged with: java
type: Question
has body: I have a main method I'd like to test. I'm just wondering how to pass what the console.readLine(...) and console.readLine(...) is expecting from my Junit test - without refactoring main(...) - I'm using JMockit if that would be of use here - i.e. mocking out the System.console()?. class MyClass { public static void main(String[] args) { Console console = System.console(); String username = console.readLine("Enter your username: "); char[] newPassword = console.readPassword("Enter your new password: "); ... } } class MyJunitTest { @Test public void test() { MyClass.main(null); // here I'd just like to pass the username and password to the console? } }
has comment: http://stackoverflow.com/comment/37059951
has answer: http://stackoverflow.com/a/24039298
has comment: http://stackoverflow.com/comment/37059222
linked to: http://stackoverflow.com/q/6415728
score: 4
tagged with: jmockit
has comment: http://stackoverflow.com/comment/37059186
upvote count: 4
has comment: http://stackoverflow.com/comment/37060328

http://stackoverflow.com/a/24091760
answers question: http://stackoverflow.com/q/24091744
type: Answer
upvote count: 1
has body: .toUpperCase() does not modify the string it is applied to. You need to do: sub = sub.toUpperCase();
downvote count: 0
score: 1

http://stackoverflow.com/q/24017544
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24018216
type: Question
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: javascript
tagged with: jquery
tagged with: struts2
accepted answer: http://stackoverflow.com/a/24018216
has body: <%@taglib prefix="sj" uri="/struts-jquery-tags" %> I have used a spinner like this code below: <sj:spinner id="SpinnerQ" onchange="" mouseWheel="true" value="%{Quantiy}" readonly="true" max="30" min="1" > I want to get the value when I click button up or down of spinner and show that value on message box.
has title: Struts 2 - JQuery plugin: Spinner Value change event
score: 1

http://stackoverflow.com/comment/37038850
score: 0
has text: Do you have a link to the api documentation?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24027314

http://stackoverflow.com/comment/37114599
has text: This answer and the above helped me to resolve my problem. Solution: add all dependencies to build path (including apache-commons-logging).
comment on: http://stackoverflow.com/a/24068282
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37165868
has text: Sorry, I'm uncleared but I edited the main post. Simply, from MainActivity I would execute the asynctask and call the method in the interface to set adapter in MyFragment...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24092146
type: AnswerComment

http://stackoverflow.com/comment/98643956
comment on: http://stackoverflow.com/a/23979996
type: AnswerComment
has text: This "javax.xml.bind.DatatypeConverter.parseBase64Binary" better than use ".getBytes()" method from a String
type: Comment
score: 2

http://stackoverflow.com/comment/36901513
type: QuestionComment
has text: I'd say the issue is much more likely to be with your code rather than with Grizzly. As others suggest, garbage collection is a possible cause although it should be using G1 by default and not do too many stop the world garbage collects. Use visualvm to track if you are leaking memory somehow or to profile where it is spending its cpu.
comment on: http://stackoverflow.com/q/23953381
score: 0
type: Comment

http://stackoverflow.com/comment/37171902
type: QuestionComment
comment on: http://stackoverflow.com/q/24099337
score: 0
has text: @nachokk +1 for this link. You legitimately need to read this.
type: Comment

http://stackoverflow.com/comment/37029150
type: AnswerComment
comment on: http://stackoverflow.com/a/24022440
score: 0
type: Comment
has text: Afterreplacing console.log(q[0].data); with alert('zero of resp Arr '+respArr[0].data); says undefined....

http://stackoverflow.com/comment/37123221
type: Comment
has text: i guess it prints the numbers of odd numbers in the array. thank u for the help
type: AnswerComment
comment on: http://stackoverflow.com/a/24072911
score: 0

http://stackoverflow.com/a/24074828
score: 1
accepted answer of: http://stackoverflow.com/q/24073014
downvote count: 0
has body: Here you go: // get all links by xpath List&lt;WebElement&gt; links = driver.findElements(By.xpath("//*[contains(text(), 'Apply Now')])); // select a random one Random gen = new Random(); WebElement link = links.get(gen.nextInt(list.size())); link.click();
type: AcceptedAnswer
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24073014

http://stackoverflow.com/q/24070656
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37268923
tagged with: rendering
tagged with: java
tagged with: bufferedimage
type: Question
tagged with: slideshow
has body: i am trying to write a small slideshow application in java. What works so far: Load the images from the drive Pick images randomly and don't pick one twice render the image in fullscreen However, i display a new image every 3 seconds. Rendering the new image looks crappy becuase the display flickers while rendering loading the new image. I haven't found a way to deal with that problem. I like to to a cool animation like "slide to the left and let the new image slide in from the right side" or "fade the old image out and the new one in". Here is my rendering code so far: private Frame frame; private Component oldComponent = null; private void display(final File file) throws IOException { Component c = new Component() { BufferedImage img = ImageIO.read(file); @Override public void paint(Graphics g) { super.paint(g); g.drawImage(img, 0, 0, getWidth(), getHeight(), this); } }; if(oldComponent != null) frame.remove(oldComponent); frame.add(c); oldComponent = c; GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); gs.setFullScreenWindow(frame); frame.validate(); } As you can see, i create a new component and remove the old one, if there has been one. I'm happy about any information code or links. Thanks in advance! Michael
score: 0
has comment: http://stackoverflow.com/comment/37213051
has title: Java BufferedImage Slideshow
answer count: 0

http://stackoverflow.com/a/24022093
score: 3
downvote count: 0
has body: You have to add package test; at the top of you class, then clean and rebuild your code.
type: Answer
answers question: http://stackoverflow.com/q/24022038
has comment: http://stackoverflow.com/comment/37028333
has comment: http://stackoverflow.com/comment/37028318
has comment: http://stackoverflow.com/comment/37028197
upvote count: 3

http://stackoverflow.com/comment/37075189
has text: Sorry, I only saw "return null;" and that was not subtle. Had to read more closely.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24047034
type: Comment

http://stackoverflow.com/q/24059013
has comment: http://stackoverflow.com/comment/37103522
downvote count: 0
has body: I am running a Ruby script from Java using JRuby like so: public class ScriptletRunnable implements Runnable { @Override public void run() { ScriptingContainer scriptingContainer = new ScriptingContainer(); scriptingContainer.runScriptlet(/*My script*/); // this is a blocking call, never returns } } I pass this runnable to a new thread and start the thread. When I want to stop the script from running, I can't seem to find any way to tell the ScriptingContainer to stop executing the script. Even if I make it a member and call terminate() on it, the script just doesn't stop. If you run the script from the command line you can cleanly shut it down with Ctrl+C. There must be a way to achieve this with JRuby.
tagged with: jruby
has title: Cleanly stop a running JRuby scriptlet
favorite count: 0
tagged with: ruby
answer count: 0
has comment: http://stackoverflow.com/comment/37103007
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
score: 2
tagged with: java
type: Question

http://stackoverflow.com/q/24052595
tagged with: java
tagged with: duplicates
has title: Counting duplicate elements in a Java String array
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37084901
has comment: http://stackoverflow.com/comment/37084875
tagged with: arrays
has answer: http://stackoverflow.com/a/24052747
has comment: http://stackoverflow.com/comment/37084876
tagged with: string
has comment: http://stackoverflow.com/comment/37085270
has body: I have a String array that has been randomly populated by String elements. I would like to iterate through the array and keep count of how many duplicate elements are found. I have found other answers that simply check if there is a duplicate or the position of a duplicate but not how many duplicates exist in the array. For example: String [] arrayToCheck = {"A", "B", "C", "A", "B", "C"}; The number of duplicates found would be 3 (1 of each string is duplicated). I've tried many different things but can't seem to come up with code that gives me the correct answer (the number of duplicates in the array) no matter how many duplicates there are. Here's is what I've tried to no avail: int numDupes = 0; for (int j = 0; j &lt; arrayToCheck.length; j++) for (int k = j + 1; k &lt; arrayToCheck.length; k++) if (k != j &amp;&amp; arrayToCheck[k].equals(arrayToCheck[j])) numDupes++; AND: int numDupes = 0; for (String someVal : arrayToCheck) { for (int i = 0; i &lt; arrayToCheck.length; i++) { if (arrayToCheck[i].equals(someVal)) { numDupes++; } } } AND: int numDupes = 0; for(int i = 1; i &lt; arrayToCheck.length; i++) { if(arrayToCheck[i].equals(arrayToCheck[i-1])) { numDupes++; } } Thanks!
accepted answer: http://stackoverflow.com/a/24052747
possible better answer: http://stackoverflow.com/a/24052639
has answer: http://stackoverflow.com/a/24052639
favorite count: 0
score: -3
downvote count: 6
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/a/24029543
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/23942685
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23942685
has body: ** UPDATE: WebLogic 12.2.1 is now released. It is Java EE 7 and JDK 8 certified. ** Wrong! WebLogic 12c (12.1.3) is Java EE 6 certified. Versions 12.1.1 and 12.1.2 do not offer any feature of Java EE 7, although it is possible to run some new APIs over them (but you won't get support). But as you are interested, it provided on release WebLogic 12.1.3 a few Web-related features of Java EE 7 (such as fully compliant JAX-RS 2.0 and WebSockets). Please read through the documentation as pointed by David Hunt. For a roadmap of WebLogic 12.1.3, you can see the blog post The road ahead for WebLogic 12c 12.1.3 and 12.1.4 (12.2.1).
type: Answer

http://stackoverflow.com/q/23969636
has answer: http://stackoverflow.com/a/23969796
accepted answer: http://stackoverflow.com/a/23969796
tagged with: text
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: i called a text from databse to jlabel, but the text is in 1 row, i want to split the text try { String sql="SELECT Leírás FROM Filmlista WHERE Cím like'Fűrész'"; PreparedStatement pst = conn.prepareStatement(sql); ResultSet rs = pst.executeQuery(); while (rs.next()) { String name=rs.getString("Leírás"); foglab1.setText(name); String[] parts=name.split("@"); String part1=parts[0]; String part2=parts[1]; } so i have a long text and i want split it when he found @ character
tagged with: swing
type: Question
tagged with: split
score: -1
has comment: http://stackoverflow.com/comment/36930294
answer count: 1
downvote count: 1
has title: JLabel text split
favorite count: 0
tagged with: jlabel

http://stackoverflow.com/q/23984480
has comment: http://stackoverflow.com/comment/44282951
tagged with: javafx-8
upvote count: 1
answer count: 1
favorite count: 0
tagged with: javafx-webengine
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23984769
has body: As simple as possible: public class WebViewSample extends Application { public static void main(String[] args) { // I tried without this proxy configuration, same result. System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", "http://127.0.0.1"); System.getProperties().put("proxyPort", 5677); launch(args); } @Override public void start(final Stage primaryStage) { final WebView webView = new WebView(); webView.getEngine().load("http://docs.oracle.com/javafx/"); primaryStage.setScene(new Scene(webView)); primaryStage.show(); } } I'm using cntlm to handle the proxy authentication. (I'm running jdk8u5). What's wrong ?
downvote count: 0
score: 1
tagged with: java
type: Question
has title: WebView shows blank page when running behind proxy

http://stackoverflow.com/comment/37096537
type: Comment
type: QuestionComment
score: 2
has text: Without knowing where you are going with this, I do have to say that the whole design sounds a bit iffy.
comment on: http://stackoverflow.com/q/24058954

http://stackoverflow.com/a/24021569
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24021157
has body: I still haven't figured out what caused this, but I found a workaround. You can pass additional arguments to the callback function. If I pass the Matlab handle of the edittext, I can set the text on that instead. Here is the fixed example (changes are in line 5 and below): function keypress_callback_test() hf = figure(); he=uicontrol('Parent',hf,'Style','edit', 'String', '0'); jhe = findjobj(he, 'nomenu'); set(jhe,'KeyPressedCallback', {@change_text, he}); function change_text(hObject, event, he) set(he, 'String', num2str(rand(1)))
accepted answer of: http://stackoverflow.com/q/24021157
type: Answer

http://stackoverflow.com/q/24091114
tagged with: numbers
tagged with: java
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24091258
score: 0
has title: What is the ISO characters for the Numbers group separator in Polish?
answer count: 1
favorite count: 0
has body: I'm doing some string matching in Java. I need to match the symbol representing the group separator in the Polish language. This is what equales to the , in the English language 100,000,121 So what is the code for that symbol in Polish? I'm doing this for a test suit testing if the Locale is working as expected, so I need to hard code the symbol
tagged with: separator
has answer: http://stackoverflow.com/a/24091258
type: AnsweredQuestion

http://stackoverflow.com/q/23971688
has body: I'm attempting to force an exception in a simple C library I've written that is being called via Andriod NDK. The goal of the exception handling is to pass any signal raised in the C library back to the android program, so it in turn can raise an exception. This way the C exception will appear in the android logs and allow for easy debugging. I've followed this very helpful post by Chris Boyle and got everything running, however I'm struggling to actually cause an exception. In fact the sleep() call doesn't appear to be invoked either. Can someone suggest where I'm going wrong? How can I catch SIGSEGV (segmentation fault) and get a stack trace under JNI on Android? Here's my C library code... /* DO NOT EDIT THIS FILE - it is machine generated */ #include "com_example_jni_test_app_MainActivity.h" /* Header for class com_example_jni_test_app_MainActivity */ #include &lt;stdio.h&gt; #include &lt;assert.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;stdarg.h&gt; #include &lt;string.h&gt; #include &lt;errno.h&gt; #include &lt;ctype.h&gt; #include &lt;signal.h&gt; #include &lt;unistd.&gt; static jmethodID nativeCrashed; static JNIEnv *env; static jobject obj; /* * Class: com_example_jni_test_app_MainActivity * Method: getStringFromNative * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_com_example_jni_1test_app_MainActivity_getStringFromNative (JNIEnv *_env, jobject _obj){ env = _env; obj = _obj; //TEST - Force segfault sleep(20); raise(SIGSEGV); return (*env)-&gt;NewStringUTF(env, "Hello from JNI!"); } static struct sigaction old_sa[NSIG]; void android_sigaction(int signal, siginfo_t *info, void *reserved) { (*env)-&gt;CallVoidMethod(env, obj, nativeCrashed); old_sa[signal].sa_handler(signal); } JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { jclass cls, vcls; if ((*jvm)-&gt;GetEnv(jvm, (void **)&amp;env, JNI_VERSION_1_2)) return JNI_ERR; cls = (*env)-&gt;FindClass(env, "com/example/jni_test/app/MainActivity"); //…
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: testing exception handlers in C library for Android ndk
tagged with: android-ndk
linked to: http://stackoverflow.com/q/1083154
type: Question
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/23971732
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23971732

http://stackoverflow.com/a/23960813
has comment: http://stackoverflow.com/comment/36913722
score: 2
downvote count: 0
has body: Your constraints do not exclude using Lists. See How to sort a ArrayList in Java? If you can't use Lists either, I suggest trying to use Math.min, http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html, which would allow you to determine which of them is the next minimum... Create a function to print the next smallest. private void printNextSmallest() { int min = Math.min(Math.min(Math.min(a,b), Math.min(c,d)),e); if (min == Integer.MAX) {return;} else if (a == min) { System.out.println(a + " "); printNextSmallest(Integer.MAX, b, c, d,e);} //.. else if (e == min) { System.out.println(e + " "); printNextSmallest(a, b, c, d, Integer.MAX); }
type: Answer
answers question: http://stackoverflow.com/q/23960536
upvote count: 2
has comment: http://stackoverflow.com/comment/36914032

http://stackoverflow.com/comment/37039841
type: QuestionComment
has text: Thank you trashgod, could you answer with a practical example on how to apply it to the above code?
comment on: http://stackoverflow.com/q/24028147
score: 0
type: Comment

http://stackoverflow.com/comment/36912108
score: 0
has text: Try this related question: http://stackoverflow.com/questions/11400225/where-did-the-apache-derby-eclipse-plug-in-go?rq=1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23957246

http://stackoverflow.com/comment/36909659
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23958289
has text: You don't need them for this, but they will make your life alot easier in the long run. If you don't want to use them just change the line that sets x to `x = (float) Math.cos(angle) * r * HEIGHT / WIDTH;`
score: 0

http://stackoverflow.com/q/23974249
type: Question
has comment: http://stackoverflow.com/comment/36961626
answer count: 3
has answer: http://stackoverflow.com/a/58667727
favorite count: 0
has answer: http://stackoverflow.com/a/32556217
has comment: http://stackoverflow.com/comment/36952055
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/36953970
has title: Spring Data JPA without Spring Boot
has answer: http://stackoverflow.com/a/74090976
has comment: http://stackoverflow.com/comment/36961799
has comment: http://stackoverflow.com/comment/36938519
tagged with: http://stackoverflow.com/tag/xml
upvote count: 41
type: UnansweredQuestion
has body: Spring Boot doesn't work with Google App Engine (at least not for me). However much of the examples written or available in the GitHub or other repositories are using Spring Boot, is there any example for Spring-Data-JPA that does not use Spring Boot and use plain context XML as before? That will show - spring/context.xml (or servlet-context.xml)
tagged with: spring
downvote count: 1
has comment: http://stackoverflow.com/comment/36938812
tagged with: spring-boot
tagged with: java
has comment: http://stackoverflow.com/comment/37004941
has comment: http://stackoverflow.com/comment/36943991
score: 40

http://stackoverflow.com/comment/37027969
type: QuestionComment
has text: The problem is that I don't know how to set it up :)
score: 0
comment on: http://stackoverflow.com/q/24021604
type: Comment

http://stackoverflow.com/a/23978074
score: 0
answers question: http://stackoverflow.com/q/23974619
has body: Write an integration test for that specific service and see if the service method calls returns anything at all. Manually testing always leads to such problems. Start with tests and debug if necessary.
type: Answer

http://stackoverflow.com/a/23977444
has comment: http://stackoverflow.com/comment/36944401
downvote count: 0
score: 1
type: Answer
has body: `jdbc:oracle:thin:@127.0.0.1:1521:XE` try with this url. The error you post clearly says the url is invalid.
upvote count: 1
answers question: http://stackoverflow.com/q/23977324

http://stackoverflow.com/q/24037395
tagged with: sbt-assembly
score: 3
tagged with: sbt
has body: I am trying to generate a fat jar using SBT and sbt-assembly. As a requirement, there are other unmanaged resources (directories) that I need to add in the jar. The problem is there are files on 2 directories that have the same file name and path. So running assembly results to a copyResources error - a Duplicate Mappings error. The behaviour that I want is if the file is already existing, discard the other file. Is there a way to do this? Will this work? unmanagedResources in Compile ~= (_.distinct) Is it a solution? Is there a better solution?
tagged with: java
downvote count: 0
answer count: 1
has title: SBT - Is there a way to ignore duplicate mappings in copyResources?
favorite count: 0
has answer: http://stackoverflow.com/a/24052532
upvote count: 3
tagged with: scala
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/37203568
has text: <%@ page import="java.io.*,java.util.*" %> <%@ page import="javax.servlet.*,java.text.*" %> I am Here Welcome Thiru !! Display Current Date & Time <% Date dNow = new Date( ); SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); out.print( " " + ft.format(dNow) + " "); %>
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24055292

http://stackoverflow.com/comment/37091768
type: AnswerComment
has text: You are welcome. For what it's worth, I once had to maintain a hbm2ddl=auto like system and every production migration was simply a pain. Not to mention individual branches diffs and such. Incremental update scripts is so much better, and you can benefit from DB custom DDL support, beyond Hibernate powers.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24054567

http://stackoverflow.com/comment/37150030
comment on: http://stackoverflow.com/q/24087459
score: 0
type: Comment
type: QuestionComment
has text: Recursion is always odd and curious. You must be doing it right!

http://stackoverflow.com/comment/36987556
type: QuestionComment
has text: This is a hard topic to put in a post, as there are so many things you could do architecturally. Here's a tutorial on using selectors, in that you can check to see which sockets are ready to be read/written. http://tutorials.jenkov.com/java-nio/selectors.html
comment on: http://stackoverflow.com/q/23996083
score: 0
type: Comment

http://stackoverflow.com/a/24028947
answers question: http://stackoverflow.com/q/24028869
has body: The issue seems to be your FileName is FileOne.Txt and the whole file name is FileOne.Txt.txt including textpad extension. So the whole path will be C:\Users\Rig\Desktop\Java\FileOne.Txt.txt
has comment: http://stackoverflow.com/comment/37041172
score: 0
type: Answer

http://stackoverflow.com/q/24067602
accepted answer: http://stackoverflow.com/a/24067687
favorite count: 0
tagged with: colors
has title: Frame.getContentPane().setBackground(Color.black) doesn't
downvote count: 0
tagged with: jframe
tagged with: swing
has body: I've followed the advice of countless other tutorials for changing the background color of a JFrame, but I haven't any luck. Here's my code for initializing and creating a frame package frameTests; import javax.swing.*; import java.awt.*; @SuppressWarnings("serial") public class Foo extends JPanel { public static void frameInit(Foo foobar){ // window initialization JFrame frame = new JFrame("Spaceship Defenders!"); frame.add(foobar); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setBackground(Color.black); frame.setSize(500,500); frame.setVisible(true); frame.setLocationRelativeTo(null);// center frame in screen. } public static void main(String[] args) throws InterruptedException{ Foo bar = new Foo(); frameInit(bar); } }
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jpanel
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24067687

http://stackoverflow.com/comment/36954918
type: Comment
type: QuestionComment
score: 0
has text: Okay, let's break it down to the boolean values. The default renderer for boolean values would give me checkboxes, which is not what I want. Also, I don't know how many columns with boolean values I'll end up with (as that depends on the selected variables to display). Let's say "likes music", "likes sports" etc. Hacking the code created by the Netbeans GUI Builder is strongly disadvised. I don't know how to put it clearer.
comment on: http://stackoverflow.com/q/23981472

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/24021916
tags question: http://stackoverflow.com/q/24006512
type: Tag

http://stackoverflow.com/a/23952599
has comment: http://stackoverflow.com/comment/36903424
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23952226
has comment: http://stackoverflow.com/comment/37072257
upvote count: 2
has comment: http://stackoverflow.com/comment/36902984
answers question: http://stackoverflow.com/q/23952226
type: Answer
has body: You can use Group and Rectangles with different colors and positions for this. Here is example: import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Group root = new Group(); Rectangle rect1 = new Rectangle(400,100); Rectangle rect2 = new Rectangle(400,125); Rectangle rect3 = new Rectangle(400,175); Rectangle rect4 = new Rectangle(200,250); rect1.setFill(Color.BLUE); rect2.setFill(Color.RED); rect3.setFill(Color.YELLOW); rect4.setFill(Color.GREEN); rect2.setLayoutY(100); rect3.setLayoutY(225); rect4.setLayoutX(200); rect4.setLayoutY(150); root.getChildren().addAll(rect1,rect2,rect3,rect4); primaryStage.setScene(new Scene(root, 400, 400)); primaryStage.show(); } }
score: 2
has comment: http://stackoverflow.com/comment/36903799
has comment: http://stackoverflow.com/comment/36902788
has comment: http://stackoverflow.com/comment/36954202
has comment: http://stackoverflow.com/comment/36899912
has comment: http://stackoverflow.com/comment/36904117

http://stackoverflow.com/q/24066627
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24066673
answer count: 3
has title: Unable to execute Unix command through Java code
has body: case "BVT Tool": System.out.println("Inside BVT Tool"); try { String[] command1 = new String[] {"mv $FileName /bgw/feeds/ibs/incoming/"}; Runtime.getRuntime().exec(command1); } catch(IOException e) { System.out.println("execption is :"+ e); e.printStackTrace(); } break; I'm unable to execute the Unix command. It's showing the following exception: java.io.IOException: Cannot run program mv $FileName /bgw/feeds/ibs/incoming/": CreateProcess error=2, The system cannot find the file specified.
has answer: http://stackoverflow.com/a/24067041
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/24067041
has answer: http://stackoverflow.com/a/24066673
tagged with: unix
has answer: http://stackoverflow.com/a/24066713

http://stackoverflow.com/a/24045160
upvote count: 1
has comment: http://stackoverflow.com/comment/37071445
has body: Reading these docs, perhaps CURRENT_TIMESTAMP would work better than NOW. I don't currently have ability to test this, but you might give it a try. Since it returns TIMESTAMP WITH TIME ZONE, then you might also consider: CURRENT_TIMESTAMP AT TIME ZONE INTERVAL '0:00' See also this discussion thread.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24040868
type: Answer
accepted answer of: http://stackoverflow.com/q/24040868
score: 1

http://stackoverflow.com/comment/37126362
type: Comment
type: QuestionComment
has text: @ScaryWombat Please write example solution How to define the path .To make it more understandable please.Taking path to be C:\Users\admin\Desktop\SharedCrpto1\web\RetrievedFiles\FILE310@ST-testemp\abc.png
comment on: http://stackoverflow.com/q/24074868
score: 0

http://stackoverflow.com/comment/36988005
type: Comment
type: QuestionComment
score: 1
has text: Does `event.getSource()` work?
comment on: http://stackoverflow.com/q/23998044

http://stackoverflow.com/q/23978628
has title: Organize database (how to store a list)
tagged with: database
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23978732
accepted answer: http://stackoverflow.com/a/23978732
type: AnsweredQuestion
has body: In my database I have table "Announcement" with fields: id int, text varchar, sent_date date. Also table "Group" with fields: id int, name varchar. Each announcement submitted to any number of groups(from 1 to all). How to store this relation in database? I'm using MySQL and Hibernate in java web project.
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question

http://stackoverflow.com/comment/37167310
type: Comment
has text: Is the picture coming from the camera? If so, make sure that your rotation is correct. to do this, switch the width and height positions when converting to JPG: put b.getHeight() where size.width is and b.getWidth() where size.height is
comment on: http://stackoverflow.com/a/24077306
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36909446
score: 0
has text: No, methods with diferent number of type of arguments are different methods that do not override each other. It is very common to have classes with several methods with the same name/return but different arguments. There's no conflict.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23958437

http://stackoverflow.com/q/24074365
tagged with: jface
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24094540
has title: SWT : Fetching the contents of a dialog box and storing the data in a table viewer
tagged with: java
tagged with: swt
possible better answer: http://stackoverflow.com/a/24074843
type: Question
has answer: http://stackoverflow.com/a/24074843
has body: I have a Wizard page which contains a Jface TableViewer with 5 columns. Wizard page also contains "Add" and "Remove" buttons. When the Add button is clicked a new Dialog opens up with 3 Text boxes and 2 Combo boxes and the user enters details into them. Everything is fine up to this point but I would want to know how to fetch the contents of the text boxes and the Combo boxes(after user clicks "OK" button in the dialog box) and store the same contents in the table viewer of my wizard page? DO I need to use a MouseListener and override mouse down method and write the logic in the mouse down method to fetch the contents? Or is there any other way to do this? To fetch the contents I simply say for example : TextBox txt = new TextBox(shell, SWT.BORDER); String txtContents = txt.getText(); What is the approach to fetch the dialog window's contents and store the data in the table? And how do I remove a selected row in a table when the user clicks on "Remove" button of the dialog box?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24094540
tagged with: tableviewer

http://stackoverflow.com/comment/36943310
score: 0
type: Comment
type: QuestionComment
has text: That is exactly what I want.
comment on: http://stackoverflow.com/q/23976797

http://stackoverflow.com/comment/43526569
comment on: http://stackoverflow.com/a/24100498
type: Comment
has text: This is the preferred way of acquiring locks in Vaadin, but you could also use [VaadinSession.lock()](https://vaadin.com/api/7.1.0/com/vaadin/server/VaadinSession.html#lock()) if you needed finer control.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24102939
has comment: http://stackoverflow.com/comment/37180001
tagged with: java
has comment: http://stackoverflow.com/comment/37180014
score: 0
tagged with: settext
tagged with: button
type: UnansweredQuestion
has body: so I'm developing a multiplayer tic tac toe game in Java and I'm currently establishing a working server/client connection that will change a button's text(EX: [ ] changes to [ X ] when clicked). So as of right now I'm only working on the server GUI and the client has to type in x or o to change the servers button. I created a testing class with one button I want to change. I'm using breezyswing for anyone familiar but I don't believe my problem has anything to do with it. The class is as follows(please don't mind the improper formatting, it got messed up copying it here): import BreezySwing.*; import javax.swing.*; public class ButtonTest extends GBFrame { private JButton xobutton; public ButtonTest() { xobutton = addButton ("[ ]", 1,1,1,1); } public void clientSaidXO(String xo) { System.out.println(xo); xobutton.setText(xo); } public void buttonClicked (JButton buttonObj) { if(buttonObj == xobutton) { } } public void start() { ButtonTest game = new ButtonTest(); game.setSize(250,100); game.setVisible(true); } } So when the server accepts an X or an O from the client it calls the method like this: ButtonTest.clientSaidXO(input); Input is the X or O the client sent. At first I thought my problem was that I wasn't receiving input from the client correctly, but I was because when I added the print statement in the clientSaidXO method it printed the clients input correctly. Meaning everything is working besides the setText on xobutton. Any kind of insight on how to fix this will be appreciated. Thanks!
has title: setText method not working?
answer count: 0
tagged with: multithreading
tagged with: jbutton
type: Question

http://stackoverflow.com/a/24033640
upvote count: 2
type: AcceptedAnswer
has body: Assuming you are using swing, you could take a look at the BorderFactory.createEmptyBorder(int top, int left, int bottom, int right) factory, such as below (taken from here): JLabel jLabel = new JLabel("My JLabel"); //Border used as padding Border paddingBorder = BorderFactory.createEmptyBorder(10,10,10,10); jLabel.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder));
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24033525
answers question: http://stackoverflow.com/q/24033525
type: Answer
score: 2

http://stackoverflow.com/comment/37067868
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24042889
has text: could someone explain why my question might be down voted? So I know for future questions.
score: 0

http://stackoverflow.com/q/24097341
tagged with: java
tagged with: topic-modeling
has answer: http://stackoverflow.com/a/46286210
downvote count: 0
has body: I have this code to import a file .mallet: File f=new File("/home/test/file.mallet"); InstanceList t=InstanceList.load(f); but if I wanted to switch manually every single instance, how could I do? I tried this: String str="Test for mallet."; InstanceList t=new InstanceList(); t.add(new Instance(str,"test","test",null)); But it gives me an error! EDIT I tried it and it seems to work with an array of strings: ArrayList&lt;String&gt; aa =ArrayList&lt;Pipe&gt;(); aa.add("Test string 1."); aa.add("Test string 2."); String[] ob1=new String[aa.size]; ob1=aa.toArray(ob1); ArrayList&lt;Pipe&gt; pipeList=ArrayList&lt;Pipe&gt;(); pipeList.add(new CharSequenceLowerCase()); //.... pipeList.add(new TokenSequence2FeatureSequence()); InstanceList training=new InstanceList(new SerialPipes(pipeList)) training.addThruPipe(new StringArrayIterator(ob1));
type: UnansweredQuestion
score: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/37170449
has comment: http://stackoverflow.com/comment/71064544
type: Question
tagged with: mallet
upvote count: 3
has comment: http://stackoverflow.com/comment/37169773
has title: MALLET Topic Modeling: input String
answer count: 1

http://stackoverflow.com/a/24008991
has body: I already found what was wrong. The buildpath of the project had configured a newer version of CXF than the version the application was built with. Changing the CXF runtime to the previous version solved the problem.
answers question: http://stackoverflow.com/q/23988523
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23988523
type: Answer

http://stackoverflow.com/comment/123292029
type: Comment
comment on: http://stackoverflow.com/a/23958916
score: 3
type: AnswerComment
has text: Optional.ifPresentOrElse introduced in java9 takes a Runnable as the second parameter without any concurrency semantics, so the official view seems to be that there's nothing wrong with using Runnable in this way

http://stackoverflow.com/comment/37020112
has text: This could potentially lead to a lot of misses, if the maps have gaps in the sequence.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24017905
type: Comment

http://stackoverflow.com/comment/37163778
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24094838
has text: I cited two examples above. Please edit your question to include an [mcve](http://stackoverflow.com/help/mcve) that shows your revised approach. See also [*How do I create screenshots?*](http://meta.stackoverflow.com/questions/99734/how-do-i-create-a-screenshot-to-illustrate-a-post).
type: AnswerComment

http://stackoverflow.com/comment/58559866
type: Comment
has text: @Edgar, i am getting empty registry with java configuration, please help how to handle this one java config ....i am trying get all logged in users list
comment on: http://stackoverflow.com/a/26280031
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37181008
has text: Thank you. I solved the issue. I just had to use `input.hasNextLine()` instead of using `input.hasNext()`.
type: QuestionComment
comment on: http://stackoverflow.com/q/24102593
score: 0
type: Comment

http://stackoverflow.com/q/23950134
has body: I am using CXF simple frontend that uses XML configs only stead of annotations for creating soap web services. Now I have created a service: &lt;simple:server id="locationSettingService" serviceClass="com.my.own.webservice" address="/LocationSettingWebService"&gt; &lt;simple:serviceBean&gt; &lt;bean class="com.my.own.webserviceImpl"&gt; &lt;/bean&gt; &lt;/simple:serviceBean&gt; &lt;simple:inInterceptors&gt; &lt;ref bean="addressingHandler" /&gt; &lt;ref bean="authHandler" /&gt; &lt;/simple:inInterceptors&gt; &lt;simple:dataBinding&gt; &lt;bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" /&gt; &lt;/simple:dataBinding&gt; &lt;/simple:server&gt; After its deployment wsdl is: &lt;wsdl:definitions name="LocationSettingWebService" ... targetNamespace="http://own.my.com/"&gt; It uses targetNamespace http://own.my.com/ My problem is I dont want forward-slash at the end of above namespace I only need http://own.my.com as my targetNamespace .So I want to modify the namespace using simple frontend. Any help? Update: After searching for a long time and trying a hundreds of workaround. I figured out the problem, CXF namespace generation technique is '/' ahead of XFire had. Go to this page .And look for XFire compatibility but I tried many things but got no luck escaping that '/'. Please help people I even opened up bounty from my little SO reputation.
tagged with: cxf
upvote count: 1
tagged with: web-services
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23988591
type: Question
answer count: 1
downvote count: 0
score: 1
has title: TargetNamespace in CXF simple frontEnd
favorite count: 0
tagged with: soap
has answer: http://stackoverflow.com/a/23988591

http://stackoverflow.com/q/24088961
has answer: http://stackoverflow.com/a/24088990
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37153131
type: Question
tagged with: if-statement
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/24089318
has answer: http://stackoverflow.com/a/24089385
downvote count: 4
has title: Equivalent of Python's 'if ..... in ......' in Java?
favorite count: 0
tagged with: python-3.x
has answer: http://stackoverflow.com/a/24088974
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24089673
has comment: http://stackoverflow.com/comment/37152746
tagged with: list
has comment: http://stackoverflow.com/comment/37152782
has body: Python has an 'if... in...' statement which allows a person to create a list, and using the 'if... in...' statement the person can check if a specified something is present in the list. For example, to check if a particular letter is present in a list of vowels. So basically: vowels = [list-of-vowels] if 'e' in vowels: (do something) So is there any simple equivalent of the 'if in' statement of Python in Java?

http://stackoverflow.com/a/23967723
has comment: http://stackoverflow.com/comment/36926514
type: Answer
score: -1
has body: Run your application with -Xms1500m in console, in Netbeans you can find it in project properties->Run->VM options. I faced this out of memory problem today and after tweaking sometime with Xms I was able to fix the problem. Check if it work with you, if there is something really bigger then this than you will have to check how you can improve your code. Check discussion here
answers question: http://stackoverflow.com/q/23967491
downvote count: 1
has comment: http://stackoverflow.com/comment/36926678
upvote count: 0
has comment: http://stackoverflow.com/comment/36926611
has comment: http://stackoverflow.com/comment/36964666
has comment: http://stackoverflow.com/comment/36965494
has comment: http://stackoverflow.com/comment/36926649

http://stackoverflow.com/comment/37178223
has text: Assignment is an operation on variables, not objects. Assigning a new value to a variable doesn't change other variables.
comment on: http://stackoverflow.com/q/24101988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24060564
linked to: http://stackoverflow.com/q/16599405
has answer: http://stackoverflow.com/a/24060883
type: Question
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/24061399
has answer: http://stackoverflow.com/a/24060792
has answer: http://stackoverflow.com/a/24061013
has comment: http://stackoverflow.com/comment/37100363
has answer: http://stackoverflow.com/a/24060752
answer count: 5
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has title: Get the highest value of an array and corresponding index
has comment: http://stackoverflow.com/comment/37099744
has comment: http://stackoverflow.com/comment/37099816
tagged with: java
score: -1
has body: With the help of How to find biggest variable using while loop? I manage to find what's the highest value from an array but then i don't know of which area the result belongs to... String area1[] = new String[2]; String area2[] = new String[2]; String area3[] = new String[2]; String area4[] = new String[2]; String area5[] = new String[2]; area1[0] = "15"; area1[1] = "Area 1"; area2[0] = "7"; area2[1] = "Area 2"; area3[0] = "11"; area3[1] = "Area 3"; area4[0] = "9"; area4[1] = "Area 4"; area5[0] = "7"; area5[1] = "Area 5"; int max = Math.max(Integer.valueOf(area1[0]), Math.max(Integer.valueOf(area2[0]), Math.max(Integer.valueOf(area3[0]), Math.max(Integer.valueOf(area4[0]), Integer.valueOf(area5[0]))))); So, until now I know the highest value of the array (max) but i don't know which area belongs... I hope you can help me how to solve this. Thanks!
has comment: http://stackoverflow.com/comment/37099497

http://stackoverflow.com/comment/36982028
type: AnswerComment
type: Comment
has text: I ran the code - it is working. Continued to search why mine isn't and saw that the problem is that my sentence is being cut (because of another process between the client and server...). It actually being received as `phraseToReplace="1-800 flowers.com, "` (without the CO. and thus it doesn't match)... I'm going to solve it now... sorry for this mistake and I really appreciate your help!
comment on: http://stackoverflow.com/a/23997003
score: 0

http://stackoverflow.com/q/24005251
answer count: 3
possible better answer: http://stackoverflow.com/a/24005309
linked to: http://stackoverflow.com/q/7908090
accepted answer: http://stackoverflow.com/a/24005280
favorite count: 0
linked to: http://stackoverflow.com/q/3436852
has answer: http://stackoverflow.com/a/24005331
tagged with: spring
duplicate of: http://stackoverflow.com/q/3436852
type: AnsweredQuestion
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has body: I'm not sure why I am having this issue. Here's what I'm running on linux command line: sudo java -jar gs-rest-service-0.1.0.jar -cp ./hello java.lang.ClassNotFoundException: hello.Application sudo java -jar gs-rest-service-0.1.0.jar -cp hello java.lang.ClassNotFoundException: hello.Application Tried it both ways, with the ./ and without. Also tried it like this: sudo java -jar gs-rest-service-0.1.0.jar -cp ./main/java/hello java.lang.ClassNotFoundException: hello.Application Again with and without the ./. When I view the jar file I see the Application.class file in main/java/hello all lower case. Here's my MANIFEST.MF Manifest-Version: 1.0 Class-Path: ./hello Update: Got it working. Here I had an issue in my pom.xml file I had specified start-class as hello.Application but my package names I kept messing around with so they were never in sync and adding the -cp wasn't helping since now I would have package one thing in the classes, start-class in the pom.xml another, and -cp even in the wrong location on the command line! Argh.. Just a dumb night. Here's the working code: pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 org.springframework gs-rest-service 0.1.0 jar org.springframework.boot spring-boot-starter-parent 1.0.2.RELEASE org.springframework.boot spring-boot-starter-web com.fasterxml.jackson.core jackson-databind main.java.hello.Application maven-compiler-plugin 2.3.2 org.springframework.boot spring-boot-maven-plugin spring-snapshots http://repo.spring.io/libs-snapshot true spring-snapshots http://repo.spring.io/libs-snapshot true Application.java: package main.java.hello; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.context.annotation.ComponentScan; @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } All other java files have the same package n…
has title: java.lang.ClassNotFoundException even though I specify -cp argument to the class file
has answer: http://stackoverflow.com/a/24005280
has comment: http://stackoverflow.com/comment/36997263
type: Question
has answer: http://stackoverflow.com/a/24005309

http://stackoverflow.com/comment/36884705
type: QuestionComment
has text: Yeah, it's not really a programming question. I thought it was worth an answer, though, if only to explain why Java applets are a terrible idea and are barely used anymore.
comment on: http://stackoverflow.com/q/23945193
score: 0
type: Comment

http://stackoverflow.com/comment/36969067
type: QuestionComment
comment on: http://stackoverflow.com/q/23990663
has text: Getting this as well : [ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-valida tor:jar is missing. @ line 53, column 19 [ERROR] 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar i s missing. @ line 71, column 19 [ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.annotatio n:jboss-annotations-api_1.1_spec:jar is missing. @ line 77, column 19 [ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:j boss-servlet-api_3.0_spec:jar is missing. @ line 83, column 19
score: 0
type: Comment

http://stackoverflow.com/a/23992542
score: 0
has body: Suggestion Use PostConstruct to inject. @PostConstruct void initializeCommon() { //set values here }
answers question: http://stackoverflow.com/q/23992299
type: Answer

http://stackoverflow.com/q/24026774
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/10318728
has answer: http://stackoverflow.com/a/24027567
type: Question
has title: How to change the caret in a textfield?
has body: Is there a way to change the flashing caret in a textfield to another character? I'd like to change it from "|" to ">". All I know how to do is change the color. textField.setCaretColor(Color.WHITE); thanks
tagged with: caret
upvote count: 1
answer count: 1
favorite count: 0
tagged with: textfield
has comment: http://stackoverflow.com/comment/37037187
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/37037095
downvote count: 0

http://stackoverflow.com/comment/37081063
has text: Thank you both a ton for your help. I really appreciate it! Cheers.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24050199
type: Comment

http://stackoverflow.com/q/24070100
has title: Navigating HTML Page
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jsoup
accepted answer: http://stackoverflow.com/a/24077320
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I am trying to scrape a website which contains betting odds data. The way the page is written, it lists the market names in a label tag which is not a parent of the selections, more of a separator for the page. Using JSoup I can pull out all the selection data I want, but I don't know how to figure out what the preceding value for 'label' is for a selection. So in effect I have every selection and price on the page, but I can't resolve whether 'Brazil $4' relates to the World Cup market, the Highest Scoring Team or any other market. The code I'm using to get the markets and selections is: Elements marketNames = doc.getElementsByTag("label"); Elements runnerNames = doc.getElementsByClass("selection"); Basically now I have a selection like "Brazil - $4.0". I want to also know what the previous label was, so I can refer to it as "Winner - Brazil - $4.0"
has answer: http://stackoverflow.com/a/24077320

http://stackoverflow.com/a/58630542
type: Answer
answers question: http://stackoverflow.com/q/24060498
has body: Here is the list of reserved key words for Apache Derby: https://db.apache.org/derby/docs/10.2/ref/rrefkeywords29722.html Having any of these will cause an Exception!
score: 0

apache
tag name: apache
tags question: http://stackoverflow.com/q/24058953
tags question: http://stackoverflow.com/q/24098422
tags question: http://stackoverflow.com/q/24049296
tags question: http://stackoverflow.com/q/24051433
tags question: http://stackoverflow.com/q/24045540
tags question: http://stackoverflow.com/q/23998949
tags question: http://stackoverflow.com/q/23958511
tags question: http://stackoverflow.com/q/23979859
tags question: http://stackoverflow.com/q/24004539
tags question: http://stackoverflow.com/q/24082081
tags question: http://stackoverflow.com/q/23996215
tags question: http://stackoverflow.com/q/23988523
tags question: http://stackoverflow.com/q/24057886
tags question: http://stackoverflow.com/q/24031881
tags question: http://stackoverflow.com/q/24019380
tags question: http://stackoverflow.com/q/23999474
tags question: http://stackoverflow.com/q/24022780
tags question: http://stackoverflow.com/q/24080678
tags question: http://stackoverflow.com/q/24033788
tags question: http://stackoverflow.com/q/24001478
tags question: http://stackoverflow.com/q/23967529
tags question: http://stackoverflow.com/q/24028930
tags question: http://stackoverflow.com/q/23966004
type: Tag
tags question: http://stackoverflow.com/q/23987705
tags question: http://stackoverflow.com/q/23995099
tags question: http://stackoverflow.com/q/23958548
tags question: http://stackoverflow.com/q/23950559
tags question: http://stackoverflow.com/q/24035584
tags question: http://stackoverflow.com/q/24051296
tags question: http://stackoverflow.com/q/24074768
tags question: http://stackoverflow.com/q/24032545
tags question: http://stackoverflow.com/q/24047613

http://stackoverflow.com/comment/37071869
comment on: http://stackoverflow.com/q/24044983
type: QuestionComment
has text: Are you sure that your texture regions are not null ?
type: Comment
score: 0

http://stackoverflow.com/comment/37225040
comment on: http://stackoverflow.com/q/24094683
type: Comment
has text: That says nothing. Post some code.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37013239
type: QuestionComment
has text: It is difficult to say without seeing your code properly. If you edit your question, and paste your code in a 'code' block (see this question for a good example of how to present your code: http://stackoverflow.com/questions/24013819/how-to-save-only-zip-files-and-remove-other-folders-using-java) then I can probably tell you exactly what your solution is
comment on: http://stackoverflow.com/q/24013553
score: 0
type: Comment

http://stackoverflow.com/a/24083505
score: 5
has comment: http://stackoverflow.com/comment/37141891
has comment: http://stackoverflow.com/comment/37141778
accepted answer of: http://stackoverflow.com/q/24083444
type: AcceptedAnswer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24083444
type: Answer
has body: You are requesting the method that accepts an Integer. Change that to the one that takes an int and you are done: this.getClass().getMethod("getData",int.class).invoke(this, 10); Note that there as int.class although int is a primitive type. It exists exactly for this reason.

http://stackoverflow.com/a/24050229
answers question: http://stackoverflow.com/q/24049657
type: Answer
has body: First of all, I think you should avoid using Absolute Position Layout (null layout). As you already know the number of rows and columns, it would be easier to have a GridLayout and keep adding components accordingly. On the other hand, just add an ActionListener and use the getSource() from the Event to get whatever was clicked. With the panel (or label) clicked, you can get the Text to know whats its value. Assuming the ActionListener was added to the JLabel, you can do: if (evt.getSource() instanceof JLabel) { Integer value = Integer.valueOf(((JLabel) evt.getSource()).getText()); } I actually like more the idea to have everything decoupled, so I'll just send a FirePropertyChange and receive it wherever I need to process the value.
upvote count: 1
has comment: http://stackoverflow.com/comment/37081427
score: 1
has comment: http://stackoverflow.com/comment/37085321
downvote count: 0

http://stackoverflow.com/q/24077970
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24078448
tagged with: automation
score: 0
has body: I am a trainee in a large company, we have a maven project + git + spring that run. I developed Selenium test for the HMI. Now I need to configure the pom.xml (I'm really new in this domain) for: Compile normally the source into a jar (that it works) Run the unit test (that it works) Download (via maven) server (tomcat / jetty / ...) not installed locally Deploy the war on the temporary server Start the Selenium test on the war be deployed, (local host) Get an overview of the tests performed I can not seem to find an approach to automate the download and installation of the server (automatic and temporary), deploy the war and then run Selenium tests on deployed war. Is someone will have a way to solve my problem? I do not I realize if it's REALLY complicated or not.
tagged with: deployment
has answer: http://stackoverflow.com/a/24246135
type: UnansweredQuestion
tagged with: maven
tagged with: git
tagged with: java
has title: Download server and automatically deploy war with Maven

http://stackoverflow.com/comment/37161650
type: Comment
type: QuestionComment
has text: You should check out [regex](http://docs.oracle.com/javase/tutorial/essential/regex/)
comment on: http://stackoverflow.com/q/24093694
score: 0

http://stackoverflow.com/a/24094091
has comment: http://stackoverflow.com/comment/37162484
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/37162397
type: Answer
has body: Because the Object class, in the java.lang package, sits at the top of the class hierarchy tree.
answers question: http://stackoverflow.com/q/24094020

http://stackoverflow.com/a/24067506
type: Answer
answers question: http://stackoverflow.com/q/24067173
score: 0
has body: You can use the method of the wrapper class Character to display the string values of char variables: System.out.println(Character.toString(zeroeth) + Character.toString(third) + length); This way, you always work with String values and there are no possibilities for the numeric values of the chars to be displayed or added and you don't need to concatenate with empty strings ("") to convert the char variables to String values.

single-sign-on
tags question: http://stackoverflow.com/q/24066008
tags question: http://stackoverflow.com/q/24075170
tags question: http://stackoverflow.com/q/24068989
tags question: http://stackoverflow.com/q/24019267
type: Tag
tag name: single-sign-on
tags question: http://stackoverflow.com/q/23970078

http://stackoverflow.com/q/24075478
downvote count: 0
has body: Am using Jboss 6.3. We were deploying our application by specifying the datasource in standalone.xml file and it was working fine. But now we have to put the datasource details in standalone-full-ha.xml and make it work. I simply copied the datasource subsytem part from standalone.xml to standalone-full-ha.xml but this is not working and our deployment is failing. Can someone tell me what am doing wrong here? Is there any other additional settings I have to maintain for this to work? Java version is 1.7 and am using scientific linux on a server and operating it via putty.
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: database
tagged with: jboss
upvote count: 1
has comment: http://stackoverflow.com/comment/37154149
answer count: 1
has answer: http://stackoverflow.com/a/32241957
accepted answer: http://stackoverflow.com/a/32241957
favorite count: 0
tagged with: jdbc
has title: Specifying datasource in standalone-full-ha.xml in jboss 6.3
tagged with: deployment
has comment: http://stackoverflow.com/comment/37209776

http://stackoverflow.com/comment/37129656
type: AnswerComment
has text: The only remaining problem might be if you are doing date calculations on the client. In that case it will be done in the timezone of the client. We happily use RequestFactory, JODA time and data types (with and without timezone). The only horrible thing we had to do is have our own implementation of java.util.Date (on the client) to do all calculations in UTC.
comment on: http://stackoverflow.com/a/24054551
type: Comment
score: 0

http://stackoverflow.com/comment/37047252
score: 0
type: AnswerComment
has text: I hoped there were a way to convert it without programing! Thought netBeans can do that. But well, i will convert this into an excel with this api, thanks!
type: Comment
comment on: http://stackoverflow.com/a/24032342

jsf
tags question: http://stackoverflow.com/q/23991547
type: Tag
tags question: http://stackoverflow.com/q/24062819
tags question: http://stackoverflow.com/q/24024506
tags question: http://stackoverflow.com/q/24084210
tags question: http://stackoverflow.com/q/24063207
tags question: http://stackoverflow.com/q/24038345
tags question: http://stackoverflow.com/q/23948237
tags question: http://stackoverflow.com/q/23950355
tags question: http://stackoverflow.com/q/24103393
tags question: http://stackoverflow.com/q/24002738
tags question: http://stackoverflow.com/q/24057169
tags question: http://stackoverflow.com/q/24043894
tags question: http://stackoverflow.com/q/23978482
tags question: http://stackoverflow.com/q/24050273
tags question: http://stackoverflow.com/q/24037203
tags question: http://stackoverflow.com/q/23999818
tags question: http://stackoverflow.com/q/24081869
tags question: http://stackoverflow.com/q/23994374
tags question: http://stackoverflow.com/q/23980638
tags question: http://stackoverflow.com/q/24084371
tags question: http://stackoverflow.com/q/23950898
tags question: http://stackoverflow.com/q/24041960
tags question: http://stackoverflow.com/q/23941790
tag name: jsf
tags question: http://stackoverflow.com/q/23976996
tags question: http://stackoverflow.com/q/24063884
tags question: http://stackoverflow.com/q/24001269
tags question: http://stackoverflow.com/q/23978629
tags question: http://stackoverflow.com/q/23993568
tags question: http://stackoverflow.com/q/23941174
tags question: http://stackoverflow.com/q/24037225
tags question: http://stackoverflow.com/q/24000017
tags question: http://stackoverflow.com/q/23990898
tags question: http://stackoverflow.com/q/23966161
tags question: http://stackoverflow.com/q/23956904
tags question: http://stackoverflow.com/q/24010698
tags question: http://stackoverflow.com/q/24005456
tags question: http://stackoverflow.com/q/24048133
tags question: http://stackoverflow.com/q/23977013

http://stackoverflow.com/comment/36961841
has text: let me get this straight: you want to produce the numbers 1..15 with three loops instead of one?
comment on: http://stackoverflow.com/q/23986689
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37268991
has text: thank you Yordan for answering, but i'm not sure if i understand what you mean by creating a data model, could you please explain more, i'm just new in flex so i make some effort to assimilate that ! by the way i'm facing the same problem with a datagrid even if the code is correct !!
comment on: http://stackoverflow.com/a/24124226
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37152124
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24088620
has text: [Here's the doc](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextFloat%28%29) look at it

http://stackoverflow.com/a/24042650
has comment: http://stackoverflow.com/comment/37068478
type: Answer
has comment: http://stackoverflow.com/comment/37066713
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37067348
has comment: http://stackoverflow.com/comment/37068143
upvote count: 2
has comment: http://stackoverflow.com/comment/37067564
has comment: http://stackoverflow.com/comment/37066828
has comment: http://stackoverflow.com/comment/37068694
answers question: http://stackoverflow.com/q/24041812
has comment: http://stackoverflow.com/comment/37068818
has comment: http://stackoverflow.com/comment/37067093
has body: No "If", No "Switch". This 3 lines would cover all your cases: int val = keyAccntId.equals("-1")? 3:0; val += ((segmentId.equals("-1")? 1:0) + (regionId.equals("-1")? 1:0); templateOrder.add(val+1+""); . You may want to encapsulated the code, so it would end up being something like this: public int getTemplateOrder(int keyAccntId, int segmentId, int regionId){ int val = keyAccntId.equals("-1")? 3:0; return val + (segmentId.equals("-1")? 1:0) + (regionId.equals("-1")? 1:0) + 1; } //Usage templateOrder.add(getTemplateOrder(keyAccntId, segmentId, regionId)+""); . For readability these are those 3 lines: int acc = keyAccntId.equals("-1")? 3:0; int seg = segmentId.equals("-1")? 1:0; int reg = regionId.equals("-1")? 1:0; int val = acc; //Construct the value currently being used on each If statement. val += seg + reg; //You've got the value, so instead of If/switch, just set it. templateOrder.add(val+1+""); I hope it's not too obscure. Regards.

http://stackoverflow.com/comment/37096428
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24057033
has text: String str=rs.getString(1) + " "+rs.getString(2);

http://stackoverflow.com/comment/36935742
has text: Oops! Yes `FileReader`
comment on: http://stackoverflow.com/a/23969718
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37011567
score: 0
comment on: http://stackoverflow.com/q/24013240
has text: yes i need to use interface only i tried using abstract class its working fine
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24010597
upvote count: 21
has comment: http://stackoverflow.com/comment/37006875
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37006929
has answer: http://stackoverflow.com/a/24011435
accepted answer: http://stackoverflow.com/a/24011435
downvote count: 0
tagged with: spring-security
has title: Spring security access with multiple roles
possible better answer: http://stackoverflow.com/a/24011249
favorite count: 0
tagged with: spring
has body: I want to define access for some pages for user who has one of following roles (ROLE1 or ROLE2) I'm trying to configure this in my spring security xml file as following: &lt;security:http entry-point-ref="restAuthenticationEntryPoint" access-decision-manager-ref="accessDecisionManager" xmlns="http://www.springframework.org/schema/security" use-expressions="true"&gt; &lt;!-- skipped configuration --&gt; &lt;security:intercept-url pattern="/rest/api/myUrl*" access="hasRole('ROLE1') or hasRole('ROLE2')" /&gt; &lt;!-- skipped configuration --&gt; &lt;/security:http&gt; I've tried various ways like: access="hasRole('ROLE1, ROLE2')" access="hasRole('ROLE1', 'ROLE2')" access="hasAnyRole('[ROLE1', 'ROLE2]')" etc but nothing seems to be working. I'm keep getting exception java.lang.IllegalArgumentException: Unsupported configuration attributes: or java.lang.IllegalArgumentException: Failed to parse expression 'hasAnyRole(['ROLE1', 'ROLE2'])' how should it be configured? Thanks
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37006830
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/24011249

http://stackoverflow.com/q/23981586
type: Question
has body: My CF9 application running on a windows server pops mail. When I attempt to retrieve the entire body of the message, I sometimes get the following error... Error: An exception occurred while retrieving mail. The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart. Location: Line 335 in controllers\Submissions.cfc Not sure if this is pertinent, but FYI every message will have an image attached and the whole process usually works fine. This problem is intermittent. My Questions Any idea what causes this? Any idea how to catch and resolve this issue? I suspect I'll need to drop down into java, but not sure where to start. Code Fragments &lt;cfscript&gt; // setup variables array for all cfpop calls CFPopAttributes = { server = request.pop.server, port = request.pop.port, username = request.pop.username, password = request.pop.password, timeout = 300 }; &lt;/cfscript&gt; &lt;cfpop action="getall" name="entireEmail" uid="#uid#" attachmentpath="#originalsPath#" attributecollection="#CFPopAttributes#" // Line 335 generateuniquefilenames="true" /&gt; NOTE: I added the comment "Line 335" above to communicate exactly where in the code the template is breaking. If I move the attributecollection up or down (before/after other attributes), the error always breaks at the attributecollection line. Stack Trace struct [Filtered - 1 of 8 keys hidden] Detail: An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest. Message: Event handler exception. RootCause: [struct] Detail: The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart. Message: An exception occurred while retrieving mail. RootCause: [struct] Message: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart StackTrace: java.lang.ClassCastException: javax.mail.intern…
tagged with: java
has title: Java Casting Error Using CFPOP
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37016778
has comment: http://stackoverflow.com/comment/37019884
tagged with: coldfusion
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/q/24100123
has body: I Have an enum class Direction with one method which is suppoused to return a random direction (North, East, South or West) and I want to call it from the main method of another class which is in the same package. However I can't do that since I can't call a non static from a static method. So I tried creating an instance of the enum class Direction, but so far I can remember the constructor of all enum types is private and they can't be instanced. So how am I suppouse to call a method from an enum class. package battleship; public enum Direction { /** * The North Direction (where y decreases) */ NORTH, /** * The East Direction (where x increases) */ EAST, /** * The South Direction (where y increases) */ SOUTH, /** * The West Direction (where x decreases) */ WEST; Direction getDirection() { Direction direction = null; int dir = (int) (Math.random() * 4); switch (dir) { case 0: direction = Direction.NORTH; break; case 1: direction = Direction.EAST; break; case 2: direction = Direction.WEST; break; case 3: direction = Direction.SOUTH; break; } return direction; } } package battleship; public class SeaTest { public static void main(String[] args) { Sea sea = new Sea(10, 10); Direction dir = new Direction(); sea.addShip(ShipType.MINESWEEPER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.addShip(ShipType.MINESWEEPER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.addShip(ShipType.MINESWEEPER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.addShip(ShipType.MINESWEEPER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.addShip(ShipType.BATTLECRUISER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.addShip(ShipType.BATTLECRUISER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.addShip(ShipType.BATTLECRUISER, dir.getDirection(), (int)(Math.random() * 11), (int)(Math.random() * 11)); sea.add…
has answer: http://stackoverflow.com/a/24100591
upvote count: 0
has comment: http://stackoverflow.com/comment/37173533
answer count: 1
has comment: http://stackoverflow.com/comment/37173653
favorite count: 0
has title: Creating an instance and calling a method from an enum, JAVA
has comment: http://stackoverflow.com/comment/37173545
has comment: http://stackoverflow.com/comment/37173510
has comment: http://stackoverflow.com/comment/37173535
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24100591
has comment: http://stackoverflow.com/comment/37173487
downvote count: 1
type: Question
tagged with: enums
tagged with: java
score: -1

http://stackoverflow.com/a/24077495
answers question: http://stackoverflow.com/q/24077453
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: From wikipedia : All URIs and absolute URI references are formed with a scheme name, followed by a colon character (&quot;:&quot;), and the remainder of the URI called (in the outdated RFCs 1738 and 2396, but not the current STD 66/RFC 3986) the scheme-specific part. The scheme-specific-part is what you have after the :. Example : http://stackoverflow.com/questions/24077453/ scheme : scheme-specific-part
score: 26
upvote count: 26
accepted answer of: http://stackoverflow.com/q/24077453

http://stackoverflow.com/q/24062383
favorite count: 0
has title: Shiro LDAP Authorization config
tagged with: ldap
upvote count: 8
score: 8
type: UnansweredQuestion
tagged with: authentication
has answer: http://stackoverflow.com/a/34896329
tagged with: java
tagged with: vaadin
has body: Could you please help me with the following situation? Background information: I'm using the Vaadin framework. I'm using the Java security framework Shiro I'm using ssl. Authentication works. Username syntax = pietj@.lcl , jank@.lcl memberOf field is being used as role. shiro.ini [main] contextFactory = org.apache.shiro.realm.ldap.JndiLdapContextFactory contextFactory.url = ldaps://&lt;SERVER&gt;:636 contextFactory.systemUsername = &lt;USERNAME&gt;@&lt;COMPANY&gt; contextFactory.systemPassword = &lt;PASSWORD&gt; contextFactory.environment[java.naming.security.protocol] = ssl realm = org.apache.shiro.realm.activedirectory.ActiveDirectoryRealm realm.ldapContextFactory = $contextFactory realm.searchBase = "OU=&lt;APPDIR&gt;,DC=&lt;COMPANY&gt;,DC=lcl" realm.groupRolesMap = "CN=&lt;ROLE&gt;,OU=&lt;APPDIR&gt;,DC=&lt;COMPANY&gt;,DC=lcl":"Admin" [roles] # 'Admin' role has permissions * Admin = * Goal Authorization mapping based on the memberOf field from the currentUser. Problem currentUser.hasRole("Admin") always return false. Questions Is the above shiro.ini correct? How do I fix the problem?
type: Question
tagged with: shiro
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36954653
score: 0
comment on: http://stackoverflow.com/q/23960306
type: Comment
type: QuestionComment
has text: I'm sorry, I miss typed. Please post your code in your question. :)

http://stackoverflow.com/q/24097557
has comment: http://stackoverflow.com/comment/37168745
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37168722
has title: app crashes when launching emulator
answer count: 2
has answer: http://stackoverflow.com/a/24098642
has body: My logcat: 01-01 05:13:28.690: D/AndroidRuntime(696): Shutting down VM 01-01 05:13:28.690: W/dalvikvm(696): threadid=1: thread exiting with uncaught exception (group=0x40a13300) 01-01 05:13:28.741: E/AndroidRuntime(696): FATAL EXCEPTION: main 01-01 05:13:28.741: E/AndroidRuntime(696): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myfunapp/com.example.myfunapp.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 01-01 05:13:28.741: E/AndroidRuntime(696): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 01-01 05:13:28.741: E/AndroidRuntime(696): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 01-01 05:13:28.741: E/AndroidRuntime(696): at android.app.ActivityThread.access$600(ActivityThread.java:130) 01-01 05:13:28.741: E/AndroidRuntime(696): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 01-01 05:13:28.741: E/AndroidRuntime(696): at android.os.Handler.dispatchMessage(Handler.java:99) 01-01 05:13:28.741: E/AndroidRuntime(696): at android.os.Looper.loop(Looper.java:137) 01-01 05:13:28.741: E/AndroidRuntime(696): at android.app.ActivityThread.main(ActivityThread.java:4745) 01-01 05:13:28.741: E/AndroidRuntime(696): at java.lang.reflect.Method.invokeNative(Native Method) 01-01 05:13:28.741: E/AndroidRuntime(696): at java.lang.reflect.Method.invoke(Method.java:511) 01-01 05:13:28.741: E/AndroidRuntime(696): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 01-01 05:13:28.741: E/AndroidRuntime(696): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 01-01 05:13:28.741: E/AndroidRuntime(696): at dalvik.system.NativeStart.main(Native Method) 01-01 05:13:28.741: E/AndroidRuntime(696): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 01-01 05:13:28.741: E/AndroidRuntime(696): at android.ap…
downvote count: 1
favorite count: 0
tagged with: android-listview
tagged with: android
upvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37168979
type: Question
has answer: http://stackoverflow.com/a/24097654
has comment: http://stackoverflow.com/comment/37169089

http://stackoverflow.com/q/24021157
answer count: 1
has title: Error setting 'text' property of a Matlab uicontrol using its Java handle
accepted answer: http://stackoverflow.com/a/24021569
type: AnsweredQuestion
tagged with: user-interface
has body: I am using Yair Altman's findjobj function to add Java callbacks to my Matlab GUI. My goal is that each keypress inside the edittext (specifically arrow up, arrow down) changes the edittext's string to something different (increment, decrement a number). The problem is that set-ting the text of the Javaobject triggers a weird Java error. Here is a minimal (and nonsensical) example that shows the problem: function keypress_callback_test() hf = figure(); he=uicontrol('Parent',hf,'Style','edit', 'String', '0'); jhe = findjobj(he, 'nomenu'); set(jhe,'KeyPressedCallback', @change_text); function change_text(hObject, event) set(hObject, 'text', num2str(rand(1))) The code works, but Matlab displays the following (quite long) error message: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.text.JTextComponent.getSelectionStart(Unknown Source) at javax.swing.text.PlainView.paint(Unknown Source) at javax.swing.text.FieldView.paint(Unknown Source) at javax.swing.plaf.basic.BasicTextUI$RootView.paint(Unknown Source) at javax.swing.plaf.basic.BasicTextUI.paintSafely(Unknown Source) at javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source) at javax.swing.plaf.basic.BasicTextUI.update(Unknown Source) at javax.swing.JComponent.paintComponent(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent._paintImmediately(Unknown Source) at javax.swing.JComponent.paintImmediately(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$700(Unknown Source) at javax.swing.RepaintManag…
type: Question
tagged with: matlab
has answer: http://stackoverflow.com/a/24021569
score: 0
tagged with: java

jmeter
tags question: http://stackoverflow.com/q/24005456
tags question: http://stackoverflow.com/q/23960940
tag name: jmeter
tags question: http://stackoverflow.com/q/23987705
tags question: http://stackoverflow.com/q/23976996
tags question: http://stackoverflow.com/q/24051049
type: Tag

http://stackoverflow.com/q/23989628
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/37634078
downvote count: 1
has title: Finding Consecutive Matching Elements in Arrays
favorite count: 0
has answer: http://stackoverflow.com/a/23989805
has answer: http://stackoverflow.com/a/23989778
accepted answer: http://stackoverflow.com/a/23989778
possible better answer: http://stackoverflow.com/a/23989805
answer count: 4
has answer: http://stackoverflow.com/a/23989813
has body: I am having a slight issue with this problem. All the answers check out for all of the calls except for one, which I don't get. contains({1, 2, 1, 2, 3}, {1, 2, 3}) returns false when it should be true. Prompt: Write a static method named contains that accepts two arrays of integers a1 and a2 as parameters and that returns a boolean value indicating whether or not a2's sequence of elements appears in a1 (true for yes, false for no). The sequence of elements in a2 may appear anywhere in a1 but must appear consecutively and in the same order. For example, if variables called list1 and list2 store the following values: int[] list1 = {1, 6, 2, 1, 4, 1, 2, 1, 8}; int[] list2 = {1, 2, 1}; Then the call of contains(list1, list2) should return true because list2's sequence of values {1, 2, 1} is contained in list1 starting at index 5. If list2 had stored the values {2, 1, 2}, the call of contains(list1, list2) would return false because list1 does not contain that sequence of values. Any two lists with identical elements are considered to contain each other, so a call such as contains(list1, list1) should return true. You may assume that both arrays passed to your method will have lengths of at least 1. You may not use any Strings to help you solve this problem, nor methods that produce Strings such as Arrays.toString. Code: public static boolean contains(int[] first, int[] second) { int secondCount = 0; // Indicates where to start on second array if (first.length &lt; second.length) { // If second array is longer than first return false; } for (int i=0; i&lt;first.length; i++) { // goes through each element in first array if (first[i] == second[secondCount]) { // If elements match secondCount++; // increment by one and move onto next elem on second if (secondCount == second.length) { // If complete match return true; } } else { // resets count secondCount = 0; } } return false; }

http://stackoverflow.com/a/46696461
has comment: http://stackoverflow.com/comment/119171526
has body: DCEVM does not ship with fonts. So, when the JVM tries to load up the fonts, it doesn't find any and crashes. Fortunately, the fix is very easy. Simply copy the fonts from another JDK/JRE. You will find them at /jre/lib/fonts. Copy the entire directory to /lib.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24012321
type: Answer

http://stackoverflow.com/q/24022070
has answer: http://stackoverflow.com/a/24022222
answer count: 1
accepted answer: http://stackoverflow.com/a/24022222
tagged with: glassfish
score: 0
tagged with: jersey-1.0
tagged with: web-services
type: AnsweredQuestion
tagged with: dependency-injection
has title: How can I use Guice in Glassfish 3?
has body: My ear is using CDI but I'm running into known memory leaks. Rather than drop dependency injection all together, I'm wondering if it's possible to replace the CDI code with Guice code. I'm using the Stripes framework, Web Services and Jersey 1.x. How can I get Guice to manage all these end points?
tagged with: java
type: Question

http://stackoverflow.com/q/24006655
has answer: http://stackoverflow.com/a/24007383
has comment: http://stackoverflow.com/comment/36999511
has comment: http://stackoverflow.com/comment/36999613
has title: Unable to make folders to zip files using java?
type: Question
has comment: http://stackoverflow.com/comment/36999685
has body: Here i have folder(Books)structure inside of Books folder i have folders called physics,chemistry,science,english.I'm passing Books folder as zipDeleteFile but inside all folder has to convert in the same folder(Books)as physics.zip,chemistry.zip,science.zip,english.zip.But this code is not working. ' public void foldertToZip(File zipDeleteFile) { //System.out.println(zipDeleteFile); File directoryToZip = zipDeleteFile; List&lt;File&gt; fileList = new ArrayList&lt;File&gt;(); //System.out.println("---Getting references to all files in: " + directoryToZip.getCanonicalPath()); getAllFiles(directoryToZip, fileList); //System.out.println("---Creating zip file"); writeZipFile(directoryToZip, fileList); //System.out.println("---Done"); } public static void getAllFiles(File dir, List&lt;File&gt; fileList) { try { File[] files = dir.listFiles(); for (File file : files) { fileList.add(file); if (file.isDirectory()) { System.out.println("directory:" + file.getCanonicalPath()); getAllFiles(file, fileList); } else { System.out.println(" file:" + file.getCanonicalPath()); } } } catch (IOException e) { e.printStackTrace(); } } public static void writeZipFile(File directoryToZip, List&lt;File&gt; fileList) { try { try (FileOutputStream fos = new FileOutputStream(directoryToZip.getName() + ".zip")) { ZipOutputStream zos = new ZipOutputStream(fos); for (File file : fileList) { if (!file.isDirectory()) { // we only zip files, not directories addToZip(directoryToZip, file, zos); } } zos.close(); } } catch (FileNotFoundException e) { } catch (IOException e) { } } public static void addToZip(File directoryToZip, File file, ZipOutputStream zos) throws FileNotFoundException, IOException { try (FileInputStream fis = new FileInputStream(file)) { String zipFilePath = file.getCanonicalPath().substring(directoryToZip.getCanonicalPath().length() + 1, file.getCanonicalPath().length()); System.out.println("Writing '" + zipFilePath + "' to zip file"); ZipEntry zipEntry = new ZipEntry(zipFilePath);…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36999796
accepted answer: http://stackoverflow.com/a/24007383
score: 0
tagged with: unzip
answer count: 1
has comment: http://stackoverflow.com/comment/37000121
has comment: http://stackoverflow.com/comment/37000034
has comment: http://stackoverflow.com/comment/37000105
has comment: http://stackoverflow.com/comment/36999813
tagged with: directory
tagged with: http://stackoverflow.com/tag/zip

http://stackoverflow.com/comment/37334812
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23949375
has text: I evaluated Google Guava Cache.I want to go with this caching.but I want to know whether LoadingCache's get and it's load method is thread safe or not.Any early help would be appreciated.Thanks in advance
score: 0

http://stackoverflow.com/a/23989427
answers question: http://stackoverflow.com/q/23989201
upvote count: 2
has body: use StringBuffer and Stack first remove all commas and save the index of them on stack after reversing insert commas at location that you saved them on stack. use stringBufferObject.deleteCharAt(index); for deleting a character and use stringBufferObject.reverse(); for reversing string.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36967046

http://stackoverflow.com/q/24016462
upvote count: 6
has title: Gradle. Subprojects which don't know they're subprojects
has body: I'm in the process of creating a multi-subproject Java project. The subprojects are to each have their own separate git repositories and be included in the superproject using git submodules. Our preferred case would be that our continuous-integration tool (Jenkins) would independently build these subprojects into .jars without taking into account or otherwise knowing about the superproject. This can be accomplished pretty easily just by ensuring that the subprojects each have a build.gradle which has all of the information necessary to build the .jar that results from the build. The only complication that results is when some subprojects depend on other subprojects. Even this is pretty straightforward if you're willing to always have the subprojects pull their dependencies' .jars from a Maven or Ivy repo. However, when we build on our local boxes during the course of development, we want to be able to build and deploy the superproject's .war file to Tomcat and all of the .jars to somewhere on the classpath and ensure that all of the .jars were built from the copy of the code currently on our own box. (That is, we want it to act basically as if we used compile(project(":otherproject")) rather than compile("group:otherproject:1.0-SNAPSHOT") or some such.) I'm fairly new to Gradle, and it's entirely possible I'm missing something pretty obvious, but I haven't yet found a nice way to handle this. We could do something such that the set of dependences for building it by pulling .jars from our Maven repository is in one file and the set of dependencies for building it by using its sibling subprojects in another file, but that seems like a DRY violation. (In that case, we'd have two separate places to manage the list of dependencies.) We could create the subprojects' build scripts to always pull from the Maven repository and have the superproject's build script include sections for each subproject which override the dependencies in the subprojects, but that's just as much …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24016588
score: 6
tagged with: java
tagged with: gradle
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24740071
favorite count: 0

http://stackoverflow.com/q/24019504
has comment: http://stackoverflow.com/comment/37023813
accepted answer: http://stackoverflow.com/a/24019589
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: ip
has comment: http://stackoverflow.com/comment/37026319
has comment: http://stackoverflow.com/comment/37023701
has comment: http://stackoverflow.com/comment/37023101
downvote count: 0
has body: I am trying to write a class that will return a domain name from an IP Address that is in my /etc/hosts file. For example I know a block of IP Address which Google own are 74.125.0.0 - 74.125.255.255 and in my hosts file I have; 74.125.24.155 Google 74.125.24.101 Google 74.125.24.102 Google 74.125.24.132 Google 74.125.24.113 Google 74.125.24.84 Google I have wrote a simple piece of code that will look to the hosts file and search for the name of the corresponding IP Address. Here is the code; String destination = "74.125.24.84"; InetAddress address = InetAddress.getByName(destination); String resolvedHost = address.getHostName(); System.out.println("Translated " + destination + " to host name " + resolvedHost); That will return the following Translated 74.125.24.84 to host name Google. I then tried; String destination = "74.125.24.*"; InetAddress address = InetAddress.getByName(destination); String resolvedHost = address.getHostName(); System.out.println("Translated " + destination + " to host name " + resolvedHost); But got the following error in response; java.net.UnknownHostException: 74.125.24.* at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) at java.net.InetAddress.getAddressesFromNameService(Unknown Source) at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getByName(Unknown Source) at IPToDomainName.main(IPToDomainName.java:12) Is there a way that I can use a wildcard to represent Googles IP addresses?
has comment: http://stackoverflow.com/comment/37023503
has answer: http://stackoverflow.com/a/24019589
answer count: 1
has title: Using a wildcard IP Address to get a Domain Name
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/37156156
type: Comment
type: QuestionComment
has text: It's VNC Remote desktop application, I'm trying to run the VNC viewer from the link provided.
comment on: http://stackoverflow.com/q/24090670
score: 0

http://stackoverflow.com/comment/36968812
has text: As last resort, you can set the banner height manually. According to [Banner Sizes](https://developers.google.com/mobile-ads-sdk/docs/admob/intermediate) BANNER's size is 320x50. If you set `android:layout_height="50dp"` attribute for `adView` the system will scale the height with the factor 1.5 (which comes from the warning you get). As the result the height will be 50 * 1.5 = 75 px.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23975643
score: 0

http://stackoverflow.com/comment/37044230
has text: If you are a newbie as you say, one lesson first: never suppress warnings as a newbie, you might get in trouble with this
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24030774
score: 0

http://stackoverflow.com/q/23966290
tagged with: swing
downvote count: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/23967061
possible better answer: http://stackoverflow.com/a/23966309
answer count: 3
has answer: http://stackoverflow.com/a/23966309
favorite count: 0
has title: Java paint not drawing in Swing
has answer: http://stackoverflow.com/a/23966572
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23967061
has body: I'm trying to make a paint program, but I'm having trouble with drawing lines when dragging the mouse. It appears that the paint keeps on refreshing and so it only draws the current position of my mouse. I a bit new to this, so how would I be able to get all the lines to show on the JPanel when dragging the mouse? Thanks, and here is what I have: import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JPanel; public class DrawingPanel extends JPanel{ Point start; Point end; static Color c = Color.black; DrawingPanel(){ addMouseMotionListener(new ml()); addMouseListener(new ml()); } public class ml implements MouseMotionListener, MouseListener{ public void mouseMoved(MouseEvent ev){} public void mousePressed(MouseEvent e){ end = e.getPoint(); } public void mouseDragged(MouseEvent e){ start = end; end=e.getPoint(); repaint(); } public void mouseReleased(MouseEvent e){ start=null; end=null; } public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} } public void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(c); if(start!=null){ Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(5)); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.drawLine(start.x, start.y, end.x, end.y); } } }
upvote count: 2
score: 1

http://stackoverflow.com/comment/37155878
has text: Also, ur first regex works good. But I want to know how to split based on this pattern and assign the 3 parts to 3 different Strings.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24090459

http://stackoverflow.com/comment/37157694
comment on: http://stackoverflow.com/q/24091448
score: 0
has text: Your title expresses what you think, incorrectly, should happen, not what is actually happening,
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37110295
type: QuestionComment
has text: By communication I mean Java calling functions on the NodeJS side. I modified the question to reflect this.
score: 0
comment on: http://stackoverflow.com/q/24065089
type: Comment

http://stackoverflow.com/q/23975609
accepted answer: http://stackoverflow.com/a/23975879
has comment: http://stackoverflow.com/comment/36940977
has title: Why am I not able to load the required libraries before running the JAR?
has comment: http://stackoverflow.com/comment/36940768
answer count: 1
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/36940985
favorite count: 0
has body: I have created a graph project which needs JFree chart library.When I run the program it runs normally.But when I convert it into a JAR from Eclipse and run, it throws an exception saying there NoClassDefFoundErrors.Actually these classes are in the library.Does it mean that the JAR program doesn't have the library appended?Please help.
has comment: http://stackoverflow.com/comment/36940798
linked to: http://stackoverflow.com/q/9329650
has comment: http://stackoverflow.com/comment/36940824
has comment: http://stackoverflow.com/comment/36941098
has comment: http://stackoverflow.com/comment/36940865
tagged with: shared-libraries
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36940871
has comment: http://stackoverflow.com/comment/36941035
score: 1
has comment: http://stackoverflow.com/comment/36940829
upvote count: 1
type: Question
tagged with: java
tagged with: ubuntu
tagged with: eclipse
has answer: http://stackoverflow.com/a/23975879

http://stackoverflow.com/comment/36930504
comment on: http://stackoverflow.com/q/23969930
has text: This is different to the question you asked an hour ago how?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/79143949
comment on: http://stackoverflow.com/a/23968675
type: Comment
has text: Nice touch with the last paragraph that it's possible to do so in Project Settings (it's called Project Structure though in IntelliJ 2017.2.3) :) Learned something new today as well, ty!
score: 2
type: AnswerComment

http://stackoverflow.com/comment/36976563
has text: I don't really know where can I store it, is there a configuration file in Java like web.config in .NET?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23994488

http://stackoverflow.com/comment/37167882
comment on: http://stackoverflow.com/q/24097083
type: Comment
type: QuestionComment
has text: Read more about the Basic of Java. In first case object is created but there is no reference so you can't get it again. It's lost in the heap and after sometime collected by GC to destroy it. **It's just like a balloon that don't have any thread to keep it with you and it's lost in the sky.**
score: 1

http://stackoverflow.com/a/25392459
type: Answer
answers question: http://stackoverflow.com/q/24037409
score: 0
has body: I got mvn tomcat:run to work with an opencv_java249.so file by using MAVEN_OPTS. Simply doing: MAVEN_OPTS=-Djava.library.path=/path/to/your/native/libfolder worked fine. I'm using an absolute path for this on my machine and it's working. I haven't tried a relative one though.

http://stackoverflow.com/a/23965512
score: 2
accepted answer of: http://stackoverflow.com/q/23965255
has body: Could be because of this part of the code that is between the 2 buttons.Try removing it and see: try{ p = Runtime.getRuntime().exec("free -ms 5"); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((s = br.readLine()) != null) textArea.setText(s); p.waitFor(); System.out.println ("exit: " + p.exitValue()); p.destroy(); } catch(Exception e) { }
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23965255
upvote count: 2

http://stackoverflow.com/q/24101765
has body: I've been working on creating a periodic table for a computer science project. I'm trying to write a code that creates an array of buttons. The text on these buttons is determined by retrieving the name of the buttons corresponding element in my other array. After this is complete, based on what type of element it is, the button is coloured accordingly. The program compiles fine, but it does not run. Here is my code: BufferedReader reader = null; ElementsTest[] element = new ElementsTest[40]; try { File file = new File("Elements 41-80.txt"); reader = new BufferedReader(new FileReader(file)); for (int counter = 0 ; counter &lt; 40 ; counter++) { String name = reader.readLine(); int atomicNum = counter + 1; String atomicWeight = reader.readLine(); String elementSymbol = reader.readLine(); String elementCharge = reader.readLine(); String fullElectronConfig = reader.readLine(); String shortElectronConfig = reader.readLine(); String elementState = reader.readLine(); String elementType = reader.readLine(); String density = reader.readLine(); String meltingPoint = reader.readLine(); String boilingPoint = reader.readLine(); String emptyLine = reader.readLine(); element[counter] = new ElementsTest (name, atomicNum, atomicWeight, elementSymbol, elementCharge, fullElectronConfig, shortElectronConfig, elementState, elementType, density, meltingPoint, boilingPoint); } } catch (IOException e) { e.printStackTrace(); } JButton[] buttonArray = new JButton[40]; for (int counter2 = 0 ; counter2 &lt; 40 ; counter2++) { String currentSymbol = element[counter2].getElementSymbol(); buttonArray[counter2].setText(currentSymbol); if (element[counter2].getElementType().equals("Metal")) { buttonArray[counter2].setBackground(Color.ORANGE); buttonArray[counter2].setOpaque(true); buttonArray[counter2].setBorderPainted(false); } if (element[counter2].getElementType().equals("Non-Metal")) { buttonArray[counter2].setBackground(Color.GRAY); buttonArray[counter2].setOpaque(true); buttonArray[counter2]…
tagged with: nullpointerexception
tagged with: element
has answer: http://stackoverflow.com/a/24101831
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24101897
duplicate of: http://stackoverflow.com/q/218384
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/218384
tagged with: java
score: -1
has title: java.lang.NullPointerException when trying to set text on a JButton
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24101897
tagged with: null
accepted answer: http://stackoverflow.com/a/24101831
tagged with: arrays

http://stackoverflow.com/comment/68990868
comment on: http://stackoverflow.com/q/23959180
score: 1
has text: As described in https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#section-parameter-name-provider configuring with ReflectionParameterNameProvider might help. Your might also provide own implementation (for instance based annotations or types).
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24046856
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24055993
has body: My Spring Data repositories are confiured as default @RepositoryRestResource without any customization. JPA entity: @Entity @Table(name = "flat") public class Flat implements Serializable { private static final long serialVersionUID = -7402659216552976109L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "flat_id") private Integer id ; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "house_id", referencedColumnName="house_id", insertable=false, updatable=false) private House house; @Column(name = "kad_num") private String kadNum; ..... I want House obkect to be returned in JSON as embedded part of Flat object, but get only URL to the house /repository/flats/442991: { "kadNum" : "78:06:0002202:8981", "sqrFull" : 52.7000, "flatNum" : "311", "_links" : { "self" : { "href" : "http://localhost:8080/kap/repository/flats/442991" }, "house" : { "href" : "http://localhost:8080/kap/repository/flats/442991/house" } } } At the same time, User-Role OneToMany relationship is fetched fine, with role name: @Entity @Table(name = "\"user\"") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "user_id") private Integer id; private String login; private String email; private String password; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "user_id", nullable=false , updatable = false, insertable = true) private Set&lt;Role&gt; roles = new HashSet&lt;Role&gt;(); ..... request: /repository/users/5 { "id" : 5, "login" : "op898", "email" : "op20140603@gmail.com", "password" : "c6172176f8f5d7e660eb4dcfad07a6ca", "roles" : [ { "roleName" : "OPERATOR" } ], "_links" : { "self" : { "href" : "http://localhost:8080/kap/repository/users/5" } } } I can't figure out the difference, except of relationship type. Any idea ? Thank you
upvote count: 5
tagged with: java
type: Question
answer count: 2
score: 5
tagged with: jpa
downvote count: 0
has title: Not fetching ManyToOne eager association in Spring Data Rest
favorite count: 0
has answer: http://stackoverflow.com/a/24053930

binary-serialization
type: Tag
tags question: http://stackoverflow.com/q/23944422
tag name: binary-serialization

http://stackoverflow.com/a/23996905
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/36981960
type: Answer
has body: An example of turning off logging in log4j 1.x was to add the following xml tag into log4j.xml. The category name is the package path to the root of the library you want to ignore logging from. For example to ignore log4j logging from the apache tiles library you would use the following: &lt;category name="org.apache.tiles"&gt; &lt;priority value = "off" /&gt; &lt;/category&gt;
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23996762
answers question: http://stackoverflow.com/q/23996762
score: 5

http://stackoverflow.com/a/58240282
has body: Just find the error reason in here and fix it. yourProject/app/build/reports/lint-results-release-fatal.xml
has comment: http://stackoverflow.com/comment/105580553
score: 8
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/104742403
answers question: http://stackoverflow.com/q/24098494
upvote count: 8

http://stackoverflow.com/q/24072868
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24072894
type: Question
score: 0
has body: I am messing around with Swing and I find that some elements are not appearing in my application. Most notably the JScrollPane and for some reason there seems to be a grid column between my JTextArea and JButtons. See the image below: My method is as follows: private void panels(){ JFrame frame=new JFrame("Viewing All Program Details"); JPanel panel = new JPanel(new GridLayout(1,1)); panel.setBorder(new EmptyBorder(5, 5, 5, 5)); JPanel rightPanel = new JPanel(new GridLayout(15,0,10,10)); rightPanel.setBorder(new EmptyBorder(15, 5, 5, 10)); JTextArea textArea = new JTextArea(storeAllString,0,70); JScrollPane scrollBarForTextArea=new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); panel.add(textArea); frame.add(scrollBarForTextArea); frame.getContentPane().add(panel,BorderLayout.LINE_START); frame.getContentPane().add(rightPanel,BorderLayout.EAST); frame.setSize(1000, 700); frame.setVisible(true); rightPanel.add(saveCloseBtn); rightPanel.add(closeButton); }
answer count: 1
has answer: http://stackoverflow.com/a/24072894
has title: Extra column with GridLayout and JScrollPane not showing - Java Swing
tagged with: swing

http://stackoverflow.com/a/24094588
has comment: http://stackoverflow.com/comment/37163316
type: Answer
has comment: http://stackoverflow.com/comment/37163254
accepted answer of: http://stackoverflow.com/q/24094544
answers question: http://stackoverflow.com/q/24094544
upvote count: 1
has comment: http://stackoverflow.com/comment/37163281
score: 1
has body: It sounds like you just need to create new instances of your UserData class: class App{ void doStuff(){ UserData data = new UserData(); //do stuff with it... //when you need a new instance: data = new UserData() //data is now a brand new UserData } }
has comment: http://stackoverflow.com/comment/37163303
has comment: http://stackoverflow.com/comment/37163453
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37163331

http://stackoverflow.com/q/23945921
upvote count: 3
tagged with: java
has title: JTable header not showing still
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/36886053
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23946124
has body: I have looked and found that many people weren't putting their table into a scrollPane. Even though I nest my table into a scrollPane then into the frame it still fails to show the header. Is there something else I'm missing ? Thanks public class Gui extends JFrame { AbstractTableModel model; JTable table; public void start(AbstractTableModel model) { this.model = model; table=new JTable(model){ @Override public boolean isCellEditable(int arg0, int arg1) { return false; } }; table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); TableColumn column = null; for (int i = 0; i &lt; model.getColumnCount(); i++) { column = table.getColumnModel().getColumn(i); column.setPreferredWidth(120); column.setMaxWidth(300); column.setMinWidth(50); } JScrollPane pane = new JScrollPane(table); pane.setPreferredSize(new Dimension(900,900)); add(pane); setLayout(new FlowLayout()); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); }
has comment: http://stackoverflow.com/comment/36885889
has comment: http://stackoverflow.com/comment/36886062
tagged with: jtable
answer count: 1
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/23946124
has comment: http://stackoverflow.com/comment/36885998
score: 2
has comment: http://stackoverflow.com/comment/36885868

http://stackoverflow.com/q/24031552
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
score: 2
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: jakarta-ee
has title: Tomcat: *-Mapping breaks websocket endpoint
has body: I've a Tomcat 7.0.54 with a CometServlet: web.xml: MyServlet de.test.MyServlet 1 MyServlet /* MyServlet.java class MyServlet extends HttpServlet implements CometProcessor ... TestEndpoint.java @ServerEndpoint("/websocket1") public class TestEndpoint { ... With this configuration, I'm unable to connect to the websocket endpoint. When I change the url pattern to for example /a/*, everything works as expected. Do you know of any workaround for this? I really have to use the /* url pattern because a I use one servlet that dispatches all requests and there must no be anything else in the url. Thanks in advance. Peter
downvote count: 0

http://stackoverflow.com/comment/37119922
comment on: http://stackoverflow.com/q/24006154
type: QuestionComment
type: Comment
score: 1
has text: Extending classes in Java accomplishes two separate things: (1) making the subclass support the same interfaces as the superclass (is-a relationship), and (2) providing default implementations of those interfaces. Do you really need both (or either) of these things? A Jython class is not going to have any real "type"s aside from any Java class or interface it, itself, extends. For (2), you could always use composition instead of inheritance.

http://stackoverflow.com/q/23959976
tagged with: return
answer count: 5
has comment: http://stackoverflow.com/comment/36946449
accepted answer: http://stackoverflow.com/a/23960048
has comment: http://stackoverflow.com/comment/36949395
possible better answer: http://stackoverflow.com/a/23960020
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36912272
has answer: http://stackoverflow.com/a/23960020
has comment: http://stackoverflow.com/comment/36912073
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36911943
has answer: http://stackoverflow.com/a/23960078
linked to: http://stackoverflow.com/q/40480
upvote count: 1
has comment: http://stackoverflow.com/comment/36912387
downvote count: 1
has answer: http://stackoverflow.com/a/23960040
type: Question
has body: THERE ARE ISSUES WTIH AN UNDERSTANDING OF Java IN THIS QUESTION. AS THE AUTHOR, I HAVE KEPT THE ORIGINAL QUESTION INTACT AS THE ANSWERS DO AN EXCELLENT JOB OF CLEARING UP THOSE ISSUES Please, feel free to make changes to below question in order to improve its quality as a pedagogical tool I have a JAVA class containing one method, the method receives an array object of integers (as you can see in the code); however, in JAVA, everything is pass[ed]-by-value - a well established fact, i.e. overwriting an object or primitive type passed as an argument cannot happen using a local scope object or p. type. In other words, in order to change an object (primitive or reference) in Java, one must access the data member (or "attribute") directly or indirectly via a member function (or "method") that has the authority to change the attribute. Simply, the method must have an effect. The other method for changing the value of an object is to return a value via a function and set the original object to the returned value. Here is my code (and question to follow): CODE FRAG. I: public class BlockSort { public static void sort(Block [] blocks) { boolean sorted = false; int length = blocks.length; while(!sorted) { sorted = true; for (int i = 1; i &lt; length; i++) { if (blocks[i - 1].width &gt; array[i].width) { Block tempBlock = blocks[i - 1]; blocks[i - 1] = blocks[i]; blocks[i] = tempBlock; } else if ((blocks[i - 1].width == array[i].width) &amp;&amp; (blocks[i - 1].length &gt; array[i].length)) { Block tempBlock = blocks[i - 1]; blocks[i - 1] = blocks[i]; blocks[i] = tempBlock; } } length = length - 1; } } Essentially, in a very minimalistic sense, the above code functions the same way as this [NOTE: this statement is not true, see answers): CODE FRAG. 2: public myClass { public void doesNothing(int someParameter) { someParameter = someParameter - 1; } } So, here is my question: without a return type, any value passed to above code will not really do anything, correct? In other w…
has comment: http://stackoverflow.com/comment/36912014
linked to: http://stackoverflow.com/q/1244541
has comment: http://stackoverflow.com/comment/36912102
has answer: http://stackoverflow.com/a/23960776
has comment: http://stackoverflow.com/comment/36911990
has title: Pass-by-value And No Return Type Means Nothing Happens?
tagged with: junit
favorite count: 0
has answer: http://stackoverflow.com/a/23960048

http://stackoverflow.com/comment/37060396
type: Comment
score: 1
has text: @F. Böller: but your interface is not a `Function`. A `Function` has a `T->R` signature while your interface has a `()->()` signature. They are not compatible.
comment on: http://stackoverflow.com/a/24039387
type: AnswerComment

http://stackoverflow.com/a/24041015
has body: Follow This link!! for more details and use private class DrawerItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { selectItem(position); } } and private void selectItem(int position) { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); switch (position) { case 0: ft.replace(R.id.content_frame, new Fragment1, Constants.TAG_FRAGMENT).commit(); break; case 1: ft.replace(R.id.content_frame, new Fragment2, Constants.TAG_FRAGMENT); ft.commit(); break; } mDrawerList.setItemChecked(position, true); setTitle(title[position]); // Close drawer mDrawerLayout.closeDrawer(mDrawerList); }
score: 21
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24006181
answers question: http://stackoverflow.com/q/24006181
upvote count: 21

http://stackoverflow.com/comment/50475675
comment on: http://stackoverflow.com/a/31233737
type: AnswerComment
has text: Thank you, I like your solution as well!
score: 0
type: Comment

http://stackoverflow.com/q/24080047
tagged with: awt
has answer: http://stackoverflow.com/a/24080173
has title: Trying to dynamically generate tabs on a JTabbedPane with content but getting an Exception in thread "AWT-EventQueue-0"
accepted answer: http://stackoverflow.com/a/24116737
favorite count: 0
has body: I am trying to dynamically generate tabs and their containing textfields based on input given by the user. The input is noTCPFlows in the code shown. But when I run the code I keep getting this exception: Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at javax.swing.JTabbedPane.setTitleAt(JTabbedPane.java:1316) at myproject.ns2GUI.trafficInfoInit(ns2GUI.java:622) at myproject.ns2GUI.flowDetailsContinueActionPerformed(ns2GUI.java:567) at myproject.ns2GUI.access$200(ns2GUI.java:16) at myproject.ns2GUI$3.actionPerformed(ns2GUI.java:343) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQ…
tagged with: jtabbedpane
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37143283
score: 1
tagged with: java
tagged with: indexoutofboundsexception
type: Question
has answer: http://stackoverflow.com/a/24116737
answer count: 2
has comment: http://stackoverflow.com/comment/37180541
downvote count: 0
possible better answer: http://stackoverflow.com/a/24080173

http://stackoverflow.com/comment/37036252
has text: @Raguram - "How to use the widget in a different way ?" Don't use it to load the entire file. But my real message is that you / your company need to take the initiative in fixing this problem. If necessary, find someone with deep understand of SWT, and >>pay<< them to develop an appropriate fix for you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24013693
type: Comment

http://stackoverflow.com/comment/81261105
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28330162
type: AnswerComment
has text: Hi James, why do we need to add the text and text_suggest in the solrconfig.xml. I have tried an example and without adding in solrconfig.xml it is working. Do I missing something?

http://stackoverflow.com/q/24055397
score: -1
tagged with: stack-overflow
has body: How can I try and catch the exception in this recursion? this is the code: try { public static long faktoral(long a) { return a*faktoral(a-1); } } catch(exception e){ System.out.print(e.message()); public static void main(String [] args) { System.out.print(faktoral(3)); }
answer count: 1
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37102563
tagged with: recursion
upvote count: 0
tagged with: java
downvote count: 1
has title: How to find exceptions in recursion
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/24062062

http://stackoverflow.com/a/23953193
type: Answer
answers question: http://stackoverflow.com/q/23949897
has body: Problem was that I used PowerMockito.mockStatic but I used RunWith annotation different than: @RunWith(PowerMockRunner.class)
accepted answer of: http://stackoverflow.com/q/23949897
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24005256
has answer: http://stackoverflow.com/a/24005265
has body: I am a beginner in Java, so please go easy on your comments. String test = "test"; test.concat("test"); System.out.println("concatenated string: " +test); System.out.println("concatenated test: " +test.concat(test)); Why does the first print statement not print testtest, while second one does? This might be a really basic question, but I could not find an answer to it online. Can someone please explain?
downvote count: 2
linked to: http://stackoverflow.com/q/2818796
type: Question
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2818796
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/36996915
accepted answer: http://stackoverflow.com/a/24005265
upvote count: 0
answer count: 1
has title: Clarification on String concatenation in java
favorite count: 0
has comment: http://stackoverflow.com/comment/36996966

http://stackoverflow.com/a/52434225
answers question: http://stackoverflow.com/q/23990001
type: Answer
score: 2
upvote count: 2
has body: This solution works for API level 22+, needs no reflection. It is based on the solution proposed here https://stackoverflow.com/a/51380282/3427883. Basically to detect if you have two sim cards or more, you need to check this condition SubscriptionManager localSubscriptionManager = SubscriptionManager.from(context); if (localSubscriptionManager.getActiveSubscriptionInfoCount() &gt; 1) { //do you stuff here } Then based on the user selection the sim card slot (0, 1, ...), you can send the SMS on the selected sim card. Below is a method that does this public static boolean sendSMS(Context context, int simID, String toNum, String centerNum, String smsText, PendingIntent sentIntent, PendingIntent deliveryIntent) { SmsManager smsMan = SmsManager.getDefault(); int[] param; Method method = null; try { SubscriptionManager localSubscriptionManager = SubscriptionManager.from(context); if (localSubscriptionManager.getActiveSubscriptionInfoCount() &gt; 1) { List localList = localSubscriptionManager.getActiveSubscriptionInfoList(); SubscriptionInfo simInfo = (SubscriptionInfo) localList.get(simID); SmsManager.getSmsManagerForSubscriptionId(simInfo.getSubscriptionId()).sendTextMessage(toNum, null, smsText, null, null); } return true; } catch (Exception e) { Log.e("SmsSimUtil.sendSMS", "Exception:" + e.getMessage()); } return false; } Don't forget to add these permission in your app AndroidManifest.xml &lt;uses-permission android:name="android.permission.SEND_SMS"/&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
downvote count: 0
has comment: http://stackoverflow.com/comment/116885577

http://stackoverflow.com/a/24056823
answers question: http://stackoverflow.com/q/24056577
has body: If you want an alternative solution without regex: String a = "{Action}{RequestId}{Custom_21_addtion}{custom_22_substration}{Imapact}{assest}{custom_23_multiplication}"; String[] b = a.split("}"); StringBuilder result = new StringBuilder(); for(String c : b) { // if you want case sensitivity, drop the toLowerCase() if(c.toLowerCase().contains("custom")) result.append(c).append("}"); } System.out.println(result.toString());
score: 0
type: Answer

http://stackoverflow.com/comment/37118731
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24067041
has text: What does `which mv` return? What Unix derivative are you using?
score: 0

http://stackoverflow.com/q/23958105
answer count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/36913606
tagged with: tablecellrenderer
has title: JTable replaces line returns with spaces after multilined text is copied/pasted into cell
type: Question
tagged with: java
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/36910608
has comment: http://stackoverflow.com/comment/36910518
has comment: http://stackoverflow.com/comment/36908821
has comment: http://stackoverflow.com/comment/36908816
has body: As soon as I copy and paste a string with multiple lines into a jtable cell, the line returns are replaced with spaces that make the entry a single line string. How do I keep from losing the line returns? I don't care how it is displayed within the JTable cell. I only care that when I extract the text, I still have the line returns. Here is the part of the code where I am printing out the data that I just entered: table.getModel().addTableModelListener(new TableModelListener(){ public void tableChanged(TableModelEvent e){ int row = e.getFirstRow(); int column = e.getColumn(); if(row &gt;=0 and column &gt;=0){ TableModel tmodel = (TableModel)e.getSource(); Object data = tmodel.getValueAt(row,column); //As soon as I enter the multilined text, it prints it out here without line returns System.out.println(data.toString()); } } } Here is my table model's setValueAt method: public void setValueAt(Object value, int row, int col){ { data[row][col] = value; fireTableCellUpdated(row,col); }
type: UnansweredQuestion

http://stackoverflow.com/comment/36999857
score: 0
comment on: http://stackoverflow.com/a/24005280
type: Comment
has text: @JKK In the example I saw, you did ```...-cp ./main/java/hello```, not ```... -cp ./main/java hello.Application```.
type: AnswerComment

http://stackoverflow.com/q/23968500
tagged with: android
has body: I am using Eclipse and I have an Android application composed of two packages, a core package which is the app and a Settings package which stores a series of global settings for the app (e.g. in-app purchase market key for the app). The app also imports a library (e.g. an in-app wrapper lib), which in turn also uses a copy of that aforementioned global Settings package. How I've implemented this, to date, is with three projects; the App, the Library and a third one for for the Settings (as a library). The Settings Lib exported as a Jar, then put in the build path of the Library and referenced the Library from the top level app, so to avoid the dreaded "Multiple dex files" error (as will happen if I reference the MySettings project from MyLib). Overall, it looks a bit like this: MyApp (MyLib referenced) - Core_App_Logic - Settings MyLib (MySettings.jar in build path) - Lib_Logic MySettings - Settings Resources are prioritized correctly; those in MyApp will be used rather than those in MyLib. However, while MyApp will use the MyApp.Settings package, MyLib will instead use the MySettings.Settings one. Am I missing something with this approach, or should I be looking at a completely different one?
tagged with: java
has answer: http://stackoverflow.com/a/24053877
type: Question
tagged with: eclipse
score: 0
has title: Android/Eclipse: how to prioritize a local over a library package
answer count: 1
tagged with: jar
type: UnansweredQuestion

return
tags question: http://stackoverflow.com/q/23943898
type: Tag
tags question: http://stackoverflow.com/q/24101677
tag name: return
tags question: http://stackoverflow.com/q/23986771
tags question: http://stackoverflow.com/q/23959976
tags question: http://stackoverflow.com/q/24101543
tags question: http://stackoverflow.com/q/24093449
tags question: http://stackoverflow.com/q/23969635
tags question: http://stackoverflow.com/q/23992175
tags question: http://stackoverflow.com/q/24093402

http://stackoverflow.com/comment/37203749
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24064263
has text: I did and it kinda works, but that's not ideal for me

http://stackoverflow.com/q/24051568
favorite count: 0
has comment: http://stackoverflow.com/comment/37083297
has comment: http://stackoverflow.com/comment/37085539
has comment: http://stackoverflow.com/comment/37085389
has title: Why won’t the JVM terminate when I close all the application windows?
has answer: http://stackoverflow.com/a/24051688
has comment: http://stackoverflow.com/comment/37083130
upvote count: 1
tagged with: swing
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24051688
has comment: http://stackoverflow.com/comment/37083392
possible better answer: http://stackoverflow.com/a/24051674
has body: The answer for this that I've seen in many forums is that - The AWT event dispatcher thread is not a daemon thread. You must explicitly call System.exit to terminate the JVM. How not being a daemon thread can cause JVM to close that application. As, it says that only after all non-daemon thread die, program exits. When we create a simple JFrame and do not issue setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE), and when we run the program and when JVM exits, the program is still running
tagged with: java
has answer: http://stackoverflow.com/a/24051674
has comment: http://stackoverflow.com/comment/37085012
has answer: http://stackoverflow.com/a/24051768
type: Question
has comment: http://stackoverflow.com/comment/37083253
score: 0
answer count: 3

http://stackoverflow.com/comment/37155114
type: QuestionComment
has text: please post the stack trace of the NPE
score: 1
comment on: http://stackoverflow.com/q/24090152
type: Comment

http://stackoverflow.com/a/24039365
has comment: http://stackoverflow.com/comment/37060134
has body: use request.getRequestDipatcher()
upvote count: 0
has comment: http://stackoverflow.com/comment/37060658
has comment: http://stackoverflow.com/comment/37060143
answers question: http://stackoverflow.com/q/24039305
type: Answer
score: -1
downvote count: 1

http://stackoverflow.com/q/24064065
has body: ImageIO.read works for most of my images but throwing this exception for a particular jpg image. im = ImageIO.read(this.getClass().getResourceAsStream("plan3v2.jpg")); this line throwing exception: Exception in thread "main" java.awt.color.CMMException: LCMS error 12288 at sun.java2d.cmm.lcms.LCMS.getProfileData(Native Method) at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1310) at com.sun.imageio.plugins.jpeg.JPEGImageReader.setImageData(JPEGImageReader.java:652) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:593) at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:338) at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:470) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:586) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1004) at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:984) at javax.imageio.ImageIO.read(ImageIO.java:1438) at javax.imageio.ImageIO.read(ImageIO.java:1342) at TestClass.run(TestClass.java:13) at TestClass.main(TestClass.java:8) Not sure what the error "LCMS error 12288" mean. Is there any alternative api that can read such images? Thanks in advance.
tagged with: javax.imageio
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24064488
accepted answer: http://stackoverflow.com/a/24077050
has title: java.awt.color.CMMException: LCMS error 12288
score: 0
has answer: http://stackoverflow.com/a/24077050
answer count: 2
has answer: http://stackoverflow.com/a/24064488

http://stackoverflow.com/a/24012620
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/51077848
upvote count: 5
score: 4
has comment: http://stackoverflow.com/comment/49390581
has body: So why I should declare this new variable? Because that's the way the syntax is defined. After all i is accessible inside the for loop. That's semantics. It's irrelevant to syntax. I did not want to use any previous value of i, just did not want to declare a new variable. (I guessed for other iterable items it might be faster using the same variable). Don 't guess about performance. Test and measure. But in this case there's nothing to measure, because any working code is faster than any non-working code.
has comment: http://stackoverflow.com/comment/37011115
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24011816
has comment: http://stackoverflow.com/comment/51077550
accepted answer of: http://stackoverflow.com/q/24011816

http://stackoverflow.com/comment/36889649
type: QuestionComment
has text: I have tried this sqlQuery.list(), and then iterated the result. The 'sqlQuery' here is a select query working on multiple columns one of which doesn't contain a value,resulting in the null pointer.
type: Comment
comment on: http://stackoverflow.com/q/23947860
score: 0

http://stackoverflow.com/q/24026855
tagged with: camera
score: 0
tagged with: java
has body: I am new in Android programming and I am trying to implement the application which have two buttons to open a camera and make a photo and to open a gallery and select photo. I know how to do it using the onClick() in designer mode, but the problem is, that I don't want to have everything in a one big class. So I made two different classes to handle the camera and gallery selection. And here is my code: public class Camera extends Activity implements Button.OnClickListener { private static final int CAMERA_REQUEST = 1888; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAMERA_REQUEST &amp;&amp; resultCode == RESULT_OK) { Bundle extras = data.getExtras(); Bitmap original = (Bitmap) extras.get("data"); ImageView iv = (ImageView) findViewById(R.id.oko); iv.setImageBitmap(original); } } @Override public void onClick(View view) { Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_REQUEST); } } Gallery class: public class Gallery extends Activity implements Button.OnClickListener { @Override public void onActivityResult(int requestCode , int resultCode, Intent data) { if(resultCode == RESULT_OK) { if(requestCode ==1) { ImageView oko = (ImageView)findViewById(R.id.oko); oko.setImageURI(data.getData()); // pobranie z galerii Bitmap okobit = ((BitmapDrawable) oko.getDrawable()).getBitmap(); ImageView iv = (ImageView) findViewById(R.id.oko); iv.setImageBitmap(okobit); } } } @Override public void onClick(View view) { Intent gallery = new Intent(); gallery.setType("image/*"); gallery.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(gallery, "Select Image"), 1); // here is a NULL exception } } and the method which uses those classes: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button gallery = (Button)findViewById(R.id.gallery);…
has title: java.lang.NullPointerException on StartActivityForResult
has answer: http://stackoverflow.com/a/24027295
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37037717
type: Question
tagged with: android
tagged with: gallery
answer count: 1

http://stackoverflow.com/comment/36902174
type: Comment
has text: Minor point, but I'd remove the markdown from `default`, just to make it clear the it's not used explicitly to modify access like the other three
comment on: http://stackoverflow.com/a/23954983
score: 0
type: AnswerComment

http://stackoverflow.com/a/23964114
has comment: http://stackoverflow.com/comment/36920360
accepted answer of: http://stackoverflow.com/q/23964070
type: Answer
downvote count: 0
score: 1
has body: You need to set the Swing look and feel to the system look and feel: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
has comment: http://stackoverflow.com/comment/36920381
answers question: http://stackoverflow.com/q/23964070
has comment: http://stackoverflow.com/comment/36920433
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/24187240
answers question: http://stackoverflow.com/q/24072198
accepted answer of: http://stackoverflow.com/q/24072198
score: 0
has body: it works, thank you all for your help, i just should use ArrayCollection instead of arraylist. public ArrayCollection Selection() { Connection conn = conectar(); ArrayCollection list = new ArrayCollection(); if (conn!=null){ try{ Rapport pr = null; String a; list = new ArrayList&lt;Rapport&gt;(); String sql = "select IntituleChap from Rapport"; Statement st = conn.createStatement(); ResultSet rs=st.executeQuery(sql); while (rs.next()) { a=rs.getString("IntituleChap"); pr = new Rapport(); pr.setIntituleChap(a); list.add(pr); } } catch(SQLException e ) { // System.out.print(e.getMessage()); System.out.println("Error = " + e.getMessage()); } }else { } return list; } thank you all :)
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24065884
has comment: http://stackoverflow.com/comment/37115095
tagged with: neo4j
has body: I'm using the BatchInserter to get specific properties and relations from the neo4j database to write a new index (with numeric indexes) using the BatchInserterIndex. after ~10 minutes the index folder has a size of 4.7G, the memory is fully used, the garbage collection makes it very slow and after some more time the VM ends with an Garbage Collector Exception. the code looks roughly like this: final BatchInserter bInserter = BatchInserters.inserter(this.dbStoreDir, getConfig()); final BatchInserterIndexProvider bIndexInserterProvider = new LuceneBatchInserterIndexProvider(bInserter); final BatchInserterIndex bIndexInserter = bIndexInserterProvider.nodeIndex(indexName, getConfig()); try { final Map&lt;String, Object&gt; propMap = new HashMap&lt;&gt;(); for (final Long id : idSet) { this.filterProperties(bInserter.getNodeProperties(id), propMap); for (final BatchRelationship rel : bInserter.getRelationships(id)) { if (rel.getType().name().equals(ANYREL)) { final Long subNodeId = rel.getEndNode(); this.filterProperties(bInserter.getNodeProperties(subNodeId).entrySet(), propMap); this.filterProperties(bInserter.getRelationshipProperties(rel.getId()).entrySet(), propMap); } } bIndexInserter.add(id, propMap); propMap.clear(); } } finally { bIndexInserter.flush(); bInserter.shutdown(); bIndexInserterProvider.shutdown(); } public static Map&lt;String, String&gt; getConfig() { final Map&lt;String, String&gt; config = new HashMap&lt;&gt;(); config.put("dump_configuration", "false"); config.put("cache_type", "none"); config.put("use_memory_mapped_buffers", "true"); config.put("node_cache_size", "2G"); config.put("relationship_cache_size", "800M"); config.put("neostore.propertystore.db.index.keys.mapped_memory", "200M"); config.put("neostore.propertystore.db.index.mapped_memory", "200M"); config.put("neostore.nodestore.db.mapped_memory", "200M"); config.put("neostore.relationshipstore.db.mapped_memory", "500M"); config.put("neostore.propertystore.db.mapped_memory", "250M"); co…
has comment: http://stackoverflow.com/comment/37136376
type: UnansweredQuestion
tagged with: batch-insert
answer count: 0
tagged with: java
score: 0
has title: Neo4j BatchInserterIndex OutOfMemoryError exception
type: Question
has comment: http://stackoverflow.com/comment/43449815
tagged with: indexing
has comment: http://stackoverflow.com/comment/37332030
tagged with: lucene

http://stackoverflow.com/q/24095344
has answer: http://stackoverflow.com/a/24095354
favorite count: 0
has title: Calling non-static method from static member in Java
upvote count: 2
accepted answer: http://stackoverflow.com/a/24095354
score: 2
type: AnsweredQuestion
has body: This question is rather complicated and I don't know if it's been asked before because I don't know how to phrase the problem in the search box. Here's the code: public class SomeClass { private static final DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); public static String toUTCDateString(Date date) { df.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); return df.format(date); } /* more static methods */ } The static member df will be re-used again in more static methods, but I need to have its time zone set to "UTC" first. Is there a way to call .setTimeZone("UTC") just once and for all? Or do I have to call .setTimeZone("UTC") in each static method?
has comment: http://stackoverflow.com/comment/37164572
tagged with: java
possible better answer: http://stackoverflow.com/a/24095447
has answer: http://stackoverflow.com/a/24095447
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/36969248
type: Comment
has text: @TheLostMind That is true, this solution is partially applicable.
comment on: http://stackoverflow.com/a/23990703
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37018829
has text: line 37 is: captureBtn.setOnClickListener(new View.OnClickListener() {
comment on: http://stackoverflow.com/q/24017013
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24034165
tagged with: overriding
has answer: http://stackoverflow.com/a/24035239
answer count: 2
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/24034289
type: UnansweredQuestion
has body: abstract class A { abstract public void dosome(Class&lt;? extends Number&gt; c); } class B extends A { @Override public void dosome(Class&lt;Number&gt; c) {} } From Java docs: An instance method m1, declared in class C, overrides another instance method m2, declared in class A iff all of the following are true: ..... The signature of m1 is a subsignature (§8.4.2) of the signature of m2. The signature of a method m1 is a subsignature of the signature of a method m2 if either: the signature of m1 is the same as the erasure (§4.6) of the signature of m2. Is erasure of A dosome(Class&lt;Number&gt; c)? If so what is wrong? EDIT1: Or if I switch generic type: abstract class A { abstract public void dosome(Class&lt;Number&gt; c); } class B extends A { @Override public void dosome(Class&lt;? extends Number&gt; c) {} } What is wrong in this case? EDIT2: I know how to fix it, but I want to understand, what is wrong in this case according java rules.
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Java generic method overriding

http://stackoverflow.com/q/23996735
tagged with: collections
downvote count: 1
answer count: 1
has title: Sorting a Map by key using values from another Map
has comment: http://stackoverflow.com/comment/36980935
has comment: http://stackoverflow.com/comment/36980875
tagged with: java
has comment: http://stackoverflow.com/comment/36982048
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23998488
tagged with: sorting
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36982610
has body: I know there are a lot of similar questions, but I think my case is quite special, and I haven't really found a proper answer that helps me, so here it goes. I have a Map&lt;Integer,List&lt;String&gt;&gt; with the Integer being a kind of grouping by type and the Strings list being the elements in that type. Each element in a type can have an order value assigned to it (which is not saved in the List by default), so I've made a Map&lt;Integer, List&lt;Integer&gt;&gt; which consists of the type as key and an element order list as values. I want to sort the 1st Map by keys, but the values of those keys should be the lowest value from the List for the same key in the 2nd Map. I'm trying to do this by using Collections.sort() with a custom Comparator, but I'm a bit lost as to how exactly to achieve that. Here's the unfinished Comparator code: private class sortComparator implements Comparator { private Map&lt;Integer, List&lt;String&gt;&gt; grouped = null; private Map&lt;Integer, List&lt;Integer&gt;&gt; sortOrder = null; public sortComparator(Map&lt;Integer, List&lt;String&gt;&gt; grouped, Map&lt;Integer, List&lt;Integer&gt;&gt; sortOrder){ this.grouped = grouped; this.sortOrder = sortOrder; } @Override public int compare(Object o1, Object o2) { return 0; } //get the lowest value from the values connected to a key private Integer sortGroups(Map&lt;Integer,List&lt;Integer&gt;&gt; sortOrder, Integer key){ List&lt;Integer&gt; calcTypeOrder = sortOrder.get(key); Iterator orderIterator = calcTypeOrder.iterator(); Integer firstElement; Collections.sort(calcTypeOrder); if (orderIterator.hasNext()){ firstElement = (Integer)orderIterator.next(); } else firstElement = 0; return firstElement; } } I'm quite uncertain how exactly to procede or if I'm even on the right track. I hope I was able to explain what I'm trying to do. EDIT: More explanations as requested: Map&lt;Integer, List&lt;String&gt;&gt; grouped //Map&lt;Type, List&lt;ElementNames&gt;&gt; //consists of elements, which l…
tagged with: dictionary
has comment: http://stackoverflow.com/comment/36981416
has comment: http://stackoverflow.com/comment/36980928
has comment: http://stackoverflow.com/comment/36982819
accepted answer: http://stackoverflow.com/a/23998488
score: 0
has comment: http://stackoverflow.com/comment/36982516
upvote count: 1

http://stackoverflow.com/comment/36933984
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23971194
has text: Wow, I did not. But why `this` is not the same for all threads then (object is the same), or `this` here is a thread object? Thanks again for helping me.
type: AnswerComment

http://stackoverflow.com/q/24064399
tagged with: jks
type: Question
score: 3
has answer: http://stackoverflow.com/a/24065161
tagged with: ssl
has comment: http://stackoverflow.com/comment/37108434
upvote count: 3
answer count: 2
linked to: http://stackoverflow.com/q/6340918
has title: How to specify keystore location for Tomcat7 WAR?
downvote count: 0
accepted answer: http://stackoverflow.com/a/24064593
has body: I have a custom JKS file (keystore) on my file system under /opt/myapp/keystore/myapp.jks and am deploying a myapp.war to Tomcat7 that needs to use it. If this was an executable JAR (and not a WAR), I might do something like: java -jar myapp.jar -Djavax.net.ssl.keyStore=/opt/myapp/keystore/myapp.jks -Djavax.net.ssl/keyStorePassword=mypasswd How/where do I accomplish the same in Tomcat7?
favorite count: 0
possible better answer: http://stackoverflow.com/a/24065161
has answer: http://stackoverflow.com/a/24064593
type: AnsweredQuestion
tagged with: java
tagged with: tomcat7

http://stackoverflow.com/comment/37175214
comment on: http://stackoverflow.com/a/24100799
type: AnswerComment
has text: @Braj where in my answer does that seem to be refuted?
score: 0
type: Comment

http://stackoverflow.com/comment/37055103
score: 1
has text: What is 1 in `getInt(1)`?
type: Comment
comment on: http://stackoverflow.com/a/24036503
type: AnswerComment

http://stackoverflow.com/comment/37565720
has text: About using delta, please check this answer to make sure your objects don't get updated with a too large value: http://stackoverflow.com/questions/23995854/how-to-track-time-in-libgdxandroid/23996041#23996041
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23980985

http://stackoverflow.com/comment/36914085
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23960081
has text: have you made any change the test.log file...
score: 0

http://stackoverflow.com/comment/36921269
comment on: http://stackoverflow.com/a/23964655
score: 1
type: AnswerComment
has text: @user3666392 Use _what_?
type: Comment

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/24096342

http://stackoverflow.com/a/24449587
score: 3
has body: I came accross the same the issue (inside a JUnit test) and finally found the reason. When enabling the full Camel traces, I could see the following message: "Bundle **** is waiting for dependencies [(&(component=ldap)(objectClass=org.apache.camel.spi.ComponentResolver)), (&(component=sql)(objectClass=org.apache.camel.spi.ComponentResolver))] " This lead me to add the explicit (test) dependency in my pom, ie: org.apache.camel camel-sql ${camel-version} test NB: to do for all components (jaxb, ldap, sql, cache, etc...) you used in your Camel routes ! This made my error message ("Gave up waiting for Service exception") disappear :-) Hope this helps.
upvote count: 4
type: Answer
answers question: http://stackoverflow.com/q/23993805
has comment: http://stackoverflow.com/comment/49002799
downvote count: 1

http://stackoverflow.com/a/24339655
type: Answer
has comment: http://stackoverflow.com/comment/39553337
has body: I actually solved my problem. The answer is that if you use java 1.6 with jaxws 2.2.x, you need to copy the jaxws-api.jar and jaxb-api.jar in the java endorsed or tomcat endorsed directorties. Also be sure that you generate the object with jaxws 2.2. If you don't copy the jars in the endoresed, the java will pickup the old jaxws default jar which result in to strange problems. Also try to turnoff the allowJunk as some old server and proxies do not support junk.
accepted answer of: http://stackoverflow.com/q/24095236
score: 0
answers question: http://stackoverflow.com/q/24095236
type: AcceptedAnswer

http://stackoverflow.com/q/24006147
answer count: 1
has title: Positioning JButton on JFrame won't show up
tagged with: layout-manager
favorite count: 0
has answer: http://stackoverflow.com/a/24006158
accepted answer: http://stackoverflow.com/a/24006158
duplicate of: http://stackoverflow.com/q/5621338
tagged with: swing
type: AnsweredQuestion
tagged with: null-layout-manager
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5621338
has body: I know this is horrible coding but I desperately need to fix this problem. I've tried multiple ways of trying to position the button but the button still stays in the top center with all the other buttons lined up after it. import javax.imageio.ImageIO; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Graphics; import java.io.IOException; import java.net.URL; public class Template extends JFrame { /** * @param args */ public static void main(String[] args) throws IOException{ // TODO Auto-generated method stub JFrame frame = new JFrame("The Impossible Quiz");//Construct JFrame frame.setLayout(null);//manual setting for button placement frame.setContentPane(new JPanel() {//sets panel as background BufferedImage image = ImageIO.read(new URL("https://pbs.twimg.com/media/BoyFVfXIUAA0Tik.png"));//uses url image public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, 1360, 690, this);//sets image as jframe background } }); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//closes jframe when press exit frame.setSize(1365, 730);//sets size of jframe JPanel buttonpanel = new JPanel();//sets panel for all buttons buttonpanel.setBounds(0, 0, 1460, 690);//sets placing and sizing of panel buttonpanel.setOpaque(false);//makes panel transparent JButton next = new JButton ("Start");//contructs correct start button next.setBounds(10, 5, 40, 50); buttonpanel.add(next);//adds button to panel next.addActionListener(new ActionListener()//adds actionlistener to button { public void actionPerformed(ActionEvent e) { new Introduction();//continues to next question } }); JButton wrongstart = new JButton("Start!!");//constructs wrong start button wrongstart.setSize(100, 400);//setes size of button buttonpanel.add(wrongstart);//adds button to panel wrongstart.addActionListener(new ActionListener()//adds actionlistener to button { public void act…
downvote count: 0

http://stackoverflow.com/q/24039476
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/51691041
score: 21
has answer: http://stackoverflow.com/a/75859422
tagged with: java
tagged with: vaadin
accepted answer: http://stackoverflow.com/a/24039630
has title: Vaadin open link in new tab
downvote count: 0
favorite count: 0
has body: I have the following piece of code that I wrote using Vaadin. The code opens the page www.google.com when the user clicks the button. My question is is there any way for me to specify that the page is to be opened in a new tab? Thanks. button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { getUI().getPage().setLocation("http://www.google.com"); } });
possible better answer: http://stackoverflow.com/a/28908689
has answer: http://stackoverflow.com/a/54945157
answer count: 5
has answer: http://stackoverflow.com/a/28908689
has answer: http://stackoverflow.com/a/52700568
has answer: http://stackoverflow.com/a/24039630
upvote count: 21
type: Question
has comment: http://stackoverflow.com/comment/90343792

http://stackoverflow.com/a/24035592
has comment: http://stackoverflow.com/comment/37053338
downvote count: 0
has comment: http://stackoverflow.com/comment/37053380
has body: The difference is that you can know if GC collected data by calling weakRef.get() and testing if it returned null or not.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37053232
answers question: http://stackoverflow.com/q/24035465

http://stackoverflow.com/comment/36951552
comment on: http://stackoverflow.com/q/23981199
type: QuestionComment
has text: @djechlin I am sorry, but I must say, your answer is not helping me. I asked the question in a wrong manner. I have edited it. And before saying "user is asking us to write test cases that user is too lazy to write himself." you should go through that user's profile to see if he is lazy or not.
type: Comment
score: 2

http://stackoverflow.com/comment/37041155
comment on: http://stackoverflow.com/q/24028869
score: 0
has text: @user3117081 usually it works if you just replace it with / that what I do all the time. But it seams that this does not solve you question
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37142757
comment on: http://stackoverflow.com/q/24075240
score: 0
has text: it doesn't work for me though. i did what you recommened below and i get the error neighnorCells has private access in Cell(in the 2nd change you proposed.) `public class Cell` has a `private ArrayList<Cell> neighborCells; ` inside.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23966668
has comment: http://stackoverflow.com/comment/36925477
upvote count: 2
has comment: http://stackoverflow.com/comment/36925158
has body: You are trying to access an object that was not even passed to the socket.. you only passed a byte of string to the server but you never pass an Object to the server using the ObjectOutputStream..
has comment: http://stackoverflow.com/comment/36925637
type: Answer
has comment: http://stackoverflow.com/comment/36925755
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23966640
has comment: http://stackoverflow.com/comment/36925116

http://stackoverflow.com/a/24037031
has body: The url which you have provided is wrong. There should be a questionmark(?) after "filter". Then only it will consider it as parameters http://localhost:8081/hello/publishAMANSequence/filter?sequenceGenerationTime=1696-09-01T00:00:00Z&amp;AMANId=B1&amp;landingSequenceEntry=11234567890EST Moreover if you are trying to access a webservice you can't do that with a HTTP GET. You need to send it as a SOAP request. You can use APIs like CXF, AXIS etc.
has comment: http://stackoverflow.com/comment/37060158
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24036717
has comment: http://stackoverflow.com/comment/37058451
has comment: http://stackoverflow.com/comment/37059769
has comment: http://stackoverflow.com/comment/37059443
type: Answer

http://stackoverflow.com/comment/37081796
has text: I thought about trying the first way, but then I would end up with a bunch of different signatures which might not save much space in the end. So with the latter, can you show me the code snippet? Is it just using a buffered reader and updating a signature verifier with the bytes from the file. Then once the whole file is read then verify it all? So the java signature update function hashes the input?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24049885
score: 0

http://stackoverflow.com/comment/36994406
score: 1
type: Comment
comment on: http://stackoverflow.com/a/23995734
type: AnswerComment
has text: I upvoted both answers, as they got me on the right track, but this detailed explanation was really helpful as it was simple and explicit. Thank you!

http://stackoverflow.com/a/23985449
type: Answer
has body: I whipped up some sample server client connection. Basically you just define your server to use your localhost then port forward or open the server port depending on what your network configuration is. Thers lots of tutorials about that online. On your client you need to either know your external or internal IP address depending on where your connecting from. This sample just uses your localhost and sends a file from your harddrive, but I wrote it specifically with the intended use of adding in any InputStream or OutputStream so you can adapt this to reading or writing an image. Most servers you will just bind your ip address to 127.0.0.1. When connection to the server outside your local network you will need to find your external IP address. You can find this on websites like whatsmyip.org. import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; public class SendFileExample { public static void main(String [] args) throws IOException { System.out.print("Type 's' for server or 'c' for client: "); char c = (char) System.in.read(); if(Character.toLowerCase(c) == 's') { createServer(); } else if(Character.toLowerCase(c) == 'c') { createClient(); } } public static void createServer() throws IOException { // create a server to listen on port 12345 ServerSocket socket = new ServerSocket(12345, 0, InetAddress.getByName("127.0.0.1")); System.out.println("Server started on " + socket.getInetAddress().getHostAddress() + ":" + socket.getLocalPort() + ",\nWaiting for client to connect."); Socket clientConnection = socket.accept(); System.out.println("Client accepted from "+clientConnection.getInetAddress().getHostAddress()+", sending file"); pipeStreams(new FileInputStream(new File("c:\\from.txt")), clientConnection.getOutputStream(), 1024); System.out.println("File s…
accepted answer of: http://stackoverflow.com/q/23984901
downvote count: 0
answers question: http://stackoverflow.com/q/23984901
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/23983707
has comment: http://stackoverflow.com/comment/36976044
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23981231
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23981231
score: 2
has comment: http://stackoverflow.com/comment/36965427
has comment: http://stackoverflow.com/comment/36965322
has body: Since your user roles are part of the user directory entry, you should be able to load them using a custom UserDetailsContextMapper. Move your custom role loading code to the mapUserFromContext method. You can skip the normal search for roles by using a NullLdapAuthoritiesPopulator. You'll need to configure the authentication provider explicitly: uid={0},ou=myComp,o=myComp,dc=myComp,dc=ldap
has comment: http://stackoverflow.com/comment/36975578
downvote count: 0

http://stackoverflow.com/q/24084973
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/37145421
favorite count: 0
tagged with: jenkins
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37145057
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24086465
has comment: http://stackoverflow.com/comment/37145635
accepted answer: http://stackoverflow.com/a/24086465
type: Question
has title: Generating reports for junit when test methods run individually
has body: I have a Java project with JUnit tests which I run on Jenkins using Ant. Following various tutorials online, I made it possible for all the tests to run individually. My build.xml looks like this: <echo message="Execute Test" /> <sysproperty key="tests" value="${tests}"/> <path refid="classpath"/> <pathelement path="bin"/> <formatter type="xml"/> <include name="${test}.java"/> This, together with my own Runner and Filter classes, and @RunWith annotations, means that I can run an individual test within an individual class like this: ant run_junit -Dtest=ClassWithTests -Dtests=testMethod This works perfectly fine, in Jenkins as well, and I am also able to run the tests in parallel. The problem I have is that the reports for each class get overwritten after each method is run. For example, the above command will produce a file TEST-ClassWithTests.xml with information about the result and output of testMethod. However, if I then run ant run_junit -Dtest=ClassWithTests -Dtests=anotherTestMethod the TEST-ClassWithTests.xml file will get overwritten and will only contain information about the result and output of anotherTestMethod. So my question is: How do I make JUnit generate separate test reports for each method? And is there some way of nicely combining them so that they display well on Jenkins? I would ask whether it is possible to append methods to an existing JUnit report, but these tests are meant to be running in parallel, so that would probably not be helpful.
tagged with: ant
downvote count: 0

http://stackoverflow.com/a/23994529
downvote count: 0
answers question: http://stackoverflow.com/q/23994338
score: 15
type: Answer
has comment: http://stackoverflow.com/comment/36980924
has comment: http://stackoverflow.com/comment/37050194
has comment: http://stackoverflow.com/comment/37002722
has comment: http://stackoverflow.com/comment/36983326
has body: You can use Spring AnnotationUtils.findAnnotation to read annotations from interfaces. Example : Interface I.java public interface I { @SomeAnnotation void theMethod(); } Implementing class A.java public class A implements I { public void theMethod() { Method method = new Object() {}.getClass().getEnclosingMethod(); SomeAnnotation ann = AnnotationUtils.findAnnotation(method, AnnotationTest.class); } } It obviously requires to include in your project (and import) Spring framework classes.
upvote count: 15

http://stackoverflow.com/q/24055716
tagged with: jersey
has body: I'm using Spring and decided to add REST services using Jersey. Here my maven dependencies com.sun.jersey jersey-server 1.18.1 com.sun.jersey jersey-client 1.18.1 com.sun.jersey jersey-json 1.18.1 com.sun.jersey jersey-servlet 1.18.1 com.sun.jersey jersey-spring 1.0 org.springframework spring org.springframework spring-core org.springframework spring-web org.springframework spring-beans org.springframework spring-context And here my web.xml config dispatcherServlet org.springframework.web.servlet.DispatcherServlet namespace mvc jersey-servlet com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.config.property.packages com.c.library.web.ws jersey-servlet /rest/* dispatcherServlet *.html *.ajax But when I start tomcat I've got an error What's the problem? My service looks like this package com.c.library.web.ws; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.springframework.stereotype.Component; @Component @Path("/helloworld") public class JerseyRestService { @GET @Produces("text/plain") public String getHello() { return "Hello world!"; } }
score: 0
has title: java.lang.ClassNotFoundException: com.sun.jersey.spi.service.ComponentProvider
answer count: 1
tagged with: tomcat
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/26018164
tagged with: java
type: Question

http://stackoverflow.com/comment/37018273
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24016458
type: QuestionComment
has text: Yes I am sure My Query is fine. Iv'e been stuck on it for 3 hours now.. I must have checked it 1000 times.

http://stackoverflow.com/comment/36943533
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23976995
has text: Have you tried running the program manually (using pen and paper) to see how it goes wrong?
type: Comment

http://stackoverflow.com/q/24068171
has comment: http://stackoverflow.com/comment/37114027
has comment: http://stackoverflow.com/comment/37113988
has comment: http://stackoverflow.com/comment/37114276
type: UnansweredQuestion
has title: Running Spring app as jar, beans not found
tagged with: spring
has answer: http://stackoverflow.com/a/30711557
tagged with: java
tagged with: hibernate
has body: When using eclipse, I get no errors, however once i export my project as a runnable jar file and try running it w/ java -jar myjar.jar, it gives me this error. Jun 05, 2014 1:46:22 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@112f8578: startup date [Thu Jun 05 13:46:22 CDT 2014]; root of context hierarchy Jun 05, 2014 1:46:22 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@56e3cbb9: defining beans []; root of factory hierarchy Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'jobTaskService'is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:575) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1114) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:279) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121) at com.tw.JobQueue.App.main(App.java:22) But again, when i use Eclipse, this error does not occur. Here is some of my code applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.sprin…
type: Question
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/24068481
answer count: 2
has comment: http://stackoverflow.com/comment/37114190
tagged with: jar

http://stackoverflow.com/a/24506578
answers question: http://stackoverflow.com/q/23967022
score: 0
type: Answer
upvote count: 1
has body: Maybe I misunderstood your question I don't get why you throw the exception in the view. doesn't make sense to me. but // the model /////////////////// class player{ int coin count = 0 setcoincount(int number){ // } getcoincount() { // } } // the controller /////////////////// class cont{ model m; view v; cont(model m, view v){ // code.. } int checkBalance(){ return m.getBalance(); // get the balance from the model // sends it to the view } } // the view /////////////////// class view{ cont c; // when the player click the buy button ..... butonClick event handle.. (){ c.checkBalance(); // if the balance is 0 throw an exception } } // the main method /////////////////// class mian{ psvm(string args[]){ // the model and view doesn't know each other model m = new model() view v = new view() controller c = new controller (m , v ) v.setVisible true } }
downvote count: 1

http://stackoverflow.com/a/24005265
has comment: http://stackoverflow.com/comment/36996938
has comment: http://stackoverflow.com/comment/36996991
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36996943
has comment: http://stackoverflow.com/comment/36996990
accepted answer of: http://stackoverflow.com/q/24005256
has comment: http://stackoverflow.com/comment/36997055
type: Answer
has body: Because you're not assigning the concatenated String to another value (as concat() returns the resulting String), so it is lost. If you want to get the result, you need to do: test = test.concat("test"); The second println() works, because the resulting concatenated string is returned, captured and used immediately by System.out.println(), but is then lost outside of the println() as it is not assigned (so if you check test after, it still just contains "test"). Here's the doc: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#concat%28java.lang.String%29
has comment: http://stackoverflow.com/comment/36997063
answers question: http://stackoverflow.com/q/24005256
upvote count: 3
has comment: http://stackoverflow.com/comment/36997029
score: 3
has comment: http://stackoverflow.com/comment/36996958
has comment: http://stackoverflow.com/comment/36997013

http://stackoverflow.com/comment/37149837
type: QuestionComment
has text: What do you want `group(1)` to do/return? Do you know what group in regex is?
comment on: http://stackoverflow.com/q/24087556
score: 0
type: Comment

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/23981858
tags question: http://stackoverflow.com/q/24040546

http://stackoverflow.com/comment/37130869
score: 1
comment on: http://stackoverflow.com/q/24076971
type: Comment
has text: @Duncan: Well, java builds of larger projects happen to take quite some time. If adding imports for all classes in the same package could yield, e.g., 20% less compile time it would be worth adding those imports. Thus, the question is not purely theoretical.
type: QuestionComment

http://stackoverflow.com/comment/37065832
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24042324
has text: good catch with the `i`

http://stackoverflow.com/q/23969781
has title: Is there any way to find out the extensions of the Images stored in a database as binary data?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23969974
favorite count: 0
has body: I have to get Product details including Product Image(binary data) from MSSQL database and store it locally on Android device as image files, I don't know the type of the Images. I think when we're storing Images as files its extension matters, if it matters is there any way to find out the Image Extensions? Thanks and regards.
tagged with: sql-server
type: Question
tagged with: android
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/36930574
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23969974
tagged with: java

http://stackoverflow.com/q/23961676
has title: How do I reference a linux directory location in java string?
has comment: http://stackoverflow.com/comment/36915442
has comment: http://stackoverflow.com/comment/36915451
type: UnansweredQuestion
tagged with: unix
has body: I am getting null pointers with both of these examples: String Dir = "/mnt/edocs/DEV/SCAN/DONE"; String Dir = "\\mnt\\edocs\\DEV\\SCAN\\DONE"; File file = new File(Dir); What is the correct way to do this?
answer count: 0
has comment: http://stackoverflow.com/comment/36916037
tagged with: java
has comment: http://stackoverflow.com/comment/36915400
type: Question
has comment: http://stackoverflow.com/comment/36915499
has comment: http://stackoverflow.com/comment/36915475
score: 0
tagged with: filesystems

http://stackoverflow.com/q/23993440
type: Question
has title: Autosave on jsp page without using database
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23993855
score: 0
answer count: 1
tagged with: jakarta-ee
tagged with: java
accepted answer: http://stackoverflow.com/a/23993855
has comment: http://stackoverflow.com/comment/36974526
type: AnsweredQuestion
tagged with: jsp
has comment: http://stackoverflow.com/comment/36974545
has body: I have a simple registration page and login in page.if user logs in successfully can access the registration page. what i need is, consider he is in middle of the registration page if he bymistake close the browser or even the system crash down.the entried data may lost.i need to save(not database) those filled contents to be populated when he logs in again.I dont want cokkie autocomplete.Any other option avaliable? and how about serialization will it be helpful?
has comment: http://stackoverflow.com/comment/36974254

http://stackoverflow.com/comment/37069194
comment on: http://stackoverflow.com/a/24043786
type: Comment
has text: Actually...Yeah that seems like a bad idea...OK. So I changed (1) and now (2) is the only remaining error.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24052002
has comment: http://stackoverflow.com/comment/37083939
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24051705
has body: If your are using compareTo method then i am excepting you have implemented Comparable interface in your class and provide a implementation of the method compareTo. let me know how you are comparing object on what logic ,based on that only you get the solution. I have little bit confuse on this if (getClass() != other.getClass()) throw new ClassCastException(); if it is the code in your compareTo method then rather then doing this create one more interface say "XYZ" and implement that Interface to both the class check the logic public int compareTo(T obj){ if(this instanceof XYZ &amp;&amp; obj instanceof XYZ)){ return 0; }else{ throw new ClassCastException(); } }

http://stackoverflow.com/comment/36902299
type: QuestionComment
has text: Have you tried to look at thread dump taken at these times? jps/jstack from command line. Very useful for identifying hot spots such as yours.
comment on: http://stackoverflow.com/q/23953381
score: 0
type: Comment

http://stackoverflow.com/comment/41269179
type: QuestionComment
has text: I think that's what we've been considering for the past couple days. After all, if you're using Google Maps on Android .. their design pattern doesn't use a tooltip/popup at all. They have a custom view that slides up from the bottom and is scrollable. We're thinking that might be a more natural approach on the Android platform.
comment on: http://stackoverflow.com/q/24013082
score: 0
type: Comment

http://stackoverflow.com/comment/37145691
score: 0
type: Comment
type: QuestionComment
has text: Can you post the pom.xml file that is used for the shaded jar project? I'm wondering if you are just not running the maven-shade-plugin as part of the proper phase that Jenkins is running.
comment on: http://stackoverflow.com/q/24084745

http://stackoverflow.com/q/23994922
has comment: http://stackoverflow.com/comment/36977122
has comment: http://stackoverflow.com/comment/36978021
answer count: 5
has answer: http://stackoverflow.com/a/23994962
tagged with: android
has comment: http://stackoverflow.com/comment/36977469
has title: ArrayIndexOutOfBounds in android
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23994985
linked to: http://stackoverflow.com/q/3951252
tagged with: java
has answer: http://stackoverflow.com/a/23994956
type: Question
tagged with: slideshow
accepted answer: http://stackoverflow.com/a/23994936
downvote count: 6
tagged with: arraylist
has body: I have made an android app,In that I am getting an arrayList of ImageUrls,I want to make an automated lsideShow in android by using this arrayLis,I have tried as below using thread but It gives me arrayIndexOPutOfBounds exception,It goes to second image abd then gives exception,Please help me to save me,My code is as below: resultArray = new ArrayList&lt;String&gt;(); iv_paly.setOnClickListener(new OnCLickListener()){ @Override OnClick(){ imageLoader.displayImage(resultArray.get(1), proImage, options); proImage.postDelayed(swapImage, 3000); } MediaPlayer introSound, bellSound; Runnable swapImage = new Runnable() { @Override public void run() { for (int i = 0; i &lt;= resultArray.size(); i++) { imageLoader.displayImage(resultArray.get(i), proImage, options); } } }; }
has answer: http://stackoverflow.com/a/23995357
tagged with: runnable
has answer: http://stackoverflow.com/a/23994936
possible better answer: http://stackoverflow.com/a/23994956
duplicate of: http://stackoverflow.com/q/3951252
score: -6
favorite count: 0

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/24015152

http://stackoverflow.com/q/24098373
has comment: http://stackoverflow.com/comment/37170283
has title: Sorting an object array based on a property
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37170355
tagged with: java
has body: EDIT: Added some information. I got an array of Objects. Each object has a name and a value. I need to sort the objects in descending order of those values, and print the names. I saw this easy solution but can't seem to apply it to my problem: http://www.mkyong.com/java/java-object-sorting-example-comparable-and-comparator/ The code compiles with no error but the array is not sorted at all. I know this because I know what the output should be i.e. the output should be something like var364, var200, var65 etc. and what i get is var1, var2, var3 etc. I tried to strip the code of the irrelevant parts here: Main class print(data.preselection()); private void print (UnitRow preselectedUnitRow) { out.printf("Variables after preselection: \n"); for (int i=0;i&lt;PRESELECTION_LIMIT;i++) { out.printf("%s, ",preselectedUnitRow.getUnitName(i)); } } Dataset (data) private UnitRow data; ... public UnitRow preselection() { UnitRow standardDeviationUnits = new UnitRow(numberOfVariables); for (int i=0;i&lt;numberOfVariables;i++){ Unit unit = new Unit(1,variableNames[i],calculateStandardDeviation(i)); standardDeviationUnits.add(unit); } standardDeviationUnits.sort(); return standardDeviationUnits; } UnitRow import java.util.Arrays; public class UnitRow { private Unit[] units; private int count; ... public void sort() { Arrays.sort(units); } } Unit public class Unit implements Comparable&lt;Unit&gt;{ private NumberRow elements; //just a class with an array of doubles private String name; ... @Override public int compareTo(Unit compareUnit) { //getValue returns a single type double number int comparison = (int) (compareUnit.getValue(0) - getValue(0)); return comparison; } } I am assuming my implementation of Comparable is wrong. Can you spot the problem? I say this because I tested as following: System.out.println(standardDeviationUnits.getValue(0,0)); standardDeviationUnits.sort(); System.out.println(standardDeviationUnits.getValue(0,0)); And the exact same value is returned.
has comment: http://stackoverflow.com/comment/37170153
has comment: http://stackoverflow.com/comment/37170124
has comment: http://stackoverflow.com/comment/37170315
has comment: http://stackoverflow.com/comment/37170413
type: Question
has comment: http://stackoverflow.com/comment/37170863
has answer: http://stackoverflow.com/a/24098536
has comment: http://stackoverflow.com/comment/37170397
accepted answer: http://stackoverflow.com/a/24098536
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/37170213
tagged with: sorting
possible better answer: http://stackoverflow.com/a/24098593
answer count: 2
downvote count: 3
has answer: http://stackoverflow.com/a/24098593
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37016835
comment on: http://stackoverflow.com/a/24016101
score: 0
type: Comment
has text: Why? how an api that is not made in java will call your api?
type: AnswerComment

http://stackoverflow.com/comment/36906925
type: QuestionComment
type: Comment
has text: Use a polymorphic collection.
score: 2
comment on: http://stackoverflow.com/q/23957393

http://stackoverflow.com/comment/36963042
type: QuestionComment
has text: Your class can't compile properly as this is in some package.
comment on: http://stackoverflow.com/q/23987323
score: 0
type: Comment

http://stackoverflow.com/q/23976650
type: Question
has answer: http://stackoverflow.com/a/23976677
score: 0
has answer: http://stackoverflow.com/a/23976672
tagged with: jbutton
has answer: http://stackoverflow.com/a/23976671
tagged with: java
has comment: http://stackoverflow.com/comment/36943809
has title: How to create a array of an object that requires parameters
answer count: 4
tagged with: arrays
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23977355
tagged with: nullpointerexception
has body: I have some code here final Ship[] Ships = new Ship[3]; for(int x = 0; x &lt; 3; x++) { Ships[x].setText("Set Ship length: " + (x+1)); // this line in particular } I am getting a null pointer exception, I think this is because the Ships object requires a string and a int in its parameters for the constructors that it contains, how are you supposed to create and array of objects where each object requires parameters?

http://stackoverflow.com/comment/36996958
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24005265
type: AnswerComment
has text: Sorry I dont understand. I did refer to the Oracle docs, and I understand how immutability works. But my question is how does it work in 2nd print statement vs 1st?

http://stackoverflow.com/comment/37087469
type: AnswerComment
comment on: http://stackoverflow.com/a/24053637
type: Comment
has text: @dipankaj because the whole point of Java 8 is to add methods that avoid explicit looping and use more functional paradigms. `String.join` is supposed to be a shortcut for `Stream.of(a, b, c).collect(Collectors.joining())`. If you don't see the benefits of allowing users to join a `String` in one line of code rather than 4 then just don't use it...
score: 23

http://stackoverflow.com/comment/37133417
has text: I'll see if I can dig up an example from my source code later today.
comment on: http://stackoverflow.com/a/24078448
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36963522
comment on: http://stackoverflow.com/q/23987580
score: 2
has text: I don't think you've given us enough information to help you. Given you're looping, it seems like you're reusing the `strUrl` `StringBuilder`, repeatedly appending to it, so no that doesn't seem pointless. If you used string concatenation, `StringBuilders` would be created and thrown away each time.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36884961
has text: There's no mystery. read() didn't completely read the key string, so the following stuff was misinterpreted. Using readFully() *is* the answer.
type: Comment
comment on: http://stackoverflow.com/a/23945194
score: 0
type: AnswerComment

http://stackoverflow.com/a/24031921
has body: Directly from specification An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 and can represent a positive, zero, or negative integer. You can check 0 though 7
upvote count: 1
answers question: http://stackoverflow.com/q/24031843
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/23991171
answer count: 1
has title: Dozer - map child elements
has answer: http://stackoverflow.com/a/24005871
tagged with: dozer
tagged with: mapping
score: 0
has body: I have 2 Java objects, each contains a List of different Java objects. Using Dozer, I need to map the data from one object to another object. Can anyone help me pa the data from the FromPerson object to the ToPerson object? I am able to map the personList (6 in total) but not its fields. class From{ List<FromPerson> personList; } class FromPerson{ String name; } class To{ List<ToPerson> personList; } class ToPerson{ String toPersonName; } com.From com.To
accepted answer: http://stackoverflow.com/a/24005871
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36939601
type: Comment
has text: There is insufficient content to diagnose the problem, unless you provide an example of your problem, the question will be closed
score: 2
comment on: http://stackoverflow.com/q/23975062
type: QuestionComment

null
tags question: http://stackoverflow.com/q/24031736
tag name: null
tags question: http://stackoverflow.com/q/24006297
tags question: http://stackoverflow.com/q/23997618
tags question: http://stackoverflow.com/q/24015198
tags question: http://stackoverflow.com/q/24097059
tags question: http://stackoverflow.com/q/23983742
tags question: http://stackoverflow.com/q/23966862
tags question: http://stackoverflow.com/q/23975093
type: Tag
tags question: http://stackoverflow.com/q/24101765
tags question: http://stackoverflow.com/q/24093449
tags question: http://stackoverflow.com/q/23980690
tags question: http://stackoverflow.com/q/23989811
tags question: http://stackoverflow.com/q/24045840

http://stackoverflow.com/comment/37173510
type: Comment
comment on: http://stackoverflow.com/q/24100123
type: QuestionComment
has text: Won't that generate the same direction every time I use it?
score: 0

http://stackoverflow.com/comment/36933173
type: Comment
has text: Thank you very much. But now I get 100,000 even without synchronized... :( I don't understand anything... edit: sorry, I should have join in another loop. Everything works as I excpected now, thanks again! *edit2:* actually no, if I have join in another loop, it doesn't give me 100k even though go is synchronized :(
score: 1
comment on: http://stackoverflow.com/a/23971217
type: AnswerComment

http://stackoverflow.com/comment/36894482
has text: Yeah glad it solves your problem :) but look again at the answer, i set the parameter "minHeight" so the row height won't be less than 140dip ;)
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23943888

http://stackoverflow.com/a/24002484
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24002382
upvote count: 2
type: AcceptedAnswer
has body: The cost isn't actually what you think: you're only holding a single reference (four bytes on most systems) to the same Position object in memory. The overhead is minimal; don't even worry about it.
type: Answer
answers question: http://stackoverflow.com/q/24002382
score: 2

http://stackoverflow.com/comment/37008762
type: QuestionComment
comment on: http://stackoverflow.com/q/24011849
score: 0
has text: Post your `AsyncTask`
type: Comment

http://stackoverflow.com/comment/37079043
type: Comment
score: 1
has text: Don't override paint and then add you buffer strategy to it. Don't use repaint, you've changed how painting is been done, you should move the logic (from paint) to you game loop
type: QuestionComment
comment on: http://stackoverflow.com/q/24049032

http://stackoverflow.com/comment/37110239
comment on: http://stackoverflow.com/q/24065434
score: 0
type: Comment
has text: @LuiggiMendoza On further thought I concede that Integer and Boolean are wrapper classes, although they exist for a subtly different purpose than other wrapper classes one might write. I (mis)read the question as implying that OP considered String a wrapper class, which threw me off. I'm still unsure of the intent of the question: is OP asking why those specific classes are good as keys, or why any classes are good as keys if they wrap other objects, or is the question why we can't do `Map<int,int>`?
type: QuestionComment

http://stackoverflow.com/comment/37156719
has text: I don't think i am..i wasn't sure how to handle statements with pooling.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24090935

http://stackoverflow.com/comment/36877341
comment on: http://stackoverflow.com/q/23941414
type: Comment
type: QuestionComment
score: 1
has text: This is also discussed in this question: http://stackoverflow.com/questions/1873995/run-a-single-test-method-with-maven

http://stackoverflow.com/q/24051221
tagged with: batch-processing
has answer: http://stackoverflow.com/a/24054248
accepted answer: http://stackoverflow.com/a/24054248
favorite count: 0
possible better answer: http://stackoverflow.com/a/30709273
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm Trying to insert a batch of objects into Cassandra something like this: public void insertIntoCassandra(ArrayList&lt;FileLoaderVo&gt; LoadVo) throws NitroLoaderException { int temp = LoadVo.size(); try { Session session = cassandraDAO.getSession(); if (session == null) { String msg = "CassandraDAO.getSession() returned null"; logger.error(msg); throw new FileLoaderException(msg); } BoundStatement bStmtHistTable = null; if (pStmtHistTable == null) { pStmtHistTable = session.prepare(insertToCassandra); pStmtHistTable.setConsistencyLevel(ConsistencyLevel.ONE); } for (FileLoaderVo fileLoaderVo : LoadVo) { bStmtHistTable = pStmtHistTable.bind(fileLoaderVo.getSecurityCode(), fileLoaderVo.getType(), fileLoaderVo.getAreaCode(), fileLoaderVo.getEmpName(), fileLoaderVo.getCityType(), fileLoaderVo.getHomeFIPS(), fileLoaderVo.getLastName(), fileLoaderVo.getDst(), fileLoaderVo.getCssCode(), fileLoaderVo.getAbbr(), fileLoaderVo.getOfficeFIPS(), fileLoaderVo.getMiddleName(), fileLoaderVo.getZone(), fileLoaderVo.getUtc()); session.execute(bStmtHistTable); logger.info("LoadVo.size() is :"+temp); temp--; } } catch (Exception e) { System.out.println(e); } } Here I'm passing this method an ArrayList of objects to be inserted into Cassandra., But Is there any way I could run a single query on these objects like a batch insert ? I've looked into datastax but couldn't find anything, your inputs would be appreciated. Thanks in advance.
type: Question
has answer: http://stackoverflow.com/a/30709273
answer count: 2
downvote count: 0
has title: Batch queries into Cassandra
tagged with: cassandra
tagged with: datastax

http://stackoverflow.com/comment/36953478
score: 0
type: AnswerComment
has text: thanks alot, i will try. what about my problem in using cmd? how can i set the CLASSPATH? correctly coz i think that's the reason for NoClassDefFoundError.
comment on: http://stackoverflow.com/a/23981357
type: Comment

http://stackoverflow.com/comment/36917511
has text: @ElliottFrisch, As for constant folding, like Markus A pointed out, if it's a local var or a function arg, then the compiler should be smart enough to know whether the code changes it or not. So the question is, why mark a _local_ variable `final` other than for documentation purposes or to make it visible to an anonymous inner class?
comment on: http://stackoverflow.com/q/23962533
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37033240
score: 2
has text: What's wrong with the built-in Java Code Style Formatter customization tool in Eclipse? You can customize the profile to modify how Eclipse formats your code. Goto **Window > Preferences > Java > Code Style > Formatter**
comment on: http://stackoverflow.com/q/24024720
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24097482
accepted answer of: http://stackoverflow.com/q/24097319
type: Answer
has comment: http://stackoverflow.com/comment/37193388
has body: All the variables that are needed to be accessed by stock() can be sent via a parameter list, and the method stock() can then be called inside main(), where these variables can be provided as arguments. However, please be aware that your stock() method is not static, hence you will need to create object of Inventry class. If you are not instantiating Inventry class, then you should declare stock() as static. Stock() should be declared as: public static void Stock(int i, String objIn[], String quan[]){ ... } and should be called inside main() as: Stock(I, objIn, quan);
score: 0
answers question: http://stackoverflow.com/q/24097319
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37180890

http://stackoverflow.com/comment/37040960
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24028191
has text: Jim, I hear what you're saying about subjectively correct answers. My question is for anyone that has come across this type of interface before because I can't find it and it seems pretty generic. I'll try to tweak the question to be more useful and will await community verdict on whether to close it.
score: 0

http://stackoverflow.com/a/23973331
has comment: http://stackoverflow.com/comment/66829178
type: Answer
answers question: http://stackoverflow.com/q/23973107
has comment: http://stackoverflow.com/comment/137170469
has comment: http://stackoverflow.com/comment/66826420
has comment: http://stackoverflow.com/comment/91617248
score: 143
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/77385500
has body: Just that there is no misunderstanding: You do ask about java.lang.annotation.Inherited. This is a annotation for annotations.It means that subclasses of annotated classes are considered having the same annotation as their superclass. Example Consider the following 2 Annotations: @Inherited @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface InheritedAnnotationType { } and @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface UninheritedAnnotationType { } If three classes are annotated like this: @UninheritedAnnotationType class A { } @InheritedAnnotationType class B extends A { } class C extends B { } running this code System.out.println(new A().getClass().getAnnotation(InheritedAnnotationType.class)); System.out.println(new B().getClass().getAnnotation(InheritedAnnotationType.class)); System.out.println(new C().getClass().getAnnotation(InheritedAnnotationType.class)); System.out.println(&quot;_________________________________&quot;); System.out.println(new A().getClass().getAnnotation(UninheritedAnnotationType.class)); System.out.println(new B().getClass().getAnnotation(UninheritedAnnotationType.class)); System.out.println(new C().getClass().getAnnotation(UninheritedAnnotationType.class)); will print a result similar to this (depending on the packages of the annotation): null @InheritedAnnotationType() @InheritedAnnotationType() _________________________________ @UninheritedAnnotationType() null null As you can see UninheritedAnnotationType is not inherited but C inherits annotation InheritedAnnotationType from B. I don't know what methods have to do with that.
upvote count: 144
accepted answer of: http://stackoverflow.com/q/23973107

http://stackoverflow.com/comment/36892828
type: Comment
has text: I can't add it in the method maker because I don't have the name, address and age parameters!
comment on: http://stackoverflow.com/a/23949529
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37030987
has text: Thanks i'll poste the methode when I'm done. How about the other methode
comment on: http://stackoverflow.com/a/24023042
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23976959
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23976457
has body: Here's an example using tail recursion. Comments should explain. It's deceptively simple. public class ProveIfSorted{ public static void main( String[] args ){ int[] myArray = new int[]{ 1, 3, 5, 5, 10, 17, 19 }; System.out.println( "The array is sorted: " + checkSorted( myArray ) ); } /** * This is the public entry point which should be kept as simple as possible. * All the caller has is the array, so that is all that should be asked. * The public interface should not pass the burden of setup to the caller. * Think of this as the wrapper or setup method for the recursive method. * * @param array the array under test. Null or empty arrays are considered to * be unsorted -- by definition. * @return {@code true} if the array is sorted ascending. */ public static boolean checkSorted( int[] array ){ // Now we call the recursive method -- if the array is not null. Here we // pass in index values and an indicator for what we have found so far. // At this point, all we're conserned about is if the array is null or // empty. return checkSorted( array, 1, array != null &amp;&amp; array.length &gt; 0 ); } /** * This is the private work horse. Using tail recursion, we can exit if the * result of the previous invocation found the array to be unsorted or if we * have arrived at the end of the array. Otherwise, we call ourselves with * the next index value and the result of the comparison of this entry with * the previous entry. * * @param array the array under test * @param ndx the array slot to examine with the previous slot * @param sorted the result of the last examination. As long as this is * {@code true}, we continue testing. * @return {@code true} if the array is sorted ascending. */ private static boolean checkSorted( int[] array, int ndx, boolean sorted ){ if( !sorted || ndx == array.length ){ return sorted; } else{ return checkSorted( array, ndx + 1, array[ ndx - 1] &lt;= array[ ndx] ); } } }

http://stackoverflow.com/a/24013623
has comment: http://stackoverflow.com/comment/37042944
accepted answer of: http://stackoverflow.com/q/24013548
answers question: http://stackoverflow.com/q/24013548
has comment: http://stackoverflow.com/comment/37090360
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37012067
has body: From within a constructor, you can also use the this keyword to call another constructor in the same class. Doing so is called an explicit constructor invocation. Source If you do new Rational() the empty constructor will be called. This constructor will then call the constructor with one argument, i.e. new Rational(0) which again will call new Rational(0,1) That last constructor will then set the instance variables. For further information look at this tutorial. Also interesting: Java Language Specification
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37054458
type: QuestionComment
has text: @user1684030 I have the solution. In a couple of hours I'll post the answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23998955

http://stackoverflow.com/q/23970436
type: AnsweredQuestion
has body: I am new to android development, I was trying to develop a calendar application. I was able to generate a calendar. Later I was trying to add vedic astrology information to each date. I had a Java program for computing these information. So I copied all these code (18 java files, and lot of double value operations) into my calendar app and tried to run, but this time I was getting only a black screen. ComputeDailyPanchangam computeDailyPanchangam=new ComputeDailyPanchangam(); computeDailyPanchangam.setPanchangamType(Panchangam.Type.VEDIC_ENGLISH); computeDailyPanchangam.setLongitudeLatitude(-67.28, 9.97); GregorianCalendar temp=(GregorianCalendar)gCalendar.clone(); //GregorianCalendar instance for a date computeDailyPanchangam.setDate(temp); DailyPanchangam panchangam=computeDailyPanchangam.getDailyPanchangam();//Computes astrology information for the day, // Nakshatra, thithi, karana, yoga etc. The code has lot of computations like, moon ecliptic longitude and sun ecliptic longitude calculation, sunrise time calculation etc for a date, also nee to instantiate many objects for. Can any body help me to complete this application.
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23970573
has comment: http://stackoverflow.com/comment/36931652
downvote count: 0
has comment: http://stackoverflow.com/comment/36931706
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/36931752
favorite count: 0
has answer: http://stackoverflow.com/a/23970573
has comment: http://stackoverflow.com/comment/36931576
tagged with: astronomy
upvote count: 1
has title: Astronomical Calculations: J2SE code woking, but not in android

http://stackoverflow.com/comment/36930541
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23967975
has text: What happens when you hit /_ah/api/explorer endpoint ? do you see the list of APIs listed and are you able to invoke/test the APIs via the API Explorer?
score: 0

http://stackoverflow.com/a/24062007
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37104252
has comment: http://stackoverflow.com/comment/70337152
has body: You have two possibilities: Make your panel hidden and show it after ajax request Place an EmptyPanel and replace it after ajax request In both cases, you have to place a placeholder tag in your markup including output markup &lt;span wicket:id="homePanel"&gt;&lt;/span&gt; SOLUTION 1: Make your panel hidden and show it after ajax request final Panel homePanel = new HomePanel("homePanel"); homePanel.setOuputMarkupPlaceholderTag(true); homePanel.setOuputMarkupId(true); homePanel.setVisible(false); add(homePanel); add(new AjaxSubmitLink("home") { protected void onSubmit(AjaxRequestTarget target, Form&lt;?&gt; form) { homePanel.setVisible(true); // in Wicket 1.4 instead of target.add(Component) // target.addComponent(homePanel); target.add(homePanel); } }); SOLUTION 2: Place an EmptyPanel and replace it after ajax request final Panel emptyPanel = new EmptyPanel("homePanel"); emptyPanel.setOuputMarkupPlaceholderTag(true); emptyPanel.setOuputMarkupId(true); add(emptyPanel); add(new AjaxSubmitLink("home") { protected void onSubmit(AjaxRequestTarget target, Form&lt;?&gt; form) { Panel homePanel = new HomePanel("homePanel"); homePanel.setOuputMarkupPlaceholderTag(true); homePanel.setOuputMarkupId(true); // if your Page class is MyPage.class MyPage.this.addOrReplace(homePanel); // in Wicket 1.4 instead of target.add(Component) // target.addComponent(homePanel); target.add(homePanel); } });
type: Answer
accepted answer of: http://stackoverflow.com/q/24061261
score: 6
answers question: http://stackoverflow.com/q/24061261
upvote count: 6
has comment: http://stackoverflow.com/comment/37285189

http://stackoverflow.com/comment/36935898
type: QuestionComment
type: Comment
has text: it's caused by the fact that for every thread you create a matrix (100000 matrixs), which will cause a OutOfMemory
comment on: http://stackoverflow.com/q/23971938
score: 0

universal-image-loader
tags question: http://stackoverflow.com/q/24008081
type: Tag
tag name: universal-image-loader

http://stackoverflow.com/a/23964027
answers question: http://stackoverflow.com/q/23957705
score: 0
type: Answer
has body: Simply add a value changed listener on date picker to listen for any change in the date. For example if current date is not allowed and it's selected then simply discard the changes and revert back to previous date or show a warning message as well if needed and add style for current date to look it as disabled. Here date time format is used to check for date only, time is discarded while checking dates. Sample code: private Date prevDate; ... final DateBox dateBox = new DateBox(); final DateTimeFormat dateTimeFormat=DateTimeFormat.getFormat("MM/dd/yyyy"); dateBox.getDatePicker().addValueChangeHandler(new ValueChangeHandler&lt;Date&gt;() { @Override public void onValueChange(ValueChangeEvent&lt;Date&gt; event) { if (dateTimeFormat.format(event.getValue()).equals(dateTimeFormat.format(new Date()))) { dateBox.setValue(prevDate); // show warning message here }else{ prevDate=event.getValue(); } } });

http://stackoverflow.com/q/23992957
has comment: http://stackoverflow.com/comment/36973298
tagged with: pidcrypt
score: 0
has comment: http://stackoverflow.com/comment/36977697
favorite count: 0
has body: I am getting an encrypted text on the client side which has been encrypted at server(with java) using AES-256 bit , and SHA-256 (2048 bit), i have no idea how to decrypt it. (provided that i am having a key at the client side which has been used at server side for the encryption purpose and i am using symmetric key cryptography). i am using SJCL for this and have tried this code decodedData = sjcl.decrypt(key,encryptedData); but it is giving the error "json decode: this isn't json! " if you can suggest any other library(along with the code will be better). any help will be greatly appreciated. EDIT- yes i was using the SHA-256 as key for AES-256, but going further i will not use SHA-256 so now i need the answer only for how to decrypt the data which has been Encrypted with AES-256 . EDIT- i tried it with pidcrypt since the data which i was trying to decrypt was encrypted using cbc mode that sjcl doesn't have but picrypt, i tried the following code var data = "[binary]"; var key = "fdgfg787kim9om89"; var aes = new pidCrypt.AES.CBC(); var decryptedData = aes.decryptText(crypted, key); but it is returning null(no error), any guess what is wrong with this?
has comment: http://stackoverflow.com/comment/36973735
type: UnansweredQuestion
tagged with: cryptojs
answer count: 0
tagged with: java
upvote count: 1
has title: decryption at client side with javascript?
tagged with: sjcl
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36973839
has comment: http://stackoverflow.com/comment/36973195
tagged with: javascript

http://stackoverflow.com/comment/36931556
comment on: http://stackoverflow.com/q/23970199
has text: @Richa noted it down now?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37122625
has text: As a clarification, what does `a.getData` return? And what is `B`? And what is `someFuture`?
type: Comment
comment on: http://stackoverflow.com/q/24049608
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37017512
type: Comment
type: QuestionComment
has text: This sounds like the [Knapsack Problem](http://en.wikipedia.org/wiki/Knapsack_problem)
score: 0
comment on: http://stackoverflow.com/q/24016468

http://stackoverflow.com/a/24089318
type: Answer
score: 0
has body: I don't am sure if is that you pretend... char vowels[] = {'a', 'b', 'c', 'd', 'e'}; for (int i = 0; i &lt; vowels.length; i++) { if (vowels[i] == 'e') { System.out.println("We find the e!!!!!"); } }
answers question: http://stackoverflow.com/q/24088961

http://stackoverflow.com/comment/36960051
has text: You can't leave an abstract method unimplemented in any concrete class. The best you could do would be to implement a default method (say, a no-op) in the base class. Does client code need to know about the `foo()` method?
score: 0
comment on: http://stackoverflow.com/q/23985694
type: Comment
type: QuestionComment

geotools
type: Tag
tags question: http://stackoverflow.com/q/24052527
tag name: geotools

http://stackoverflow.com/a/24012319
has body: One of the String.substring() overloads takes one parameter - the index of the starting index. From that, you can easily implement your function : String lastFew(String s, int number) { if (number &gt; s.length()) { throw new IllegalArgumentException("The string is too short!"); } else return s.substring(s.length()-number); }
answers question: http://stackoverflow.com/q/24012149
score: 0
type: Answer

http://stackoverflow.com/q/24064630
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/37107436
has body: I'm trying to get the result of a match with two lines and more, this is my text in a file (for JOURNAL ENTRIES for Wincor ATM): DEMANDE SOLDE N° CARTE : 1500000001180006 OPERATION NO. : 585068 ======================================== RETRAIT N° CARTE 1600001002200006 OPERATION NO. : 585302 MONTANT : MAD 200.00 ======================================== ... etc. Theare more lines repeated for each operation : retrait(ATMs), demande de solde (balance inquiry), which I want to get a resul like: RETRAIT\nN° CARTE 1600001002200006 My java code: String filename="20140604.jrn"; File file=new File(filename); String regexe = ".*RETRAIT^\r\n.*CARTE.*\\d{16}"; // Work with .*CARTE.*\\d{16}: result: N° CARTE : 1500000001180006 N° CARTE 1600001002200006 Pattern pattern = Pattern.compile(regexe,Pattern.MULTILINE); try { BufferedReader in = new BufferedReader(new FileReader(file)); while (in.ready()) { String s = in.readLine(); Matcher matcher = pattern.matcher(s); while (matcher.find()) { // find the next match System.out.println("found the pattern \"" + matcher.group()); } } in.close(); } catch(IOException e) { System.out.println("File 20140604.jrn not found"); } Any Solution Please ?
has title: Java Regular Expression Multiline
tagged with: java
has answer: http://stackoverflow.com/a/24064960

http://stackoverflow.com/comment/37091779
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24055619
has text: Does the question state that u shouldn't use 2 loops or does it say u shudn't use 2 nested loops ?

http://stackoverflow.com/comment/36996627
type: QuestionComment
comment on: http://stackoverflow.com/q/24005027
score: 0
has text: if the method has a return type of void that's another way of telling the compiler "this method returns nothing"... the type in the function declaration must match the type returned from the function (or a superclass of the returned type but that's another story).
type: Comment

http://stackoverflow.com/q/23979406
answer count: 1
has title: run excel using com interface
has body: am trying to run excel using jacob , but it keeps throwing an exception , been searching for awhile for a cause of such exception , but no good package com.se.jaexcel; import com.jacob.activeX.ActiveXComponent; import com.jacob.com.Dispatch; import com.jacob.com.Variant; public class JExcel { /** * @param args */ public static void main(String[] args) { ActiveXComponent xl = new ActiveXComponent("Excel.Application"); } } the exception is Exception in thread "main" com.jacob.com.ComFailException: Can't QI object for IDispatch at com.jacob.com.Dispatch.createInstanceNative(Native Method) at com.jacob.com.Dispatch.&lt;init&gt;(Dispatch.java:99) at com.jacob.activeX.ActiveXComponent.&lt;init&gt;(ActiveXComponent.java:58) at com.se.jaexcel.JExcel.main(JExcel.java:14)
type: UnansweredQuestion
tagged with: jacob
tagged with: excel
has answer: http://stackoverflow.com/a/24196911
tagged with: java
type: Question
score: 0
tagged with: com

http://stackoverflow.com/q/24085019
has comment: http://stackoverflow.com/comment/37144986
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/37160281
type: Question
tagged with: gridbaglayout
tagged with: layout-manager
has body: I would like to create resizeable frame using gridbaglayout (consist of 6 JPanels) + using right to left orientation. Its working well until 4th JPanel after adding 5th and 6th JPanel expected alignment is not coming. Please guide me to get expected alignment. expected output import java.awt.*; import javax.swing.*; public class FrameGUI { public static void addComponentsToPane(Container pane){ pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); JPanel blackPanel,bluePanel,greenPanel,orangePanel,pinkPanel,redPanel; pane.setLayout(new GridBagLayout()); GridBagConstraints c=new GridBagConstraints(); c.fill=GridBagConstraints.BOTH; pane.setPreferredSize(new Dimension(600,660)); //################################################## BLACK JPanel blackPanel=new JPanel(new GridBagLayout()); c.weightx=0.8; c.weighty=0.3; c.fill=GridBagConstraints.BOTH; c.gridwidth=2; c.gridheight=1; c.gridx=0; c.gridy=0; blackPanel.setBackground(Color.black); pane.add(blackPanel, c); //################################################## BLUE JPanel bluePanel=new JPanel(new GridBagLayout()); c.fill=GridBagConstraints.BOTH; c.weightx=0.8; c.weighty=0.1; c.gridheight=1; c.gridwidth=2; c.gridx=0; c.gridy=1; bluePanel.setBackground(Color.blue); pane.add(bluePanel, c); //################################################## GREEN JPanel greenPanel=new JPanel(new GridBagLayout()); c.fill=GridBagConstraints.BOTH; c.weightx=0.2; c.weighty=0.4; c.gridwidth=1; c.gridheight=2; c.gridx=2; c.gridy=0; greenPanel.setBackground(Color.green); pane.add(greenPanel, c); //################################################## ORANGE JPanel orangePanel=new JPanel(new GridBagLayout()); c.fill=GridBagConstraints.BOTH; c.weightx=1.0; c.weighty=0.2; c.gridheight=1; c.gridwidth=3; c.gridx=0; c.gridy=2; orangePanel.setBackground(Color.orange); pane.add(orangePanel, c); //################################################## PINK JPanel pinkPanel=new JPanel(new GridBagLayout()); c.fill=GridBagConstraints.BOTH; c.weig…
score: 0
has comment: http://stackoverflow.com/comment/37145642
has title: GridBagLayout is not aligns as expected with JPanel in java swing
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37145596
tagged with: swing
has comment: http://stackoverflow.com/comment/38068897

http://stackoverflow.com/comment/37006941
type: QuestionComment
has text: Think about query pagination (Query's setFirstResult, setMaxResults) if it fits to your requirements. Providing pagination mechanism (+ajax is even better) to huge table is always plus.
comment on: http://stackoverflow.com/q/23986871
score: 0
type: Comment

http://stackoverflow.com/comment/37054176
comment on: http://stackoverflow.com/a/24030876
has text: This resolved the issue! While I did delete `gwt-unitCache` originally, I didn't try deleting it after explicitly setting the source level targets in the Ant tasks as suggested by Thomas Broyer.
score: 0
type: AnswerComment
type: Comment

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/24036740
tags question: http://stackoverflow.com/q/24008912
type: Tag

http://stackoverflow.com/q/23992299
has comment: http://stackoverflow.com/comment/36972068
tagged with: saas
score: -1
has body: I am stuck in a situation where there are many Action classes all of them extend from a parent class TPDispatchAction. Now I have to basically set a session spring bean everytime any action method is called wherein i set the tenant id of the user. The crude way will be to add the line of code setting the value in all the action methods of all action classes. Is there any better way to do this? Edit Solved the problem using MethodBeforeAdvice AOP
has answer: http://stackoverflow.com/a/23992542
has answer: http://stackoverflow.com/a/24011733
tagged with: spring
downvote count: 1
has comment: http://stackoverflow.com/comment/36971903
tagged with: java
accepted answer: http://stackoverflow.com/a/24011733
possible better answer: http://stackoverflow.com/a/23992429
answer count: 4
has title: Calling a method in parent class every time a method in child class is used
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23992429
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/36971854
has answer: http://stackoverflow.com/a/23992397
type: Question

pidcrypt
type: Tag
tag name: pidcrypt
tags question: http://stackoverflow.com/q/23958969
tags question: http://stackoverflow.com/q/23992957

http://stackoverflow.com/comment/36937790
type: AnswerComment
score: 0
type: Comment
has text: Thank you so much for the prompt response. It really helped. :-)
comment on: http://stackoverflow.com/a/23968362

http://stackoverflow.com/comment/48130609
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24066679
has text: upvote just because I hate haters
score: 0

http://stackoverflow.com/q/24077616
has title: enterprise architect scripting: missed method in java api eaapi.jar
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37131266
favorite count: 0
has comment: http://stackoverflow.com/comment/37131907
has comment: http://stackoverflow.com/comment/37131223
tagged with: enterprise-architect
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24117936
accepted answer: http://stackoverflow.com/a/24117936
has body: In the Reference of the Enterprise Architect Object Model I found the class Element: http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/element2.html The class Element contains the attribute IsComposite. I use the Java API (eaapi.jar) of Sparx Systems and can't find the Setter for this attribute (myElement.SetIsComposite(true) isn't possible). Does anybody know a solution for this problem? For example an updated lib of eaapi.jar or a workaround? Regards, Phil
type: Question

http://stackoverflow.com/comment/36888536
has text: Sample data of what the data is currently is, and the desired output. Also, what sql server are you running on?
comment on: http://stackoverflow.com/q/23947155
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24024232
type: Answer
score: 3
upvote count: 3
has body: This method is the dynamic equivalent of the Java language instanceof operator. I take that to mean that isInstance() is primarily intended for use in code dealing with type reflection at runtime. In particular, I would say that it exists to handle cases where you might not know in advance the type(s) of class(es) that you want to check for membership of in advance (rare though those cases probably are). For instance, you can use it to write a method that checks to see if two arbitrarily typed objects are assignment-compatible, like: public boolean areObjectsAssignable(Object left, Object right) { return left.getClass().isInstance(right); } In general, I'd say that using instanceof should be preferred whenever you know the kind of class you want to check against in advance. In those very rare cases where you do not, use isInstance() instead. Hope this helps!
downvote count: 0
answers question: http://stackoverflow.com/q/24024182

http://stackoverflow.com/a/24097734
answers question: http://stackoverflow.com/q/24097409
type: Answer
downvote count: 0
score: 1
has body: Try following code: DisplayMetrics displaymetrics = new DisplayMetrics(); int mPageHeight = displaymetrics.heightPixels; LinearLayout.LayoutParams lp = new LineaLayout.LayoutParams(width, mPageHeight/2); yourview.setLayoutParams(lp);
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24097409

http://stackoverflow.com/q/24001521
downvote count: 0
answer count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/37037603
has comment: http://stackoverflow.com/comment/37000621
tagged with: jna
type: Question
favorite count: 0
has comment: http://stackoverflow.com/comment/37218152
upvote count: 2
has title: Different behavior in C and java through JNA
has comment: http://stackoverflow.com/comment/37115550
has comment: http://stackoverflow.com/comment/37020228
tagged with: java
has body: I'm attempting to access a scanner from java using JNA (or BridJ, the result is the same). When making calls to the dll from C, the scanner responds correctly to the open (open communication with the scanner), scan and close (close session with the scanner) commands. When I attempt the same code in Java, the call to open() responds with a -3 status code, meaning that the scanner could not be found. This is the same result you get if you turn off or disconnect the scanner when calling from C. The simplest code for the error is just calling open, and checking whether it was successful. The declaration for the open method in the C header is as follows: extern int APIENTRY LS100_Open(HWND hWnd, HANDLE Hinst, char Type_com); My java interface for the dll is: public interface LS100 extends StdCallLibrary { public LS100 instance = (LS100)Native.loadLibrary("Ls100", LS100.class); public final static byte SUSPENSIVE_MODE = 'S'; public final static byte NOT_SUSPENSIVE_MODE = 'T'; public int LS100_Open(HWND hWnd, HANDLE Hinst, byte Type_com); } My main method for now simply calls LS100.LS100_Open(null, null, LS100.SUSPENSIVE_MODE). Null handles work fine in C (using NULL). Any help would be appreciated.
score: 2

http://stackoverflow.com/comment/37118102
type: Comment
comment on: http://stackoverflow.com/a/24069788
has text: No probs, glad I could help
type: AnswerComment
score: 0

http://stackoverflow.com/q/24051415
score: 0
has body: I'm trying to set an imageview's resource like so: Code: ImageView imageView = new ImageView(getApplicationContext()); imageView.setImageResource(R.drawable.bg); Yet I see nothing on my screen. I can set imageView = (ImageView) findViewById(R.id.bgView); And it works, but in my instance I can't use this because I need apply the imageview to an arraylist of imageviews. Is there any other way to construct my imageview or am I doing something wrong? Edit: My xml looks like: <ImageView android:id="@+id/bgView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/Descript" android:scaleType="fitXY" android:src="@+drawable/testpicks" />
has comment: http://stackoverflow.com/comment/37083056
tagged with: android
possible better answer: http://stackoverflow.com/a/24051465
has answer: http://stackoverflow.com/a/24051465
has comment: http://stackoverflow.com/comment/37082903
accepted answer: http://stackoverflow.com/a/24051562
has title: Java - Runnable
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37083072
type: Question
answer count: 2
tagged with: imageview
tagged with: arrays
has answer: http://stackoverflow.com/a/24051562

http://stackoverflow.com/comment/36891488
comment on: http://stackoverflow.com/q/23948858
has text: @MadProgrammer- I am using nested layouts.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23996859
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/39378295
answer count: 2
has title: How to import/export Matrix from file while using UJMP library?
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/28982385
tagged with: ujmp
tagged with: import
type: UnansweredQuestion
tagged with: export
has body: I'm trying to work on the UJMP library. I created a matrix and I'd like to export it in a txt file and then to import it again as a basic Matrix. I tried the following code but it doesn't work: Matrix m = MatrixFactory.dense(ValueType.INT, new long[]{(long)100,(long)100}); for(int i = 0; i&lt; 100; i++){ for(int j = 0; j&lt; 100;j++){ m.setAsInt((int) (Math.random() *3),new long[]{i,j}); } } try { m.exportToFile(FileFormat.TXT,"test.txt",null); //this works. My file contains the matrix } catch (MatrixException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Matrix n = null; try { n =ImportMatrix.fromFile(FileFormat.TXT,new File("test.txt"),null); //this doesn't work. The matrix has a size of 1*1 and contains the content of the previous matrix as a single string. } catch (MatrixException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(n.getSize()[0]+" "+n.getSize()[1]); // I get 1 1; So what should I do to get my original matrix as a 100*100 matrix ? Thank you in advance for your response, and sorry for my english.
tagged with: matrix
downvote count: 0
score: 1

http://stackoverflow.com/comment/36900979
type: QuestionComment
comment on: http://stackoverflow.com/q/23954334
has text: @Rahul In MySQL triggers can't manipulate the table they are assigned to.
score: 0
type: Comment

http://stackoverflow.com/a/23990320
has body: Is there a way to a deprecation of a method in an interface which will prevent implementation of the method (but also possible to override for old apps) for future applications ? No. But you can simply remove it. Then new classes based on the updated interface won't need to implement it, but old classes based on the older version of the interface won't complain (they'll just have methods that are never used, but that's not a problem in and of itself). The bigger problem, however, is that if you've changed the interface so much there are methods in it you don't use anymore, is it really likely that older classes implementing the interface will work correctly with your updated code? It doesn't seem likely.
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/23990261
upvote count: 3

http://stackoverflow.com/comment/36981646
has text: Good thinking, although in that case it would be wise to wonder if that method even belongs in the base class. You'd end up passing `null` and then if you try to use one of these parameters later on, boom: `NullPointerException`.
comment on: http://stackoverflow.com/a/23997164
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24099103
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/37174401
tagged with: sprite
type: Question
has answer: http://stackoverflow.com/a/24101704
has comment: http://stackoverflow.com/comment/37171611
tagged with: libgdx
tagged with: java
has title: libgdx changing sprite color while hurt
tagged with: game-engine
answer count: 1
downvote count: 0
has body: I am using libgdx to make a little platformer and I would like to make the enemies blink in red while the player hurt them with his weapon. I already tried to change the sprite color and the sprite batch color with no success, it only melt the new color with the one of the texture. sprite.setColor(Color.RED); spriteBatch.draw(sprite); the effect I want to achieve is: going from sprite texture to full red and then back again. I think there is something to do with the Blending function, but I am not sure about that. I want to avoid making some red sprite for each monsters of my game. Does someone know how to achieve this effect?
accepted answer: http://stackoverflow.com/a/24101704
has comment: http://stackoverflow.com/comment/37171755
favorite count: 0
tagged with: colors

http://stackoverflow.com/comment/44993045
has text: My solution above is dynamic, because it uses the vertex colors of each sprite to color each sprite differently if you like. SpriteBatch in libgdx assigns its current color to every sprite that's submitted to it for drawing, and you can change the color multiple times before the batch is flushed to the GPU. The solution you're suggesting is also dynamic, but it has the drawback that the batch must be flushed every time you change the color (more draw calls).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24101704
score: 0

count
tags question: http://stackoverflow.com/q/24030118
tag name: count
type: Tag

http://stackoverflow.com/q/23997059
score: 0
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23997140
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36981420
accepted answer: http://stackoverflow.com/a/23997164
has comment: http://stackoverflow.com/comment/36981482
possible better answer: http://stackoverflow.com/a/23997140
has comment: http://stackoverflow.com/comment/36981438
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36981643
favorite count: 0
has comment: http://stackoverflow.com/comment/36981578
type: Question
has answer: http://stackoverflow.com/a/23997164
has comment: http://stackoverflow.com/comment/36981527
has body: I'm a beginner in java (I have just study c++) and I have to read and understand a java code. Ok so I've got a function public void analysis(IStochObserver obs, IVector obsValues, IVector predictions, IStochModelInstance mainModel, ITime analysisTime) { .....................] But in the implementaion (which is pretty long that's why I did not write it here), obsValues and prediction never appears! Is there any reason ? It's a professional code so I don't think it's a mistake or something like this...
has comment: http://stackoverflow.com/comment/36981569
has comment: http://stackoverflow.com/comment/36981618
has title: Method parameters not used in its implementation
has comment: http://stackoverflow.com/comment/36981423
has comment: http://stackoverflow.com/comment/36981452

http://stackoverflow.com/q/24078414
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/24252090
has comment: http://stackoverflow.com/comment/37137569
favorite count: 0
type: Question
score: 5
tagged with: flatmap
has comment: http://stackoverflow.com/comment/37133043
tagged with: java-stream
has body: I tried the following code using Java 8 streams: Arrays.asList("A", "B").stream() .flatMap(s -&gt; Arrays.asList("X", "Y").stream().map(s1 -&gt; s + s1)).collect(Collectors.toList()); What I get is a List&lt;Object&gt; while I would expect a List&lt;String&gt;. If I remove the collect and I try: Arrays.asList("A", "B").stream().flatMap(s -&gt; Arrays.asList("X", "Y").stream().map(s1 -&gt; s + s1)); I correctly get a Stream&lt;String&gt;. Where am I wrong? Can someone help me? Many thanks in advance. Edit: The problem is due to Eclipse (now using Kepler SR2 with java 8 patch 1.0.0.v20140317-1956). The problem does non appear if compiling using javac or, as commented by Holger, using Netbeans
answer count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/37133598
has answer: http://stackoverflow.com/a/24252090
has title: Java Stream collect after flatMap returns List<Object> instead of List<String>
has comment: http://stackoverflow.com/comment/37132881
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/37136625
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37132807

http://stackoverflow.com/comment/36955802
comment on: http://stackoverflow.com/q/23983415
type: Comment
type: QuestionComment
score: 0
has text: @AntonH If I did that, wouldn't I be required to add all the other methods related to a collection? Not required, but I might as well if I was going to use them.

http://stackoverflow.com/q/23946542
has title: how to get unicode text from jtextpane java
has body: I have set the jtextpane content type as html and setted the ta_description = new JTextPane(); ta_description.setContentType("text/html"); ta_description.setFont(new Font("Latha", Font.PLAIN, 12)); ta_description.setText("&lt;![CDATA[&lt;br&gt;வேலூர் மாவட்டம், அணைக்கட்டு தொகுதி பா.ம.க.வை சேர்ந்த கலையரசு எம்.எல்.ஏ. நேற்று முன்தினம் காலை முதல்-அமைச்சர் ஜெயலலிதாவை சந்தித்து தனது தொகுதி பிரச்சினைகள் குறித்து பேசினார். அதைத்தொடர்ந்து அவரை கட்சியில் இருந்து நீக்குவதாக பா.ம.க. தலைவர் ஜி.கே.மணி அறிவித்தார்.&lt;br&gt;]]&gt;); When i get this text using ta_description.gettext() and it will be like as below &lt;![CDATA[&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;br&gt; &amp;#2997;&amp;#3015;&amp;#2994;&amp;#3010;&amp;#2992;&amp;#3021; &amp;#2990;&amp;#3006;&amp;#2997;&amp;#2975;&amp;#3021;&amp;#2975;&amp;#2990;&amp;#3021;, &amp;#2949;&amp;#2979;&amp;#3016;&amp;#2965;&amp;#3021;&amp;#2965;&amp;#2975;&amp;#3021;&amp;#2975;&amp;#3009; &amp;#2980;&amp;#3018;&amp;#2965;&amp;#3009;&amp;#2980;&amp;#3007; &amp;#2986;&amp;#3006;.&amp;#2990;.&amp;#2965;.&amp;#2997;&amp;#3016; &amp;#2970;&amp;#3015;&amp;#2992;&amp;#3021;&amp;#2984;&amp;#3021;&amp;#2980; &amp;#2965;&amp;#2994;&amp;#3016;&amp;#2991;&amp;#2992;&amp;#2970;&amp;#3009; &amp;#2958;&amp;#2990;&amp;#3021;.&amp;#2958;&amp;#2994;&amp;#3021;.&amp;#2959;. &amp;#2984;&amp;#3015;&amp;#2993;&amp;#3021;&amp;#2993;&amp;#3009; &amp;#2990;&amp;#3009;&amp;#2985;&amp;#3021;&amp;#2980;&amp;#3007;&amp;#2985;&amp;#2990;&amp;#3021; &amp;#2965;&amp;#3006;&amp;#2994;&amp;#3016; &amp;#2990;&amp;#3009;&amp;#2980;&amp;#2994;&amp;#3021;-&amp;#2949;&amp;#2990;&amp;#3016;&amp;#2970;&amp;#3021;&amp;#2970;&amp;#2992;&amp;#3021; &amp;#2972;&amp;#3014;&amp;#2991;&amp;#2994;&amp;#2994;&amp;#3007;&amp;#2980;&amp;#3006;&amp;#2997;&amp;#3016; &amp;#2970;&amp;#2984;&amp;#3021;&amp;#2980;&amp;#3007;&amp;#2980;&amp;#3021;&amp;#2980;&amp;#3009; &amp;#2980;&amp;#2985;&amp;#2980;&amp;#3009; &amp;#2980;&amp;#3018;&amp;#2965;&amp;#3009;&amp;#2980;&amp;#3007…
tagged with: swing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23949932
answer count: 1
tagged with: unicode
score: 0
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
tagged with: jtextpane

http://stackoverflow.com/a/24012798
score: 0
type: Answer
has body: This one should work //*[name()='n2:code']/text()
answers question: http://stackoverflow.com/q/23996269
has comment: http://stackoverflow.com/comment/37011178

http://stackoverflow.com/q/23985626
has title: BufferedImage/Image Conversion
upvote count: 2
has comment: http://stackoverflow.com/comment/36960260
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23985630
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36960039
downvote count: 1
type: Question
has body: When loading an image using ImageIO, you are returned a BufferedImage. I used this BufferedImage in the function java.awt.image.BufferedImage.getSubimage(int,int,int,int). Now... I need to print some of these BufferedImage's, but the java.awt.Graphics.drawImage(Image,int,int,null) function takes in an Image, not a BufferedImage. How to convert a BufferedImage to an Image? Code: import javax.swing.JPanel; import javax.swing.BorderFactory; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.SwingUtilities; import javax.swing.JFrame; import java.awt.Image; import java.io.*; import java.net.URL; import javax.imageio.*; import java.awt.image.*; import java.awt.Font; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.image.BufferedImage; public class engine{ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { GUI(); } }); } private static void GUI(){ JFrame f = new JFrame("Daealia"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setPreferredSize(new Dimension(800, 600)); f.add(new p()); f.pack(); f.setVisible(true); } } class p extends JPanel{ public p(){} public engine eng = new engine(); public BufferedImage[][] spells; public BufferedImage image; public void paintComponent(Graphics g){ g.setColor(new Color(82,41,0)); g.fillRect(0,0,74,254); g.setColor(new Color(16,8,0)); g.drawRect(0,0,74,254); try{ image = ImageIO.read(new File("spells.png"));} catch(IOException e){System.out.println("EXCEPTION THROWN!"); } for(int k = 0; k &lt;= 6; k++){ spells[k][1] = image.getSubimage((34*2*k)-34*2,0,34,34); } for(int j = 0; j &lt;= 6; j++){ spells[j][2] = image.getSubimage((34*2*j)-34,0,34,34); } for(int a = 0; a &lt;= 6; a++){ for(int b = 0; b &lt;= 1; b++){ g.drawImage(spells[a][b],1+((b-1)*34),1+((a-1)*34),null); } } } } Edit: The error I get is: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at p.paintComponent(engine.java:…
tagged with: image
answer count: 1
has answer: http://stackoverflow.com/a/23985630
favorite count: 0

http://stackoverflow.com/comment/36880671
type: Comment
has text: What have you already researched?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23943152

http://stackoverflow.com/comment/37056472
type: QuestionComment
comment on: http://stackoverflow.com/q/24015265
score: 0
has text: I think, so was the hint to what was wrong with my idea. I wanted something like wrapping the call and if this isn't done in the error-handler, than an http- or soap or whatever-error is returned. Thx, I think it was too late...
type: Comment

http://stackoverflow.com/a/23961855
type: Answer
has body: Just swap the order in which you add the buttons. gl.addView(btn3); gl.addView(btn2); gl.addView(btn);
answers question: http://stackoverflow.com/q/23961640
score: 0

http://stackoverflow.com/comment/36975554
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23994118
has text: Try with getBaseContext().getAssets().open("employeertest.sql")...you need the file extension.

http://stackoverflow.com/comment/36962137
type: Comment
comment on: http://stackoverflow.com/a/23983267
has text: Hmmm... java.lang.NoClassDefFoundError will be thrown when the JVM is not able to find a particular class at runtime that was available during compile time. You may want to look for differences in your build time and run time class paths. If you search the error that you received you will find some more info on this site. [here](http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java/5756989#5756989) is a question dealing with this error. And [here](http://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html) is the java documentation about it.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37182384
score: 0
has text: @OliCharlesworth changed it. ButtonInput and TextInput gives the same error, there's no difference as related to the question.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24104182

http://stackoverflow.com/comment/36933846
type: QuestionComment
comment on: http://stackoverflow.com/q/23945464
score: 0
has text: Actually analogy is pretty good :). Let's say I have try/catch expected exceptions in the Worker and either retry or notify Fetcher and Fetcher resend request, that's seems like workable approach. But what to do if 'hammer breaks' - say exception I didn't expect and didn't captured in Worker - how would Fetcher knows to resend that piece of work? Should Fetcher then send himself a 'timeout' message and upon handling it verify that some responses are missing and resend these? Seems like too much logic for this, perhaps I'm wrong.
type: Comment

http://stackoverflow.com/comment/36945205
has text: Post your constructor for `kisi` class.
comment on: http://stackoverflow.com/a/23977837
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24001583
has body: Answers: There is nothing like "the download link", but. org.apache.commons can be downloaded at commons.apache.org. To reverse the package-name is a good point for starting. Anywhere you want. What you will need is to specify the class-path. Most people create a lib-folder and put all used libraries in there. java MyClass -cp lib/*.jar But it would be better (if you have more or bigger projects), if you use build tools like gradle or maven. Booth will let you specifiy some kind of library id and download all needed libs with their dependencies. update I would start with an IDE. I know, there are a lot of people (coming from other languages, than Java) who don't like them, but it will help to start. You should use an IDE or a command-line build tool (like mentioned above)
score: 0
answers question: http://stackoverflow.com/q/24001473
type: Answer

http://stackoverflow.com/q/24080387
type: Question
has body: I am trying to store a set of numbers into an array with a for loop condition followed by if condition, and this method should return the array with stored elements respecting the conditional statement. I have been stuck in this problem for a while, but nothing is coming to my mind. public int [] method ( int a) { int [] newarray=new int[count]; for (int i=1; i&lt;=a; i++) { If (a%i==0) { for (int m=0; m&lt;count;m++) { newarray[m]=a/i; break; } } } return newarray; }
score: -1
accepted answer: http://stackoverflow.com/a/24080968
has comment: http://stackoverflow.com/comment/37136803
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/37135903
tagged with: arrays
has comment: http://stackoverflow.com/comment/37139294
favorite count: 0
has title: Trying to return an array with stored elements (java)
has comment: http://stackoverflow.com/comment/37135858
has answer: http://stackoverflow.com/a/24081015
has answer: http://stackoverflow.com/a/24080968
tagged with: storage
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37135842
tagged with: java
has comment: http://stackoverflow.com/comment/37135883
possible better answer: http://stackoverflow.com/a/24081015
has comment: http://stackoverflow.com/comment/37135817
has comment: http://stackoverflow.com/comment/37135955
downvote count: 1

http://stackoverflow.com/comment/80394766
comment on: http://stackoverflow.com/a/23973978
type: Comment
score: 1
has text: How do we add -verbose in eclipse ? Where do we add it ?
type: AnswerComment

http://stackoverflow.com/comment/36888475
comment on: http://stackoverflow.com/q/23947299
score: 0
type: Comment
type: QuestionComment
has text: A previous post should help you http://stackoverflow.com/questions/1927308/choosing-java-tools-ide-and-compiler-for-beginners

http://stackoverflow.com/comment/40050440
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24095424
has text: Similar to http://stackoverflow.com/a/19603055/1925961
score: 0

http://stackoverflow.com/q/24000242
has answer: http://stackoverflow.com/a/24001118
downvote count: 0
answer count: 1
favorite count: 0
tagged with: javafx-2
has body: I've put together a simple publish/subscribe pattern to allow multiple JavaFX classes to be dynamically instantiated and run. Each of these classes (a 'subscriber') is meant to visualize data coming from a model (in the model/view/controller sense) which has the role of 'publisher'. Data for visualization comes in the form of immutable objects, and is passed from the model (running in it's own thread) to a 'buffer' (also running in a separate thread) via a LinkedBlockingQueue. The Buffer then re-publishes all of the data from the model by putting it into LinkedBlockingQueues that are being emptied by threads responsible for running JavaFX visualizations. So, the data path looks like this: Model produces immutable objects ----(LinkedBlockingQueue)---> Buffer consumes objects and puts them on multiple queues ====(LinkedBlockingQueue) ===> Visualization thread consumes objects, does some pre-processing, and makes data available to a Timeline animation, which periodically updates the chart. The entry point for the program extends Application, and its start() method builds all the JavaFX GUI components like so: for (ModelVisualization viz : vizList) { viz.buildGUI(); new Thread(viz).start(); } The threads you see being started are the final consumers of the data in the description of the data-path above. The problem: The visualizations show up and build properly, but nothing in any JavaFX window updates until the model thread goes to sleep. I can use System.err.println() statements to verify that the data from the model is moving through the various threads without deadlock, and I can see that the visualization threads are consuming everything properly. However, unless the model thread hits a Thread.sleep(100) or similar, the method associated with the Timeline never runs. The model thread itself is started in the entry point constructor like so: Thread simThread = new Thread(new Runnable() { @Override public void run() { model.runSim(); } }); simThread.setPriority(Threa…
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has title: JavaFX only updates when another thread is sleeping
score: 1
tagged with: java
tagged with: javafx
linked to: http://stackoverflow.com/q/13784333
type: Question

http://stackoverflow.com/comment/37147332
has text: `@ResponseBody` doesn't send a redirect by default; something else is probably happening here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24086207
score: 3

http://stackoverflow.com/comment/37128162
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24076075
type: Comment
has text: You can answer the first bit by just trying it.

android-sharedpreferences
tags question: http://stackoverflow.com/q/23947845
tag name: android-sharedpreferences
type: Tag

http://stackoverflow.com/comment/36901875
type: Comment
comment on: http://stackoverflow.com/a/23954315
score: 0
type: AnswerComment
has text: its not working for me... A Dialog box for authenication should be display where i enter username and password and on proceed to next. As you have mention in apply it remains in app but doesnot display.

http://stackoverflow.com/q/24074736
answer count: 3
has title: java : Error while create object in collection API
has body: I have three lines of code : 1) List&lt;String&gt; list = new ArrayList&lt;String&gt;(); Which does not produce any error but when I write following line of code 2)Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); I get following Error Type mismatch: cannot convert from HashMap&lt;String,ArrayList&lt;String&gt;&gt; to Map&lt;String,List&lt;String&gt;&gt; 3)Map&lt;String,String&gt; d= new HashMap&lt;String,String&gt;(); This line does not produce any error I want to know why (2) line shows me Error. Thanks in Advance.:)
linked to: http://stackoverflow.com/q/2745265
has answer: http://stackoverflow.com/a/24074950
accepted answer: http://stackoverflow.com/a/24074872
duplicate of: http://stackoverflow.com/q/2745265
tagged with: generic-collections
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24074863
tagged with: collections
has answer: http://stackoverflow.com/a/24074863
type: Question
score: 0
has answer: http://stackoverflow.com/a/24074872

http://stackoverflow.com/a/25464621
has comment: http://stackoverflow.com/comment/58397600
score: 6
has comment: http://stackoverflow.com/comment/40996364
type: Answer
downvote count: 0
has body: I just spent quite few hours on this and found a solution which might work for you as well. IntelliJ seems to have a bug which expects the JDK to be in a different directory than is specified. I followed these steps: open intelliJ, click help -> show log in explorer modify build-log/build-log.xml and change &lt;priority value="info" /&gt; to &lt;priority value="debug" /&gt;, you may have to run the editor as an administrator run the compilation which fails with "Error:java: Fatal Error: Unable to find..." open build-log/build.log and search for rt.jar, you should find it in a block with a set of other JRE libraries and the directory which points to the file should be wrong In my case the JDK is included in D:\Development\software\jdk1.8.0_20, while the log points to C:\Users\Vladimir\Development\software\jdk1.8.0_20 I fixed the issue by copying my JRE to the place which is expected in the log. And just like in your case this seems to only happen with JDK 1.8.
answers question: http://stackoverflow.com/q/23984513
upvote count: 6

http://stackoverflow.com/comment/37008392
score: 0
type: AnswerComment
has text: checking the post request with firebug, the structure of the class is send properly but with null attributes.
type: Comment
comment on: http://stackoverflow.com/a/23961926

http://stackoverflow.com/comment/37055285
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24034352
has text: @Nizil this will be the same as `spriteBatch.setColor(1, 0, 0, 1)`, but only for `Sprites`, i have `TextureRegion`s. Thanks anyways (:
score: 0

http://stackoverflow.com/comment/37098269
type: Comment
comment on: http://stackoverflow.com/a/24058657
has text: You should make it "invisible" from servlet-context. The Spring Security should not pick up your `Controller` classes to proxy them potentially. The good choice here to have separate context and allow to servlet-context does the stuff only for WEB.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24007441
type: AnsweredQuestion
tagged with: expression
tagged with: java
has comment: http://stackoverflow.com/comment/37000887
has answer: http://stackoverflow.com/a/24007971
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24007669
accepted answer: http://stackoverflow.com/a/24007971
has comment: http://stackoverflow.com/comment/37022557
possible better answer: http://stackoverflow.com/a/24007669
score: 0
has comment: http://stackoverflow.com/comment/37000762
has comment: http://stackoverflow.com/comment/37011630
tagged with: regex
has body: I'm trying to match a string pattern like this recursively or iteratively. term :- can be any variable(string) or integer expression :- term + expression or term * expression or term / expression or term - expression The idea is to find a matching pattern for mathematical expression like this ZING^30*sin(45)+46*LENGTH-20 Let's assume that the term is ready. As usual, I'll start from a very bad one... in java. [[term\\+]*[term\\*]*[term\\\]*[term\\-]*]+term
has title: Java regex matching the mathematical expression pattern

http://stackoverflow.com/q/24003745
has comment: http://stackoverflow.com/comment/36994331
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16867674
has comment: http://stackoverflow.com/comment/36994538
linked to: http://stackoverflow.com/q/11721966
answer count: 0
tagged with: java
has body: Is there a way to define alias for a Servlet context? If I want that http://server/a/foo-servlet and http://server/b/foo-servlet point to the same Servlet (or http://server/a/foo.jsp and http://server/b/foo.jsp for that matter) calling HttpServletRequest#getContextPath() in the foo Servlet (or foo.jsp) returns /a or /b respectively my only option seems to be to deploy the web application containing the foo Servlet twice. Correct? If I define two contexts a and b both pointing to the same doc base the container would essentially still deploy two individual applications.
upvote count: 1
has comment: http://stackoverflow.com/comment/36995993
type: Question
has comment: http://stackoverflow.com/comment/37007991
has comment: http://stackoverflow.com/comment/37006946
has comment: http://stackoverflow.com/comment/36994373
tagged with: servlets
has title: Defining alias for Servlet context
has comment: http://stackoverflow.com/comment/37007926
has comment: http://stackoverflow.com/comment/37008541
downvote count: 0
has comment: http://stackoverflow.com/comment/37000847
score: 1
has comment: http://stackoverflow.com/comment/37003376
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/comment/36918424
comment on: http://stackoverflow.com/q/23962149
score: 0
has text: Ohh... I want to make it programmically.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37130264
has text: I initially tried one object of SeperateExecution, however the "race" condition is easily noticed when the single thread loop counts to 51663040 and the multithreaded loop increases the one value to only 29446765. Using the AtomicLong has no/minimal effect in my tests.
comment on: http://stackoverflow.com/a/24069705
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24102730
has comment: http://stackoverflow.com/comment/57628074
has comment: http://stackoverflow.com/comment/86622943
has comment: http://stackoverflow.com/comment/60390491
has comment: http://stackoverflow.com/comment/65752164
has comment: http://stackoverflow.com/comment/60392254
has comment: http://stackoverflow.com/comment/60383910
has comment: http://stackoverflow.com/comment/86626967
has body: C# extension methods are static and use-site, whereas Java's default methods are virtual and declaration-site. What I believe you are hoping for is the ability to "monkey-patch" a method into a class you do not control, but Java does not give you that (by design; it was considered and rejected.) Another benefit of default methods over the C# approach is that they are reflectively discoverable, and in fact from the outside, don't look any different from "regular" interface methods. One advantage of C#'s extension methods over Java's default methods is that with C#'s reified generics, extension methods are injected into types, not classes, so you can inject a sum() method into List&lt;int&gt;. Above all, the main philosophical difference between Java's default methods and C#'s extension methods is that C# lets you inject methods into types you do not control (which is surely convenient for developers), whereas Java's extension methods are a first-class part of the API in which they appear (they are declared in the interface, they are reflectively discoverable, etc.) This reflects several design principles; library developers should be able to maintain control of their APIs, and library use should be transparent -- calling method x() on type Y should mean the same thing everywhere.
answers question: http://stackoverflow.com/q/24096421
downvote count: 1
upvote count: 26
has comment: http://stackoverflow.com/comment/60392249
type: Answer
has comment: http://stackoverflow.com/comment/73400267
has comment: http://stackoverflow.com/comment/57631808
score: 25

http://stackoverflow.com/comment/36881876
type: Comment
type: QuestionComment
has text: I guess I accept the rule but don't see why it is, you already specified the type so why add complications by requiring some extraneous character at the end?
score: 0
comment on: http://stackoverflow.com/q/23943102

http://stackoverflow.com/comment/36951740
type: Comment
comment on: http://stackoverflow.com/a/23974880
type: AnswerComment
has text: With the same result, i meant the first code with the modPow.
score: 0

http://stackoverflow.com/comment/37076400
comment on: http://stackoverflow.com/q/24019532
has text: yes it looks like that problem but sequential compilation is not an option. so if question is reopened maybe i get some workarounds
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24050702
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/96926325
score: 4
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24048215
has body: You'll need some more jars on the classpath. It's not very clear, but the description for the chunker notes that LBJ (a language library) and the Illinois POS tagger are required. You can get more information on how to run it here. Then, run this command: java -classpath /path/to/LBJChunk.jar:/path/to/LBJ2Library.jar:/path/toLBJPOS.jar \ edu.illinois.cs.cogcomp.lbj.chunk.ChunksAndPOSTags snippeting.txt That should work!
accepted answer of: http://stackoverflow.com/q/24048215

http://stackoverflow.com/q/24034490
tagged with: tomcat
has answer: http://stackoverflow.com/a/24034770
accepted answer: http://stackoverflow.com/a/24034770
has comment: http://stackoverflow.com/comment/37051378
score: 0
answer count: 1
has body: I have some code on Spring/Hibernate/Jersey. I want Hibernate to generate my tables. This is my User entity @Entity public class User { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private String id; private String email; private String nickname; private String password; @OneToOne(cascade=CascadeType.ALL) private PersonalInfo personalInfo; @OneToOne(fetch=FetchType.LAZY ,cascade=CascadeType.ALL) private AccountInfo accountInfo; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public PersonalInfo getPersonalInfo() { return personalInfo; } public void setPersonalInfo(PersonalInfo personalInfo) { this.personalInfo = personalInfo; } public AccountInfo getAccountInfo() { return accountInfo; } public void setAccountInfo(AccountInfo accountInfo) { this.accountInfo = accountInfo; } public User(){ } } And this is my configuration: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config /> <tx:annotation-driven/> <context:component-scan base-package="com.weproj" /> org.hibernate.dialect.MySQL5InnoDBDialect create </beans> It generates the tables when the @GeneratedVal…
has title: Hibernate does not generate tables when @GeneratedValue is set
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/37111484
type: AnswerComment
has text: @Sixie it means that if the generic class `E` extends from another class `SE` and `SE` is the class that implements `Comparator<SE>`, then `E` won't need to implement `Comparator<E>` itself because already implements `Comparator<SE>`.
type: Comment
comment on: http://stackoverflow.com/a/24066637
score: 1

http://stackoverflow.com/a/24073944
answers question: http://stackoverflow.com/q/24073871
type: Answer
has body: What you have done is not writing something! In your code: if (source == quitButton) { try { fis = new FileInputStream("userfile.txt"); ois = new ObjectInputStream(fis); ois.readObject(); ois.close(); } catch (IOException | ClassNotFoundException ev) { ev.printStackTrace(); } System.exit(0); } Your just read something and do nothing with your fis ,right?
has comment: http://stackoverflow.com/comment/37124488
score: 0

http://stackoverflow.com/comment/36989717
has text: Possible [duplicate](http://stackoverflow.com/q/7702697/230513).
comment on: http://stackoverflow.com/q/24001240
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/57341585
type: Comment
comment on: http://stackoverflow.com/a/24025781
has text: How can we get the text of current line only. For example the line in which we have the Cursor right now.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/59657652
type: QuestionComment
comment on: http://stackoverflow.com/q/24027482
score: 0
has text: Refer [this](http://stackoverflow.com/a/36002610/1709793) Answer, you have replace character with Integer
type: Comment

http://stackoverflow.com/comment/37061325
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24039622
has text: thank you for the detailed explanation, I couldn't find that anywhere

http://stackoverflow.com/a/23976762
type: Answer
score: 1
has body: Since you are getting an array of objects back in javascript and it is stored in data. You can loop through it and display the content is some div tag. Example: Create an empty div to populate the data after a successful ajax call. &lt;div id="mytextarea"&gt;&lt;/div&gt; Then in your ajax success, instead of printing to console you would loop through the array and append the data to the innerHTML of the div tag like so... var myTextArea = document.getElementById('mytextarea'); for (var x = 0; x &lt; data.length; x++){ myTextArea.innerHTML = myTextArea.innerHTML + data[x].id + '&lt;br/&gt;'; } Edit 1: I see you know your object's attributes so I updated the code to append just id to the text area.
upvote count: 1
has comment: http://stackoverflow.com/comment/36943348
downvote count: 0
has comment: http://stackoverflow.com/comment/36962054
answers question: http://stackoverflow.com/q/23966378

http://stackoverflow.com/comment/37167124
has text: in libraries what ever jar is appearing with cross symbol check the path of jar file might be respt. jar is not present in respective path
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24095630
type: Comment

http://stackoverflow.com/comment/36975847
type: QuestionComment
has text: Are you trying to make a full description of an object such as what a debugger could do eg : { "customClass2.a" : "a", "customClass2.b" : "b"} ?
score: 0
comment on: http://stackoverflow.com/q/23993988
type: Comment

http://stackoverflow.com/q/23949338
favorite count: 0
possible better answer: http://stackoverflow.com/a/23949668
has answer: http://stackoverflow.com/a/23949668
has comment: http://stackoverflow.com/comment/36892488
tagged with: regex
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36892451
has answer: http://stackoverflow.com/a/23949683
upvote count: 2
tagged with: java
type: Question
has body: I am having trouble developing a regex pattern in Java to split a university timetable class string. An example string is like this: "CIVL4401_SEM-1:Laboratory_Lab1: 05:11:Engineering - Civil &amp; Mechanical: Soils Lab (G99): [Pref 1] (cont) CIVL4401_SEM-1:Laboratory_Lab2: 07:19:Engineering - Civil &amp; Mechanical: Soils Lab (G99): [Pref 1] (cont) " (It is all one line) Using the regex pattern: final String classregex = "(?&lt;=\\(cont\\)\\s|\\[Pref \\d{1,2}\\]\\s)"; It should split into exactly two class entries: "CIVL4401_SEM-1:Laboratory_Lab1: 05:11:Engineering - Civil &amp; Mechanical: Soils Lab (G99): [Pref 1] (cont) " "CIVL4401_SEM-1:Laboratory_Lab2: 07:19:Engineering - Civil &amp; Mechanical: Soils Lab (G99): [Pref 1] (cont) " The zero-length look behind is intended; I want to retain all data. Instead I get: "CIVL4401_SEM-1:Laboratory_Lab1: 05:11:Engineering - Civil &amp; Mechanical: Soils Lab (G99): [Pref 1] " "(cont) " "CIVL4401_SEM-1:Laboratory_Lab2: 07:19:Engineering - Civil &amp; Mechanical: Soils Lab (G99): [Pref 1] " "(cont) " Which I'm pretty sure I understand why this is happening - it matches the "[Pref d]" first, extracts that string out, then goes through the rest, finding "(cont)" immediately after and so on. Note that there are also timetable classes which have no "(cont)" in them, so that is why there is a "[Pref d]" part in the regex. Is there some way to order how the Java regex engine works? I want it to try to match the "(cont)" first before trying to match the "[Pref d]" part. My guess is there would have to be a complicated look ahead and look behind expression which I am not sure how to go about. If this can't be done then I will go about writing up a fix function to deal with this. Thank you.
tagged with: expression
accepted answer: http://stackoverflow.com/a/23949683
answer count: 2
downvote count: 0
has title: Regex fall through in Java

http://stackoverflow.com/a/24018037
answers question: http://stackoverflow.com/q/24014036
type: Answer
has body: Try adding CascadeType.REMOVE to your mappings: @ManyToMany(cascade= {CascadeType.PERSIST, CascadeType.REMOVE}, fetch=FetchType.EAGER) private List&lt;Role&gt; roles = new ArrayList&lt;Role&gt;(); @ManyToMany(cascade= {CascadeType.PERSIST, CascadeType.REMOVE}, fetch=FetchType.EAGER) private Set&lt;Permission&gt; permissions = new HashSet&lt;Permission&gt;(); In this way, children entities don't have to be removed before parent, so you could delete a Role without deleting its Permissions before.
has comment: http://stackoverflow.com/comment/37038493
has comment: http://stackoverflow.com/comment/37035740
upvote count: 4
has comment: http://stackoverflow.com/comment/37035886
downvote count: 0
has comment: http://stackoverflow.com/comment/37037042
score: 4

http://stackoverflow.com/a/24049113
has comment: http://stackoverflow.com/comment/37078999
has comment: http://stackoverflow.com/comment/37114646
answers question: http://stackoverflow.com/q/24048907
score: 0
has body: Split the String by whitespaces and and Calculate only the number of Vowels. Then Number of consonants = Length of Sentence - No. of Vowels. Detailed Code: System.out.println("Please enter the sentence to analyze: "); int v = 0; int c = 0; String string = key.nextLine(); //the sentence the user inputs String[] stringArray = string.split(" "); for(int i=0;i&lt;stringArray.length;i++) { for(int j= 0; j&lt;string.length(); j++) { char a = string.charAt(j); if(a == 'a' || a == 'A' || a == 'e' || a == 'E' || a == 'i' || a == 'I' || a == 'o' || a == 'O' || a == 'u' || a == 'U' || a == 'y' || a == 'Y') v = v + 1; } c= c+(stringArray.length)-v; } System.out.println("Vowels:"+v+" and Consonants:"+c);
type: Answer
has comment: http://stackoverflow.com/comment/37079149

http://stackoverflow.com/a/24042674
has body: We had a similar problem in our project and we found a solution which works for us - the tasks are executed regardless exceptions, worker failures, network failures etc. Although I must admit that the code eventually became a bit complicated. So our setup is the following: There is a WorkerControl actor that handles the task management and communication with the workers There is a number of Worker actors that live in a different VM (potentially on different physical machines) WorkerControl receives some data to be processed and dispatches the tasks between the workers More or less we tried to follow the guidelines described here But we also improved the failure tolerance of the design. In the WorkerControl we keep the following data structures: Map&lt;ActorPath, ActorRef&gt; registeredWorkers // registry of workers Deque&lt;TaskInfo&gt; todoList // tasks that have not been yet processed Map&lt;ActorRef, TaskInfo&gt; assignedTasks // tasks assigned to the workers Map&lt;ActorPath, ActorRef&gt; deadWorkers // registry of dead workers For each task to be executed we keep a data structure class TaskInfo { private final WorkerTask task; private int failureCount = 0; private int restartCount = 1; private Date latestResultDelivery; } We handle the following list of possible failures Worker fails the task by throwing an exception (i.e. IOException in your case) We deliver a new Failure(caughtException) message to the worker control. Upon seeing it worker control increments the failureCount and puts the task in the head of todoList queue. When a given number of failures is reached the task is considered permanently failed and is never retried. (After that the permanently failed tasks can be logged, disposed, handled in a custom way). Worker does not deliver any result in a given period of time (e.g. he fell into an infinite loop, resource contention on the worker machine, worker mysteriously disappeared, task processing taking too long) We do two things for this We initializ…
has comment: http://stackoverflow.com/comment/37089673
type: Answer
has comment: http://stackoverflow.com/comment/37070063
upvote count: 1
has comment: http://stackoverflow.com/comment/37088995
answers question: http://stackoverflow.com/q/23945464
score: 1
downvote count: 0

http://stackoverflow.com/comment/36954423
comment on: http://stackoverflow.com/q/23982044
type: QuestionComment
type: Comment
has text: I added the persistence.xml, there is no mention of the old package name. But even if the package was the same, I don't understand the problem since the original application is no longer there!
score: 0

http://stackoverflow.com/a/23946972
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23946417
answers question: http://stackoverflow.com/q/23946417
upvote count: 2
has body: The problem is not with the code nor the access specifier with the class (public is not required before the class name). The actual problem is how are you executing it. I assume that you might have used java project_euler6.java instead of java project_euler6.

http://stackoverflow.com/comment/37119270
has text: The Scanner class is commonly used for reading user input, however, I'd still suggest learning the underlying concepts.
comment on: http://stackoverflow.com/a/24070891
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36975268
type: QuestionComment
comment on: http://stackoverflow.com/q/23993988
score: 0
has text: What do you expect the 'value' of an object to be, other than its ``toString`` method?
type: Comment

http://stackoverflow.com/comment/37027034
comment on: http://stackoverflow.com/q/24021283
has text: I'm concerned that this question doesn't fit StackOverflow as it doesn't seem low-level/implementation enough - I asked over at programmers because I felt that it was a design/whiteboard question (is it better to pursue obscure Android libraries with less compatibility, or force the user to export to desktop for a more compatible implementation?) Here's my programmers question: http://programmers.stackexchange.com/questions/242872/printing-labels-from-an-android-app-or-java Gnat suggested that I post over here, so I've taken his advice given his experience with both sites.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37107021
comment on: http://stackoverflow.com/a/24063655
score: 0
type: Comment
has text: how does this take into account the amount of time taken by the method called through action property of search button without having to wait for the method to be executed completely.
type: AnswerComment

http://stackoverflow.com/comment/37051957
has text: asd=fogcomb.getSelectedIndex() + 1;
comment on: http://stackoverflow.com/q/24034926
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/23950372
downvote count: 0
tagged with: multithreading
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/23950421
tagged with: futuretask
tagged with: java
tagged with: concurrency
type: Question
has answer: http://stackoverflow.com/a/23950421
has title: Wait for at least one result from Java executor without busy waiting
answer count: 1
has body: I have a list of Future tasks futureList.add(executor.submit(new Callable(someList))); and while those are getting executed I want to get resulting items out of it. But how can I make it without looping all the time through it and checking if the futuretask is done, and then getting its result? for (int i = 0; i &lt; futureList.size(); i++) { if (futureList.get(i).isDone()) { ..... }} I thought about making some additional notify-wait structure but still I would have to know which thread finished so it doesn't help me avoid looping all the time. Any advice?
favorite count: 0
upvote count: 3
tagged with: future

http://stackoverflow.com/a/23944399
upvote count: 18
downvote count: 4
type: Answer
has body: To get the current time in milliseconds (since the epoch), use System.currentTimeMillis().
score: 14
answers question: http://stackoverflow.com/q/23944370

http://stackoverflow.com/comment/36981480
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23995773
type: Comment
has text: I'm sorry, but I fail to see how setting gridy or gridheight would solve the OPs problem or horizontal distance.

http://stackoverflow.com/comment/37163717
type: Comment
has text: I'd recommend changing to a custom `ListCellRenderer` to get the indentation effect shown in your illustration.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24094838

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/24007885
tags question: http://stackoverflow.com/q/23961974
type: Tag
tags question: http://stackoverflow.com/q/23990001

http://stackoverflow.com/q/23984756
has answer: http://stackoverflow.com/a/23984915
has answer: http://stackoverflow.com/a/38649532
answer count: 5
has comment: http://stackoverflow.com/comment/36958494
has body: I've written the simple Java script below in order to learn more about TDD, IntelliJ and Java itself. import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.matchers.JUnitMatchers.both; public class JUnit_Dummy { private StringJoiner joiner; private List&lt;String&gt; strings; @Before public void setUp() throws Exception { strings = new ArrayList&lt;String&gt;(); joiner = new StringJoiner(); } .... @Test public void shouldContainBothStringsWhenListIsTwoStrings() { strings.add("one"); strings.add("two"); assertThat(joiner.join(strings), both(containsString("A")). and(containsString("B"))); } } _____________ import java.util.List; public class StringJoiner { public String join(List&lt;String&gt; strings) { if(strings.size() &gt; 0) { return (strings.get(0); } return ""; } } I'm trying to use the "containsString" method inside an assertion, but IntelliJ keeps telling me that it "cannot resolve method 'containsString(java.lang.String)". This despite the fact that the jUnit docs (http://junit.sourceforge.net/javadoc/org/junit/matchers/JUnitMatchers.html#containsString(java.lang.String)) tell me that this method does accept a String parameter. I've tried swapping out various import statements, including the following: import static org.hamcrest.Matcher.containsString; import static org.hamcrest.Matcher.*; import static org.hamcrest.CoreMatchers.*; The best that I get is a greyed-out import statement telling me that the import statement is unused. Not sure what the problem is, any help would be appreciated. UPDATE: Here is the exact compiler error: java: cannot find symbol symbol: method containsString(java.lang.String) location: class JUnit_Dummy
has comment: http://stackoverflow.com/comment/77006722
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36958332
tagged with: java
has comment: http://stackoverflow.com/comment/36958443
upvote count: 17
type: Question
accepted answer: http://stackoverflow.com/a/23984915
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/67797899
has title: Why is my import of the containsString method not working?
possible better answer: http://stackoverflow.com/a/47307966
has answer: http://stackoverflow.com/a/47307966
has comment: http://stackoverflow.com/comment/36958545
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/55984879
score: 17
favorite count: 0

http://stackoverflow.com/comment/37004465
comment on: http://stackoverflow.com/a/24008774
type: AnswerComment
has text: Shivam Please see my edited code..It only gives me first image from the arrayLis..Please help
score: 0
type: Comment

http://stackoverflow.com/a/24093729
has body: try this String unformattedText = FileUtils.readFileToString(new File( "test.txt")); String[] splittedText = unformattedText.split("\\n\\d"); for (String split : splittedText) { System.out.println(split.replaceAll("\\n","").replaceAll("\\s", "")); } Use Apache Commons IO FileUtils for IO/File related stuffs Output :Exactly what you need
answers question: http://stackoverflow.com/q/24093549
type: Answer
score: 0

http://stackoverflow.com/comment/88155504
type: Comment
has text: yes it's very annoying when it says `fix the issues identified by lint` but doesn't actually shows those errors or path to report...
comment on: http://stackoverflow.com/a/50239165
score: 7
type: AnswerComment

scala
tags question: http://stackoverflow.com/q/24026400
tags question: http://stackoverflow.com/q/24037395
tags question: http://stackoverflow.com/q/24072268
tags question: http://stackoverflow.com/q/24035525
tags question: http://stackoverflow.com/q/24038173
tags question: http://stackoverflow.com/q/24074608
tags question: http://stackoverflow.com/q/24065515
tags question: http://stackoverflow.com/q/24005380
tags question: http://stackoverflow.com/q/24034932
tags question: http://stackoverflow.com/q/24004461
tags question: http://stackoverflow.com/q/24078847
tags question: http://stackoverflow.com/q/24019532
tags question: http://stackoverflow.com/q/24079237
tag name: scala
tags question: http://stackoverflow.com/q/24010140
tags question: http://stackoverflow.com/q/24035005
tags question: http://stackoverflow.com/q/23965737
tags question: http://stackoverflow.com/q/23970310
tags question: http://stackoverflow.com/q/23976309
tags question: http://stackoverflow.com/q/24081304
tags question: http://stackoverflow.com/q/23957174
type: Tag
tags question: http://stackoverflow.com/q/23992691
tags question: http://stackoverflow.com/q/24096348
tags question: http://stackoverflow.com/q/24083495

http://stackoverflow.com/a/24097179
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24097083
type: Answer
answers question: http://stackoverflow.com/q/24097083
has body: val is only a reference to the object itself, the object is stored in the heap and the pointer is stored in the stack. the actual value of val in the stack is an address of the object in the hep. the new reserved word in java, says that a reference will be returned, in the first case you just dont save it so the object is as usual created in the stack but probably will get collected in a short while. in the second case, while val is still in the stack and pointing to that object, it will stay in the heap
score: 2
downvote count: 0

http://stackoverflow.com/comment/37042018
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24029418
has text: I didn't ... Someone else did... sorry.
score: 0

http://stackoverflow.com/a/23944448
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23943990
answers question: http://stackoverflow.com/q/23943990
downvote count: 0
type: Answer
score: 4
has body: PermGen is basically heap that should hold the system object, The Heap for the application object is the regular heap space.. The general issue is that every class hold reference to the Class definition and every class loader that created him, And every classloader hold a reference to all the classes he is created. So when the garbage collector moving on all the objects, because they have always reference they keep growing.. and the GC not release them. In the example they use : ${JAVA_HOME}/bin/jvisualvm Which is tool that can help you, The Solution is long and the link provide help with images.. This tool can help you find the classloader that cause the leak(Class loader is for every application under the server in order to ley several applications run toghther under the same server) Than you will go find the problem class.. Once you will know what is causing the problem you will be able to cure it.. This is link that will exaplain why this is happening and how to deal: cdivilly.wordpress.com/2012/04/23/permgen-memory-leak/ You can read this great presentation .. From page 11 you can see how you can identify the leaks and the solutions.. Very Very useful http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf Hope that more helpful
upvote count: 4

http://stackoverflow.com/q/24069198
tagged with: dependencies
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24069330
tagged with: git
type: Question
linked to: http://stackoverflow.com/q/16574625
upvote count: 9
linked to: http://stackoverflow.com/q/7813030
has body: I'm setting up a new Java project on GitHub, and I'll have some Apache Commons libraries as dependencies. What are the best practices to establish that my project needs those jar files? Should I upload the dependencies to my GitHub repository (ugly)? Or use a Maven-like tool for that? Or is there a way to link a file in another git repository? Apache provides git repositories for they libraries. They are read-only, but I'm o.k. with that, since I just want to use the jars. The bad thing is that they contain all the sources, and I just care about the compiled jar. It seems we can't git submodule just a file.
linked to: http://stackoverflow.com/q/13490684
tagged with: java
score: 9
linked to: http://stackoverflow.com/q/10551280
accepted answer: http://stackoverflow.com/a/24069330
downvote count: 0
answer count: 1
tagged with: jar
has title: Jar Dependencies in GitHub
tagged with: github
favorite count: 0
linked to: http://stackoverflow.com/q/6238590
linked to: http://stackoverflow.com/q/1777854

http://stackoverflow.com/comment/37125217
score: 0
comment on: http://stackoverflow.com/a/24073830
type: AnswerComment
has text: @Kevin Edited. Call `toString()`, don't cast to a String.
type: Comment

http://stackoverflow.com/a/24029254
answers question: http://stackoverflow.com/q/24027642
has comment: http://stackoverflow.com/comment/37112707
has body: There are several approaches you can take: You can create a container View (e.g. a FrameLayout), use it as your root view, and add the LoseScreen to it and remove the PlayScreen from it. You can then pass a reference to the container around if some other code needs to add/remove views. View playScreen = new PlayScreen(this); View container = new FrameLayout(this); playScreen.setRootView(container); container.addView(playScreen); setContentView(container); You can pass a reference to MainActivity to the class that creates the LoseScreen. Since setContentView is a public method, you can then just call setContentView on it, e.g.: Activity mainActivity = this; playScreen.setMainActivity(mainActivity); Then from within PlayScreen: mainActivity.setContentView(new LoseScreen(getContext())); From within PlayScreen, you can get the parent view using getParent() and then, similar to the first approach, add the LoseScreen to it and remove the PlayScreen. ViewGroup parent = (ViewGroup)getParent(); parent.addView(new LoseScreen(getContext())); parent.removeView(this);
accepted answer of: http://stackoverflow.com/q/24027642
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37100621
type: Answer
has comment: http://stackoverflow.com/comment/37064985
has comment: http://stackoverflow.com/comment/37106977
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37120442
has comment: http://stackoverflow.com/comment/37110795
has comment: http://stackoverflow.com/comment/37056802

http://stackoverflow.com/q/24014397
score: 1
upvote count: 3
downvote count: 2
tagged with: jmx
answer count: 1
has answer: http://stackoverflow.com/a/24017288
tagged with: java
type: UnansweredQuestion
tagged with: aspectj
has body: I wrote an program to trace the performance of an application using AspectJ with a requirement that the tracing can be enabled or disabled at runtime using JMX so that i can change the value using jconsole/HtmlAdaptorServer. Now again i have to keep the Pointcut in AOP.xml file so that we can change the poincut when need. As soon as I am kepping the pointcut in aop .xml file nothing happens.Below is the code please let me know what to do or what am I missing. Since I am using JMX here I am declaring MBean package com.ags.performance.asp; public interface SystemMonitoringAspectMBean { public void setEnabled(boolean enabled); public boolean isEnabled(); } Here I am using MBean and creating an Aspect package com.ags.performance.asp; //import ... import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; @Aspect public abstract class AbstractPerformanceMonitoringAspect implements SystemMonitoringAspectMBean{ private Logger logger = Logger .getLogger(AbstractPerformanceMonitoringAspect.class); public volatile boolean enabled ; @Pointcut public abstract void monitoredOp(); @Around("monitoredOp()&amp;&amp; !within(AbstractPerformanceMonitoringAspect)") public Object monitor(ProceedingJoinPoint pjp) throws Throwable { if (!isEnabled()) { return pjp.proceed(); } long start = System.nanoTime(); try { return pjp.proceed(); } finally { long complete = System.nanoTime(); logger.log(Level.INFO, "Operation " + pjp.getSignature().toShortString() + " took " + (complete - start) + " nanoseconds"); } } public synchronized void setEnabled(boolean enabled) { this.enabled = enabled; } public synchronized boolean isEnabled() { return enabled; } } Then I am creating Agent so that I can change the values at runtime package com.ags.performance.asp; import com.sun.jdmk.comm.HtmlAdaptorServer; import org.aspectj.lang…
tagged with: aop
favorite count: 0
type: Question
has title: Issue with AOP and JMX without Spring

http://stackoverflow.com/q/24009792
has comment: http://stackoverflow.com/comment/37013986
has answer: http://stackoverflow.com/a/24014824
score: 0
has comment: http://stackoverflow.com/comment/37013623
answer count: 1
type: AnsweredQuestion
has title: Renaming collection in eXist-db in Java
tagged with: java
tagged with: exist-db
accepted answer: http://stackoverflow.com/a/24014824
has body: Hi I would like to ask if someone could tell me if it is possible to rename a collection in eXist-db in Java (without having to remove old collection and create a new one). I have already searched the API but haven't found anything except creating and removing collections. I'm using exist's XML:DB API.
type: Question

http://stackoverflow.com/a/24094670
score: 1
has body: The point of a constructor is for initializing the state of the object. You could use a constructor to initialize an array, for example, if the length of the array or its values would change depending on the values passed to the constructor. As an example a class Card could accept a Suit, which would initialize all the 12 cards with the given suit. However, if the array doesn't change based on the type of the constructor or the values passed to it then it doesn't make sense to initialize the array inside of the constructor.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24094572

http://stackoverflow.com/q/23987743
score: -1
has answer: http://stackoverflow.com/a/64764481
has body: I have to read the image from my website. However, the images uploaded by users in the server have variety extensions. jpg png etc. How I can modify the image_url code to detect the extension of the image automatically without having to declare it as static public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_product, container, false); // Loader image - will be shown before loading image int loader = R.drawable.loader; editTxtQuantity = (EditText)rootView.findViewById(R.id.inputQuantity); btnAddtocart = (Button) rootView.findViewById(R.id.btnAddtocart); btnCancel = (Button) rootView.findViewById(R.id.btnCancel); productErrorMsg = (TextView) rootView.findViewById(R.id.product_error); txtName = (TextView) rootView.findViewById(R.id.inputName); txtPrice = (TextView) rootView.findViewById(R.id.inputPrice); txtDesc = (TextView) rootView.findViewById(R.id.inputDesc); // Imageview to show image = (ImageView) rootView.findViewById(R.id.image); // Getting productid from ScanFragment pid = getArguments().getString("pid"); // Image url String image_url = "http://smartqr.droid-addict.com/upload/products/" + pid +".png"; // ImageLoader class instance ImageLoader imgLoader = new ImageLoader(getActivity().getApplicationContext()); // whenever you want to load an image from url // call DisplayImage function // url - image url to load // loader - loader image, will be displayed before getting image // image - ImageView imgLoader.DisplayImage(image_url, loader, image); This is because the name of the image file is not fixed. So how can I display it properly the image with its correct extension.
has comment: http://stackoverflow.com/comment/36963826
has comment: http://stackoverflow.com/comment/36963792
downvote count: 1
has title: Android detect the image is png/jpg/etc extension from the web
tagged with: android-fragments
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/23987776
has answer: http://stackoverflow.com/a/23987843
tagged with: imageview
upvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36963839
tagged with: android

http://stackoverflow.com/a/23977270
has comment: http://stackoverflow.com/comment/125664141
type: Answer
score: 1
upvote count: 1
has body: The @ValidCriteria annotation should be on the Criteria class: @ValidCriteria class Criteria{ @NotEmpty String id; @NotEmpty String name; String fileName; String hours; }
answers question: http://stackoverflow.com/q/23976551
has comment: http://stackoverflow.com/comment/36951334
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23976551

http://stackoverflow.com/comment/37036761
has text: Not sure if it will be exactly what you want but have you considered using `BigInteger`? It pulls the sign out of the initial value and then generated a `byte[]` containing the byte data of the unsigned value.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24026494

mysql
tags question: http://stackoverflow.com/q/23993845
tags question: http://stackoverflow.com/q/23951011
tags question: http://stackoverflow.com/q/24034004
tags question: http://stackoverflow.com/q/24070399
tags question: http://stackoverflow.com/q/23986348
tags question: http://stackoverflow.com/q/24051070
tags question: http://stackoverflow.com/q/23973362
tags question: http://stackoverflow.com/q/24075301
tags question: http://stackoverflow.com/q/24075212
tags question: http://stackoverflow.com/q/24103333
tags question: http://stackoverflow.com/q/24012978
tags question: http://stackoverflow.com/q/24017118
tag name: mysql
tags question: http://stackoverflow.com/q/23990008
tags question: http://stackoverflow.com/q/24038833
tags question: http://stackoverflow.com/q/24022813
tags question: http://stackoverflow.com/q/24093746
tags question: http://stackoverflow.com/q/23999271
tags question: http://stackoverflow.com/q/23965883
tags question: http://stackoverflow.com/q/23954334
tags question: http://stackoverflow.com/q/23978446
tags question: http://stackoverflow.com/q/24098247
tags question: http://stackoverflow.com/q/24002870
tags question: http://stackoverflow.com/q/23969635
tags question: http://stackoverflow.com/q/24049135
tags question: http://stackoverflow.com/q/24036464
tags question: http://stackoverflow.com/q/24099904
tags question: http://stackoverflow.com/q/24007966
tags question: http://stackoverflow.com/q/24101781
tags question: http://stackoverflow.com/q/23978628
tags question: http://stackoverflow.com/q/24096111
tags question: http://stackoverflow.com/q/23955709
tags question: http://stackoverflow.com/q/24006634
tags question: http://stackoverflow.com/q/24015198
tags question: http://stackoverflow.com/q/23970135
tags question: http://stackoverflow.com/q/24027719
tags question: http://stackoverflow.com/q/24018928
tags question: http://stackoverflow.com/q/24027693
tags question: http://stackoverflow.com/q/24053684
tags question: http://stackoverflow.com/q/23949030
tags question: http://stackoverflow.com/q/24059491
tags question: http://stackoverflow.com/q/24028314
tags question: http://stackoverflow.com/q/24069407
tags question: http://stackoverflow.com/q/23952726
tags question: http://stackoverflow.com/q/23946253
tags question: http://stackoverflow.com/q/24030550
tags question: http://stackoverflow.com/q/23954979
tags question: http://stackoverflow.com/q/24033672
tags question: http://stackoverflow.com/q/24055763
tags question: http://stackoverflow.com/q/24069823
tags question: http://stackoverflow.com/q/24033649
tags question: http://stackoverflow.com/q/24033503
tags question: http://stackoverflow.com/q/24066305
tags question: http://stackoverflow.com/q/24036013
tags question: http://stackoverflow.com/q/24093383
tags question: http://stackoverflow.com/q/23954790
tags question: http://stackoverflow.com/q/24034015
tags question: http://stackoverflow.com/q/24091897
tags question: http://stackoverflow.com/q/23965124
type: Tag
tags question: http://stackoverflow.com/q/24078153
tags question: http://stackoverflow.com/q/23953060
tags question: http://stackoverflow.com/q/24042889
tags question: http://stackoverflow.com/q/23982606
tags question: http://stackoverflow.com/q/24058186
tags question: http://stackoverflow.com/q/24039451
tags question: http://stackoverflow.com/q/24028105
tags question: http://stackoverflow.com/q/24089645
tags question: http://stackoverflow.com/q/24061733
tags question: http://stackoverflow.com/q/24099899
tags question: http://stackoverflow.com/q/24054456
tags question: http://stackoverflow.com/q/24059551
tags question: http://stackoverflow.com/q/24078122
tags question: http://stackoverflow.com/q/24073864
tags question: http://stackoverflow.com/q/23982939
tags question: http://stackoverflow.com/q/23973802
tags question: http://stackoverflow.com/q/23980058
tags question: http://stackoverflow.com/q/24090935
tags question: http://stackoverflow.com/q/23990942
tags question: http://stackoverflow.com/q/24034750

http://stackoverflow.com/a/23962389
type: Answer
accepted answer of: http://stackoverflow.com/q/23955582
has body: Use findFirstnameTextField(f) notice the f argument.
has comment: http://stackoverflow.com/comment/36965923
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23955582
score: 0

http://stackoverflow.com/comment/36958325
has text: no, but it can simulate it with interfaces
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23984757

http://stackoverflow.com/comment/37075714
type: Comment
comment on: http://stackoverflow.com/a/23981128
has text: `CATALINA_BASE/conf/web.xml` is the default `web.xml` for all web applications. You should pretty much never edit it. What you want is a servlet (or filter) in your `ROOT` webapp that performs a redirect. That's possible to do *without* a `WEB-INF/web.xml`, but more straightforward if you do. `CATALINA_BASE/conf/web.xml` should never be under consideration for editing.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37054000
type: Comment
comment on: http://stackoverflow.com/a/24035834
has text: Thanks Plumillon. Using TouchImageView works and it zooms, but I want the image to increase in size within the current view. Would this code do that?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37146144
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24085701
has text: The last part seems correct, do you get an error?
score: 0

http://stackoverflow.com/comment/36883090
score: 0
type: Comment
type: QuestionComment
has text: Now it is on-topic, since there is a slight coding error in the exp-method that will lead to unexpected results.
comment on: http://stackoverflow.com/q/23941811

http://stackoverflow.com/q/23983832
has answer: http://stackoverflow.com/a/23984518
favorite count: 0
possible better answer: http://stackoverflow.com/a/32832233
tagged with: method-reference
has comment: http://stackoverflow.com/comment/36957127
tagged with: java-8
has comment: http://stackoverflow.com/comment/36956947
type: AnsweredQuestion
score: 88
tagged with: java
upvote count: 88
has comment: http://stackoverflow.com/comment/36957923
tagged with: caching
type: Question
has comment: http://stackoverflow.com/comment/36956855
has answer: http://stackoverflow.com/a/32832233
downvote count: 0
has answer: http://stackoverflow.com/a/23991339
accepted answer: http://stackoverflow.com/a/23991339
has comment: http://stackoverflow.com/comment/36957171
has body: Consider I have code like the following: class Foo { Y func(X x) {...} void doSomethingWithAFunc(Function&lt;X,Y&gt; f){...} void hotFunction(){ doSomethingWithAFunc(this::func); } } Suppose that hotFunction is called very often. Would it then be advisable to cache this::func, maybe like this: class Foo { Function&lt;X,Y&gt; f = this::func; ... void hotFunction(){ doSomethingWithAFunc(f); } } As far as my understanding of java method references goes, the Virtual Machine creates an object of an anonymous class when a method reference is used. Thus, caching the reference would create that object only once while the first approach creates it on each function call. Is this correct? Should method references that appear at hot positions in the code be cached or is the VM able to optimize this and make the caching superfluous? Is there a general best practice about this or is this highly VM-implemenation specific whether such caching is of any use?
answer count: 3
has title: Is method reference caching a good idea in Java 8?

http://stackoverflow.com/a/23965323
answers question: http://stackoverflow.com/q/23942990
score: 2
type: AcceptedAnswer
downvote count: 0
has body: My solution was to override the httpconduit in my test context.xml &lt;http:conduit name="*.http-conduit"&gt; &lt;http:client CacheControl="no-store" Connection="Keep-Alive" AllowChunking="false" ConnectionTimeout="10000" ReceiveTimeout="60000"/&gt; &lt;/http:conduit&gt;
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/23942990

http://stackoverflow.com/q/24055468
has body: I was working on the Stanford sentiment classifier on windows. I wanted to retrain my own model, and here's how it was specified on the website: java -mx8g edu.stanford.nlp.sentiment.SentimentTraining -numHid 25 -trainPath train.txt -devPath dev.txt -train -model model.ser.gz But this gave me the error: could not find or load main class But on changing it to java -cp "*" it worked.
has comment: http://stackoverflow.com/comment/37090364
score: 0
answer count: 3
has title: What does java -cp "*" mean?
has comment: http://stackoverflow.com/comment/37093200
has answer: http://stackoverflow.com/a/24055618
has answer: http://stackoverflow.com/a/24055531
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24055533
type: Question
has answer: http://stackoverflow.com/a/24055533
tagged with: stanford-nlp
accepted answer: http://stackoverflow.com/a/24055531
linked to: http://stackoverflow.com/q/11922681

http://stackoverflow.com/comment/37063173
score: 0
comment on: http://stackoverflow.com/q/24029349
type: QuestionComment
has text: I added it as answer you can mark as accepted for others reference
type: Comment

http://stackoverflow.com/comment/37101478
has text: Vijay Kakade contains vij so you are getting output
comment on: http://stackoverflow.com/q/24061638
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37044281
score: 1
has text: @Makoto This is not the exact duplicate. The duplicate marked question explaining about removing the item from map. Here in this case there is no remove method calling on iterator. Am I wrong ?
comment on: http://stackoverflow.com/q/24030747
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36914641
type: Comment
comment on: http://stackoverflow.com/q/23961041
has text: @GeorgeStocker how could I go about making a JSONP call?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37054203
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24036201
has text: I think the best way is to read both files into arrays and then make comparision between arrays, but this is just my first thoughts.

http://stackoverflow.com/comment/36980178
has text: Have you considered having the JPasswordField and then having a TextField underneath with the partially masked input? You could render the mask as part of an action listener, say a button that says (verify input) which then masks the input and displays it in the text field.
comment on: http://stackoverflow.com/q/23996441
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23988837
has answer: http://stackoverflow.com/a/23989114
score: 0
has answer: http://stackoverflow.com/a/23988995
has comment: http://stackoverflow.com/comment/36965730
possible better answer: http://stackoverflow.com/a/23989114
has body: I have ~400 statements using RoundingMode.HALF_UP, and by the nature of the app, I'd like for the user to be able to choose between the rounding modes. However, I'm at a loss as to how to represent that as a variable, if possible. Because of the incredible amount of statements, I'd like to avoid if statements. Is it possible to do what I'm asking? I've tried an enum, but that's all I could conjure. Everything else got about half a line through. Google hasn't helped. Any suggestions are welcome.
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23988995
tagged with: java
has comment: http://stackoverflow.com/comment/36965700
has comment: http://stackoverflow.com/comment/36965683
has comment: http://stackoverflow.com/comment/36965737
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36965766
has comment: http://stackoverflow.com/comment/36965669
tagged with: bigdecimal
has title: Set BigDecimal RoundingMode according to user option without if statements?

http://stackoverflow.com/comment/37142184
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24082589
type: AnswerComment
has text: Thanks, I used List for check boxes but I forgot that the same applies to even text boxes lol..

http://stackoverflow.com/comment/37198155
type: Comment
has text: It's a logical consequence of the fact that a KeyStore is loaded from an input stream rather than provided with a File.
type: AnswerComment
comment on: http://stackoverflow.com/a/24074156
score: 0

http://stackoverflow.com/a/52573197
downvote count: 0
answers question: http://stackoverflow.com/q/23977629
type: Answer
has body: @Ahmed Tawila - as he mentioned I did the same mistake. I forgot to add @PathVariable annotation before the primitive type for the method in controller. Incorrect Code: Required annotation is not defined before long primitive type @RequestMapping(method = RequestMethod.DELETE, value = "/categories/{categoryId}/subcategories/{id}") public void deleteSubCategory(long id) throws Exception { subCategoryService.delete(id); } Correct Code: Annotation added(@PathVariable) @RequestMapping(method = RequestMethod.DELETE, value = "/categories/{categoryId}/subcategories/{id}") public void deleteSubCategory(@PathVariable long id) throws Exception { subCategoryService.delete(id); }
upvote count: 6
score: 6

http://stackoverflow.com/q/24098386
type: Question
tagged with: cardlayout
answer count: 1
tagged with: layout-manager
score: 0
has answer: http://stackoverflow.com/a/24098442
accepted answer: http://stackoverflow.com/a/24098442
tagged with: user-interface
tagged with: swing
has body: This is my SSCE (though in three seperate classes). StartUp.java public class Startup { public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { MainFrame gui = new MainFrame(); } }); } } MainFrame.java package gui; import java.awt.CardLayout; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; public class MainFrame { private JFrame mainFrame; private JMenuBar menuBar; private JMenu menuRoboControl; private JMenuItem menuItemStart; private JMenuItem menuItemShutdown; private JPanel cardPanel; private final JPanel comListCard = new ComListCard(); public MainFrame() { initComponents(); } private void menuItemStartActionPerformed(ActionEvent e) { CardLayout cardLayout = (CardLayout) cardPanel.getLayout(); cardLayout.show(cardPanel, "selectPort"); } private void menuItemShutdownActionPerformed(ActionEvent e) { mainFrame.dispose(); System.exit(0); } private void initComponents() { mainFrame = new JFrame(); menuBar = new JMenuBar(); menuRoboControl = new JMenu(); menuItemStart = new JMenuItem(); menuItemShutdown = new JMenuItem(); cardPanel = new JPanel(); //======== mainFrame ======== { Container mainFrameContentPane = mainFrame.getContentPane(); mainFrameContentPane.setLayout(new BoxLayout(mainFrameContentPane, BoxLayout.X_AXIS)); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //======== menuBar ======== { //======== menuRoboControl ======== { menuRoboControl.setText("RoboControl"); //---- menuItemStart ---- menuItemStart.setText("Start Robot"); menuItemStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItemStartActionPerformed(e); } }); menuRoboControl.add(menuItemStart); //---- menuItemShutdown ---- menuItemShutdown.setText(…
type: AnsweredQuestion
tagged with: java
has title: CardLayout appearing without asking for it

http://stackoverflow.com/comment/36891646
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23948693
has text: No if you are Administrator, TaskManager should remember it. But it will only work for you (User) and your Computer.

http://stackoverflow.com/a/24090129
type: Answer
answers question: http://stackoverflow.com/q/24089748
score: 0
has body: if(pairs.getKey() == father){ System.out.println("F = " + pairs.getKey() + "\n" + "C = " + pairs.getValue() + "\n" + "Yes"); } System.out.println("No"); The statement outside the curly bracket is the reason you are getting the double no when the first if statement before the one above is false.

http://stackoverflow.com/comment/37112467
has text: @sircapsalot It is a physical javascript alert pop up
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24067212
type: QuestionComment

http://stackoverflow.com/q/24061656
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24062645
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/37103061
favorite count: 0
type: Question
score: -1
has title: Can not delete from @ElementCollection
tagged with: java
tagged with: hibernate
has body: In User.java ive got a map: @Entity public class User{ ... @ElementCollection private Map&lt;Competency,Float&gt; competenciesValue = new HashMap&lt;Competency,Float&gt;(); } and got Competency class @Entity public class Competency{ .. } This is a many to many relationship. Many users can have many competencies. And now wherever i try to delete any of my COMPETENCY i get a foreign key error. How to deal with it ? Stacktrace : Hibernate: delete from Competency where id=? WARN : org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 1451, SQLState: 23000 ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Cannot delete or update a parent row: a foreign key constraint fails (`CT2_szet`.`User_competenciesValue`, CONSTRAINT `FK_887tayi9xe3w6xw8jv2cui829` FOREIGN KEY (`competenciesValue_KEY`) REFERENCES `Competency` (`id`)) Jun 05, 2014 4:13:27 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [appServlet] in context with path [/CompetenceTool] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`CT2_szet`.`User_competenciesValue`, CONSTRAINT `FK_887tayi9xe3w6xw8jv2cui829` FOREIGN KEY (`competenciesValue_KEY`) REFERENCES `Competency` (`id`)) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) …

http://stackoverflow.com/q/24033401
has title: Error in running startNetworkServer
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24037150
tagged with: netbeans
score: 0
tagged with: java
type: Question
tagged with: derby
tagged with: api
answer count: 1
has body: I am trying to start the network server from outside netbeans. I did set the DERBY_INSTALL variable to the appropriate directory, then i issue setNetworkServerCP command which also works fine. But when i try to run startNetworkServer i am getting the following error. C:\Users\tandons>D: D:>cd D:\netbeans\glassfish-v2.1\javadb\bin D:\netbeans\glassfish-v2.1\javadb\bin>setNetworkServerCP DERBY_HOME or DERBY_INSTALL not set. Set one of these variables to the location of your Derby installation. D:\netbeans\glassfish-v2.1\javadb\bin>set DERBY_INSTALL=D:\netbeans\glassfish-v2 .1\javadb D:\netbeans\glassfish-v2.1\javadb\bin>setNetworkServerCP.bat D:\netbeans\glassfish-v2.1\javadb\bin>SET DERBY_INSTALL=D:\netbeans\GLASSF~1.1\j avadb D:\netbeans\glassfish-v2.1\javadb\bin>set CLASSPATH=D:\netbeans\glassfish-v2.1\j avadb\lib\derbynet.jar;D:\netbeans\glassfish-v2.1\javadb\lib\derbytools.jar; D:\netbeans\glassfish-v2.1\javadb\bin>setNetworkServerCP D:\netbeans\glassfish-v2.1\javadb\bin>SET DERBY_INSTALL=D:\netbeans\GLASSF~1.1\j avadb D:\netbeans\glassfish-v2.1\javadb\bin>set CLASSPATH=D:\netbeans\glassfish-v2.1\j avadb\lib\derbynet.jar;D:\netbeans\glassfish-v2.1\javadb\lib\derbytools.jar;D:\n etbeans\glassfish-v2.1\javadb\lib\derbynet.jar;D:\netbeans\glassfish-v2.1\javadb \lib\derbytools.jar; D:\netbeans\glassfish-v2.1\javadb\bin>startNetworkServer Security manager installed using the Basic server security policy. access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkListen(Unknown Source) at java.net.ServerSocket.bind(Unknown Source) at java.net.ServerSocket.(Unknown Source) at javax.net.DefaultServerSocketFactor…

http://stackoverflow.com/a/23978427
downvote count: 4
score: -3
type: Answer
has comment: http://stackoverflow.com/comment/68393164
upvote count: 1
has body: The success handler and failure handler are defined in the form-login (if you use Spring's XML). It is not different than any other spring-security definitions: &lt;security:form-login login-page="/login/login.htm" authentication-success-handler-ref="authenticationSuccessHandler" authentication-failure-url="/login/login.htm?login_error=1" /&gt; and you can find the handler here. The "failure handler" is pretty similar.
has comment: http://stackoverflow.com/comment/84372390
answers question: http://stackoverflow.com/q/23978321

http://stackoverflow.com/comment/36968312
score: 0
type: QuestionComment
has text: You want to create an executable Jar, have a look at this previous question, it will probably help. http://stackoverflow.com/questions/5258159/how-to-make-an-executable-jar-file
type: Comment
comment on: http://stackoverflow.com/q/23990317

http://stackoverflow.com/comment/37117613
comment on: http://stackoverflow.com/a/24070029
type: AnswerComment
score: 0
type: Comment
has text: That would be my guess.

http://stackoverflow.com/a/24057800
answers question: http://stackoverflow.com/q/24057521
has body: The result will be same. In both the cases static variable will get initialized with class loading. static methods and static class blocks are two different things. static methods need to be called where as static class block automatically gets executed with class loading.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/24053546
has body: While creating the Object in my test code as below Object obj = new Object(); obj.setId(1); obj.setName("Employee"); sess.save(obj); ObjectAttribute ageAtt = new ObjectAttribute(); ageAtt.setId(1); ageAtt.setName("age"); ageAtt.setObject(obj); sess.save(ageAtt); ObjectAttribute depAtt = new ObjectAttribute(); depAtt.setId(2); depAtt.setName("department"); depAtt.setObject(obj); sess.save(depAtt); ObjectAttribute attName = new ObjectAttribute(); attName.setId(3); attName.setName("name"); attName.setObject(obj); sess.save(attName); I have not added these line obj.getAttrubuteList().add(depAtt); obj.getAttrubuteList().add(attName); obj.getAttrubuteList().add(ageAtt); But i dont know why we need to do this!!
type: Answer
answers question: http://stackoverflow.com/q/24044130
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24044130
score: 0

http://stackoverflow.com/q/24058573
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37095798
has title: Error creating bean with name 'entityManagerFactory' (Maven+jpa+spring)
accepted answer: http://stackoverflow.com/a/24059707
downvote count: 0
answer count: 1
tagged with: jpa-2.0
favorite count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/37095929
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37097393
has body: I'm trying to run my application and it is giving me the following error in console: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [cfg/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: JpaPersistenceUnit] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1488) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at org.isban.conversor.main.ConversorMain.main(ConversorMain.java:22) Caused by: javax.persistence.…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24059707

http://stackoverflow.com/a/24037939
has comment: http://stackoverflow.com/comment/37107941
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/37107431
has comment: http://stackoverflow.com/comment/37106474
answers question: http://stackoverflow.com/q/24037692
has body: A simple solution: while(test &lt; 10000) { long num = (long) (Math.random() * 100000000 * 1000000); if(Long.toString(num).length() == 13) { return num; } test++; } However, a better solution is this: long number = (long) Math.floor(Math.random() * 9000000000000L) + 1000000000000L; This will only generate random 13 digit numbers, and you don't need to check if there are more or less digits. Note that this solution may not scale to a higher number of digits and may not return a perfect distribution of random numbers.
downvote count: 0
has comment: http://stackoverflow.com/comment/37113927
type: Answer

http://stackoverflow.com/q/24027827
has comment: http://stackoverflow.com/comment/37039034
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/46898
has title: How can I iterate over a TreeMap of type <Integer, ArrayList>
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37039541
tagged with: foreach
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37039682
has comment: http://stackoverflow.com/comment/37039331
type: Question
has body: I have a TreeMap in which the keys are of type Integer and the values are of type ArrayList. Here is some sample code: import java.util.*; public static void iterThruTreeMap() { ArrayList&lt;String&gt; contact = new ArrayList&lt;String&gt;(); contact.add("Jane"); contact.add("Doe"); contact.add("123-456-7890"); ArrayList&lt;String&gt; contact2 = new ArrayList&lt;String&gt;(); contact2.add("Jane"); contact2.add("Doe"); contact2.add("123-456-7890"); ArrayList&lt;String&gt; contact3 = new ArrayList&lt;String&gt;(); contact3.add("Jane"); contact3.add("Doe"); contact3.add("123-456-7890"); Map&lt;Integer, ArrayList&gt; list = new TreeMap&lt;Integer, ArrayList&gt;(); list.put(0, contact); list.put(1, contact2); list.put(2, contact3); for (int key : list) { // stuck } } What I want to do is extract the first and last names from each of the ArrayLists contained in the TreeMap. I tried using a regular for-loop and received a NullPointerException. I am getting an error using the foreach method as shown in my sample, I think because of type. I have tried using an Iterator, but I don't think I wrote it correctly. If someone could point me in the right direction, I'd appreciate it very much!
tagged with: iterator
linked to: http://stackoverflow.com/q/3995463
duplicate of: http://stackoverflow.com/q/46898
tagged with: treemap
has comment: http://stackoverflow.com/comment/37039477
tagged with: arraylist
score: 0
upvote count: 1

http://stackoverflow.com/a/23977303
has body: Absolutely right.. Producer generate the wsdl and store it somewhere so that it can be provided to consumer to understand the request and response message structure along with the protocol, operations and service location. Webservice implementation frameworks like cxf etc. already know How they are going to receive message from consumer, which operation they are going to call. They simply marshal and unmarshal incoming request and outgoing response. They don't use wsdl. In my opinion. Correct me experts if i am wrong...
type: Answer
answers question: http://stackoverflow.com/q/23976960
has comment: http://stackoverflow.com/comment/36944674
score: 0

http://stackoverflow.com/a/24022372
score: 2
upvote count: 2
has body: Found it: block.getRelative(blockface);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24021430

http://stackoverflow.com/comment/36959600
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23985425
has text: You have an infinite loop. Have you even tried to debug it before posting the question to stackoverflow?
score: 0

http://stackoverflow.com/a/23968585
upvote count: 1
type: AcceptedAnswer
has body: Let's say you have a Message class, and 2 subclasses Email and Sms. You could have many operations on these two classes, like sendToOnePerson(), sendToSeveralPeople(). But you probably don't want to have these methods in the Email and Sms class directly, because it tightly couples them to the SMTP/phone system. And you would also like to be able to add other operations in the futre, like forward() or delete(), or whatever. So the first implementation you could use is public void delete(Message message) { if (message instanceof Email) { deleteEmail(Email) message); } else if (message instanceof Sms) { deleteSms((Sms) message); } } But this is ugly: it's not object-oriented, and it will fail if there is a new VoiceMessage subclass appearing. An alternative is to use the visitor pattern. public interface MessageVisitor { void visitEmail(Email email); void visitSms(Sms sms); } public abstract class Message { public void accept(MessageVisitor visitor); } public class Email extends Message { @Override public void accept(MessageVisitor visitor) { visitor.visitEmail(this); } } public class Sms extends Message { @Override public void accept(MessageVisitor visitor) { visitor.visitSms(this); } } This way, to implement send(), all you need is a MessageVisitor implementation that can send an email and send an Sms: SendMessageVisitor visitor = new SendMessageVisitor(); message.accept(visitor); And if you introduce a new delete() operation, you don't have to touch to Message classes at all. All you need is a DeleteMessageVisitor: DeleteMessageVisitor visitor = new DeleteMessageVisitor(); message.accept(visitor); So, basically, it's a bit like if you added polymorphic methods to the Message classes by not actually modifying the Message classes.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23968494
accepted answer of: http://stackoverflow.com/q/23968494
has comment: http://stackoverflow.com/comment/36929932
has comment: http://stackoverflow.com/comment/36931843

http://stackoverflow.com/comment/36956117
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23977914
has text: You don't expect me to write your code for you, do you? Now you have a clear problem statement that you can use for your design, you can google the topic and you will find many examples and tutorials that will get you started. Ultimately, if you really want to become proficient with NIO, it's up to you to go and implement it by yourself, and this involves making mistakes, fixing them and learning from them.

http://stackoverflow.com/q/23966149
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23966214
type: Question
has body: I want this string "Initial: At(Forest), MonsterAt(Chimera,Forest), Alive(Chimera)" to be parsed into: "At(Forest)" , "MonsterAt(Chimera, Forest)" , and "Alive(Chimera)" (I don't need "Initial:"). I used this code from (java - split string using regular expression): String[] splitArray = subjectString.split( "(?x), # Verbose regex: Match a comma\n" + "(?! # unless it's followed by...\n" + " [^(]* # any number of characters except (\n" + " \\) # and a )\n" + ") # end of lookahead assertion"); this is the output (the underscore is a space): Initial: At(Forest) _MonsterAt(Chimera,Forest) _Alive(Chimera) but I don't want to have a space before the string ("_Alive(Chimera)"), and I want to remove the "Initial: " after splitting. If I removed the spaces (except for "Initial") from the original string the output is this: Initial: At(Forest),MonsterAt(Chimera,Forest),Alive(Chimera)
tagged with: split
answer count: 2
possible better answer: http://stackoverflow.com/a/23966205
tagged with: string
score: 0
linked to: http://stackoverflow.com/q/5363164
tagged with: regex
tagged with: parsing
has answer: http://stackoverflow.com/a/23966205
has title: java - using regex to split string
accepted answer: http://stackoverflow.com/a/23966214

http://stackoverflow.com/q/23979065
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23979208
tagged with: junit
favorite count: 0
has body: I want to test a service that is executing tasks in serial fashion and throws TimeOutInServiceException if some task waits for more than 5 seconds. I want to test timeout scenerio. The complete test scenerio which I have written is quite complicated and I am searching for simplest solution. The key points to testing such service are service times out by exception (not by returning some special value) we must start a longer blocking task in separate thread we can't exit test by exception @Test(expected = ...) because longer task thread will be still alive in background blocking service during other tests So, my current test case look like this: create Executor create long-lasting Callable/Runnable create failing (that, which has to time out) Callable/Runnable .submit() long task to executor sleep some time, to be sure that longer task started first .submit() failing-on-timeout task .shutdown() executor and .awaitTermination() .get() and .assertTrue() that first task completed OK Catch ExecutionException from .get() on failing task and store cause in prepared ref: Exception thrown = null; try { timeoutedTaskFuture.get(); } catch ( ExecutionException ex ) { thrown = (Exception)ex.getCause(); } Check expected excetpion type: assertTrue( thrown instanceof TimeOutInServiceException ); Is there a better way to test such scenerio?
has answer: http://stackoverflow.com/a/23979208
tagged with: multithreading
upvote count: 1
has title: JUnit testing scenerio for Lock.tryLock timeout exception
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: timeout
tagged with: concurrency
type: Question

http://stackoverflow.com/q/24039570
type: Question
has comment: http://stackoverflow.com/comment/37084047
has answer: http://stackoverflow.com/a/24056857
upvote count: 2
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37084096
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37109748
has body: My project use Struts2, Spring and Hibernate. And the project grow bigger and a lot of action never used. So related tiles and JSP also have the same issue. Is any tools or write some code to find out all unused link. Or found the link can be reach from index page and then go though all action . found the unused action. My action is like below : @Action(value = "saveClass", results = {@Result(name = SUCCESS, type = "tiles", location = ".initStep3"), @Result(name = "repeat",type = Constants.RESULT_NAME_TILES,location = ".repeatClassInfo"), @Result(name = "maintenance",type = Constants.RESULT_NAME_TILES,location = ".courseInfoModified"), @Result(name = INPUT, type = "tiles", location = ".saveClass")}) public String saveClass() {
tagged with: struts2
has title: How to delete unused JSP and action
has comment: http://stackoverflow.com/comment/37122483
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/10279479
tagged with: jsp
has comment: http://stackoverflow.com/comment/37090932
has comment: http://stackoverflow.com/comment/37068700
has comment: http://stackoverflow.com/comment/37107659
favorite count: 0
has comment: http://stackoverflow.com/comment/37083923

http://stackoverflow.com/q/24067212
type: Question
has comment: http://stackoverflow.com/comment/37112467
answer count: 2
accepted answer: http://stackoverflow.com/a/24077566
downvote count: 0
favorite count: 0
has title: How to verify an alert is not present using Selenium and Java
has comment: http://stackoverflow.com/comment/37112320
possible better answer: http://stackoverflow.com/a/24068957
has answer: http://stackoverflow.com/a/24068957
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/24077566
upvote count: 1
has body: I have tests that involve required fields and alert boxes. When you don't fill out the required field, an alert box should display. I am checking for this alert box by using ExpectedConditions.alertIsPresent() When I fill out the required field, I want to verify that an alert no longer appears. How can I do this using Selenium and Java?

http://stackoverflow.com/a/24009015
downvote count: 0
has comment: http://stackoverflow.com/comment/37003834
upvote count: 3
answers question: http://stackoverflow.com/q/24008946
type: Answer
has comment: http://stackoverflow.com/comment/37003853
has comment: http://stackoverflow.com/comment/37003922
has body: Try String#matches with regex \d\.\d\.\d. String str="1.2.3"; boolean isMatch=str.matches("\\d\\.\\d\\.\\d");
score: 3

http://stackoverflow.com/comment/37054631
comment on: http://stackoverflow.com/q/24036458
type: Comment
type: QuestionComment
has text: Missing some clarity in the question? are you SIMPLY asking how to remove all blank lines in a file?
score: 0

http://stackoverflow.com/q/24020593
has title: Making a 2D array a property, JAVA
has answer: http://stackoverflow.com/a/24020912
downvote count: 1
has answer: http://stackoverflow.com/a/24020798
has comment: http://stackoverflow.com/comment/37025381
type: AnsweredQuestion
tagged with: 2d
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24020692
tagged with: arrays
favorite count: 0
answer count: 5
tagged with: matrix
possible better answer: http://stackoverflow.com/a/24020714
has answer: http://stackoverflow.com/a/24020756
has answer: http://stackoverflow.com/a/24020714
has body: How am I suppouse to add a 2D array to my properties and constructor. I'm suppouse to have an object Sea, which is a 2D array of Strings and a constructor which takes the x and y coordinates. But where am I suppouse to initialize the array. In the constructor or outside of it? package battleship; public class Sea { //declare properties private int width; private int lenght; private String[][] field = new String[getLenght()][getWidth()]; public int getWidth() { return width; } public int getLenght() { return lenght; } public String[][] getField() { return field; } //create constructor public Sea(int width, int length){ this.width = width; this.lenght = length; field = new String[length][width]; } //creates a method that visualizes the field with the ships String[][] toStringWithShips(){ for(int col = 0; col &lt; this.getLenght(); col++){ for(int row = 0; row &lt; this.getWidth(); row++){ field[col][row] = "."; } } return field; } }
upvote count: 2
has answer: http://stackoverflow.com/a/24020692

http://stackoverflow.com/a/23974033
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23973802
answers question: http://stackoverflow.com/q/23973802
downvote count: 0
score: 1
has body: LOAD DATA is a MySQL command not valid for hsqldb, but you can use a temporary table and change the source: -- remporary table create table yourdb.tmp_textfiletable (col1 varchar(250)); set table yourdb.tmp_textfiletable source "'E:/Thesis/ThesisWork/outdata/keywords.txt';ignore_first=false"; -- And insert it in your normal table: INSERT INTO yourdb.keywordsTable (keywords) select Col1 from yourdb.tmp_textfiletable; -- after that you can drop it drop table yourdb.tmp_textfiletable
upvote count: 1

http://stackoverflow.com/comment/37065886
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24042174
type: QuestionComment
has text: We don't need that image... We need the code to solve your problem

http://stackoverflow.com/a/24035768
type: Answer
has comment: http://stackoverflow.com/comment/37053607
has comment: http://stackoverflow.com/comment/37053691
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24035191
has body: You are opening the file and writing a space character to it and then read this file for parsing. When you use PrintWriter this clears your file. So what happens here is first you clear the file and then trying to parse it. That is why null pointer if you want to get that from url you could do like public void get_content(String eliment_by, String identification) { try { org.jsoup.nodes.Document doc = Jsoup.connect("http://www.opengurukul.com/vlc/mod/page/view.php?id=523").get(); Element content = doc.getElementById(identification); this.current_page_content = content.html(); } catch (IOException ex) { Logger.getLogger(url_looping.class.getName()).log(Level.SEVERE, null, ex); } }
answers question: http://stackoverflow.com/q/24035191
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37053440

http://stackoverflow.com/q/24002382
tagged with: hashmap
has comment: http://stackoverflow.com/comment/36991921
tagged with: containment
has comment: http://stackoverflow.com/comment/36991836
has comment: http://stackoverflow.com/comment/36991902
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: key
has answer: http://stackoverflow.com/a/24002484
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/36991967
has comment: http://stackoverflow.com/comment/36991849
has title: How can an object get its key from a HashMap?
has comment: http://stackoverflow.com/comment/36991962
has comment: http://stackoverflow.com/comment/37074297
has body: Suppose I have a chessboard defined with a HashMap HashMap &lt;Position,Field&gt; chessboard = new HashMap &lt;Position,Field&gt;(); I declare the Position as class Position{ int x; int y; } When I am trying to make a class for Field object I encounter a problem: the Field should contain a Position because it is defined by it. Ex. class Field { Position pos; int color; void draw(){ // draw Field using pos } } But the Position object is going to be used for HashMap. How could I avoid this redundancy?
tagged with: java
accepted answer: http://stackoverflow.com/a/24002484
upvote count: 1
answer count: 1

http://stackoverflow.com/a/24033465
has body: I had a similar problem just a few days ago, with a groovy configuration file that I added into grails-app/conf. While this works with other resources (they are copied and available on the classpath), the problem with the groovy file was simply that it was compiled and the class file was included, i.e. not the groovy file itself. I didn't find any good documentation on how this should be done and finally just added it to web-app/WEB-INF/classes. Groovy files placed here will be copied (not compiled) and available on the classpath.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24028410
upvote count: 2
type: Answer

http://stackoverflow.com/comment/36927163
type: Comment
type: QuestionComment
has text: @JonSkeet ok then I will. Thank you for your advise!
comment on: http://stackoverflow.com/q/23967672
score: 0

http://stackoverflow.com/q/24040188
has answer: http://stackoverflow.com/a/25594028
has title: how to stop spring security timeout from loading my login page in a div
type: UnansweredQuestion
tagged with: spring
upvote count: 3
has body: I am having an issue with spring security's timeout facility. On my home JSP i have a table. each list item will allow the user to modify the data in this list element. when you click the edit icon a modal opens with the data from that list element so the user can edit it. the issue I am having is if this modal is open and the system times out and loads the login page. but it loads the login page into the table div. I am just wondering if anyone knows of any possible solutions to this problem?? I have increased the time out limit but will not fix the problem of the login page being displayed in my table div. any help is much appreciated. hanks in advance Billy
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37078333
score: 3
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/comment/37107650
comment on: http://stackoverflow.com/q/24064848
score: 3
has text: Does your `pom.xml` have a `target` and/or `source` elements?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24047605
has comment: http://stackoverflow.com/comment/37097487
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37083249
has comment: http://stackoverflow.com/comment/37083107
answers question: http://stackoverflow.com/q/24047501
score: 1
has comment: http://stackoverflow.com/comment/37085023
has comment: http://stackoverflow.com/comment/37086875
has comment: http://stackoverflow.com/comment/37085128
has body: You don't have: org.springframework.security.core.SpringSecurityCoreVersion available in your class path at run time. It's Spring that's complaining about this when it tries to bring up your context (not the compiler at compile time, i.e. this is a configuration issue, not a "code error"). Spring Security is packaged in two jars: spring-security-config-3.2.0.RELEASE.jar spring-security-core-3.2.0.RELEASE.jar You must be missing the "core" jar...
downvote count: 0

http://stackoverflow.com/q/23976551
type: Question
tagged with: bean-validation
tagged with: validation
answer count: 1
has answer: http://stackoverflow.com/a/23977270
score: 0
has body: I have a model object annotated with Java validation annotations. class Criteria{ @NotEmpty String id; @NotEmpty String name; String fileName; String hours; } As per the business requirement, either fileName or hours field will be populated, to validate which I have a custom validator 'CriteriaValidator' written. @Documented @Constraint(validatedBy = {CriteriaValidator.class}) @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE , ElementType.FIELD, ElementType.PARAMETER}) public @interface ValidCriteria { String message() default "{Criteria.Invalid}"; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } The model above is passed in as input parameter for a method which is also annotated with @Valid and @ValidCriteria. public void update(@Valid @ValidCriteria Criteria criteria){...} The issue I have is with 2 annotations in the method. I have to add @Valid in order to check constraints annotated within the class. My custom validator checks only for the existence of one of the 2 fields: filename or hours. The question I have is, how do I have a single annotation @ValidCriteria which validates my special requirement as well as the @NotEmpty fields in the object. I tried adding @Valid in my custom constraint @ValidCriteria, however I get the error '@Valid is not applicable to annotation type'
has title: Java Validation - Adding @Valid constraint to custom constraint throws "@Valid is not applicable to annotation type"
tagged with: annotations
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23977270

http://stackoverflow.com/a/23956779
downvote count: 0
type: Answer
has body: ([0-9]{2}:){2}[0-9]{2} will match HH:MM:SS
answers question: http://stackoverflow.com/q/23956734
has comment: http://stackoverflow.com/comment/36905619
score: 3
upvote count: 3

http://stackoverflow.com/comment/36989521
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24001042
has text: Thank you, I want this to be implemented in Java. Sorry I have not mentioned this.
score: 0

http://stackoverflow.com/a/23996492
has comment: http://stackoverflow.com/comment/37002889
type: Answer
accepted answer of: http://stackoverflow.com/q/23996419
answers question: http://stackoverflow.com/q/23996419
upvote count: 2
has comment: http://stackoverflow.com/comment/36991204
has comment: http://stackoverflow.com/comment/36991105
score: 2
has comment: http://stackoverflow.com/comment/36989641
has comment: http://stackoverflow.com/comment/36989202
type: AcceptedAnswer
downvote count: 0
has body: The two gears will not be able to communicate with each other on those ports. Inter-gear communication is blocked on non standard ports, except in special cases with scaled applications. You would have to use port forwarding between the gears for this to work, the same as you do from your local machine.

http://stackoverflow.com/q/24104636
has comment: http://stackoverflow.com/comment/37183227
tagged with: keyevent
has comment: http://stackoverflow.com/comment/37184083
has comment: http://stackoverflow.com/comment/37187903
tagged with: java
tagged with: minimize
tagged with: keyboardfocusmanager
has title: Minimize JFrame faster then screen capture program gets activated
type: Question
has comment: http://stackoverflow.com/comment/37189187
score: 0
has comment: http://stackoverflow.com/comment/37184118
has comment: http://stackoverflow.com/comment/37187760
answer count: 0
tagged with: jframe
type: UnansweredQuestion
has body: I have program which I need to minimize when user presses ANY key. One more thing what needs to happen by pressing any key it to minimize program faster then some screen capture software captures it (suppose he activates only by keyboard). I did first part. It minimizes on every key (including Prt Scr), but when I use Lightshot, it first freezes by Lightshot and when I close it my program is then minimized. Is it possible to minimize it faster than Lighshot (or any other software) gets active? Again, suppose that these software activate only by pressing keyboard (because I can disable manual activation of it). Here it is my test class. public class Test extends JFrame { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Test frame = new Test(); frame.setVisible(true); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); manager.addKeyEventDispatcher(frame.new MyDispatcher(frame)); frame.requestFocus(); } catch (Exception e) { e.printStackTrace(); } } }); } public Test() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); setBounds(100, 100, 450, 300); getContentPane().setLayout(null); } class MyDispatcher implements KeyEventDispatcher { JFrame fr; public MyDispatcher(JFrame f) { this.fr = f; } @Override public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED) { StringSelection selection = new StringSelection(""); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); fr.setState(JFrame.ICONIFIED); } else if (e.getID() == KeyEvent.KEY_RELEASED) { StringSelection selection = new StringSelection(""); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); fr.…

http://stackoverflow.com/a/24035915
type: Answer
has comment: http://stackoverflow.com/comment/37054028
downvote count: 0
has body: If you have tangled objects (i.e. objcts that are not reachable anymore), the garbage collector is allowed to collect them and wipe them out. Note the wording: It is allowed. That means the garbage collector can decide not to collect them. In fact, it is not guaranteed that an object will be garbaged collected at all. The difference between objects managed by a SoftReference or a WeakReference and a removed strong reference is the garbage collection strategy: Softly reachable objects will be collected if there is a need of memory. Weakly reachable objects will be collected at the very first attempt. Otherwise unreachable objects will be collected at the collector's strategy (which might be similar to softly reachable, and is also tunable with some JVM parameters at startup). Still, these are assumptions about the most probable strategy, but a garbage collector might decide in another way. Just a note: Weak and soft references do not make sense when being used in a local scope. They are most probably used in instance fields, and one must always take care of the fact that the referred-to object might already be collected.
score: 3
has comment: http://stackoverflow.com/comment/37053786
answers question: http://stackoverflow.com/q/24035465
accepted answer of: http://stackoverflow.com/q/24035465
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/q/23989099
favorite count: 0
has answer: http://stackoverflow.com/a/23989231
accepted answer: http://stackoverflow.com/a/27037146
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: playframework-2.0
score: 0
tagged with: java
tagged with: eclipse
type: Question
has title: the method render(String) in the type index is not applicable for the arguments in play 2.2.x
has answer: http://stackoverflow.com/a/27037146
answer count: 3
has body: Hi i am new in play framework for java i am following the this tutorial http://www.playframework.com/documentation/2.2.x/JavaTodoList under the heading " Rendering the first page " public static Result tasks() { return ok( views.html.index.render(Task.all(), taskForm) ); } i am using eclipse at the render line eclipse show me the error saying the method render(String) in the type index is not applicable for the arguments (List,Form) as i am a beginner i am following this tutorial to learn play framework i don't know why is this error showing up please help thanks in advance
possible better answer: http://stackoverflow.com/a/23989231
has answer: http://stackoverflow.com/a/24943640

http://stackoverflow.com/comment/37003975
has text: @meliniak - if your using a modern IDE (IntelliJ, NetBeans, Eclipse...) you can set a break point in your code; run a unit test through the IDE and step through. This is vs "just running the app".
comment on: http://stackoverflow.com/q/24008938
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24073313
accepted answer: http://stackoverflow.com/a/24073520
tagged with: java
has title: Confused with Web Services vs Websites (REST, JAX-RS, Servlets, etc)
answer count: 2
tagged with: jax-rs
has body: I'm trying to understand the difference between Web Services and Websites. In college, I learned how to build a website up by writing servlets and JSPs. However, I want to build"websites" using methods that people are using right now. But I'm confused with the term of Web Services / Websites. I was reading on JAX-RS, and it seems that JAX-RS is used for web services, and then I figured out there's a server side and client side. Does it mean that this application was created to communicate with each other using HTTP? An example is chat room that communicates through HTTP port? Then does this have nothing to do with creating website? Does this means that JAX-RS is not used for building websites? I'm being confused over this topic already. Can someone point me to the right direction? Thanks
has answer: http://stackoverflow.com/a/24073520
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24073618
score: 0
has answer: http://stackoverflow.com/a/24073618
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/37136140
comment on: http://stackoverflow.com/q/24063808
type: Comment
has text: what is reason to giving this post negative mark...?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37164849
score: 0
type: Comment
type: QuestionComment
has text: Added the rows I am trying to split, also if I only call input.next() one time, for ignoring first row, `of study` will also be printed for some strange reason. will add the ; in the csv
comment on: http://stackoverflow.com/q/24095516

http://stackoverflow.com/comment/37078635
type: Comment
comment on: http://stackoverflow.com/q/24048907
has text: Does aa count as 2 vowels or just one?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/107380230
type: Comment
has text: I don't understand, where is the blob output?
comment on: http://stackoverflow.com/a/24039187
score: 0
type: AnswerComment

http://stackoverflow.com/a/24082574
has comment: http://stackoverflow.com/comment/37140221
score: 4
has body: A primitive static final field is treated specially. It is inlined as a constant by the compiler. The final executable does not access the field at runtime anymore.
has comment: http://stackoverflow.com/comment/37141166
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24082487
has comment: http://stackoverflow.com/comment/37241393
accepted answer of: http://stackoverflow.com/q/24082487
type: Answer

http://stackoverflow.com/a/23950383
score: 0
type: Answer
has body: if (obj[k+1] != null){ // check for null, not null then .toString() method childBeanObj.setNumCaptureCode(obj[k++].toString()); childBeanObj.setTxtFileName(obj[k++].toString()); childBeanObj.setTxtFileStatus(obj[k++].toString()); childBeanObj.setTxtDocumentCode(obj[k++].toString()); }
answers question: http://stackoverflow.com/q/23947860

http://stackoverflow.com/comment/37134923
type: Comment
type: QuestionComment
has text: no i have no xml example . do you have any idea.. what it can be?
comment on: http://stackoverflow.com/q/24079783
score: 0

http://stackoverflow.com/comment/37084473
score: 0
has text: Maven does not support passing parameters in test cases.
type: Comment
comment on: http://stackoverflow.com/a/23998014
type: AnswerComment

http://stackoverflow.com/a/23956584
answers question: http://stackoverflow.com/q/23955653
upvote count: 0
downvote count: 1
score: -1
has body: addName(sock); function in Server.java had a input.readline() waiting on the client causing the hang...
type: Answer

http://stackoverflow.com/comment/36896701
comment on: http://stackoverflow.com/q/23950068
score: 0
type: Comment
type: QuestionComment
has text: @chrylis I expect that it will be available by default.. from the spring oauth documentation: "TokenEndpoint is used to service requests for access tokens. Default URL: /oauth/token.". am i wrong?

http://stackoverflow.com/q/24011432
type: Question
has comment: http://stackoverflow.com/comment/37008572
answer count: 1
tagged with: awt
tagged with: class
has body: I have a program with a AWT GUI in Java. My problem is that I have a lots of abstract Classes (ActionListener) in this program. Within this abstract classes I need to call attributes from the main-class. So, at the moment I must all needed attributes set as final. That is not nice. My question is how can I call the attributes from the main-class (without set this as final). What's the better code style? For example: public class mainClass { TextField field1 = new TextField(10); (...) Button connect = new Button("Connecting..."); (...) connect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ex) { methodFromTheMainClass(field1.getText()); // How can I call the method methodFromTheMainClass? } }); private void methodFromTheMainClass(String fieldContent) { (...) } } Thanks for help, and sorry for my English. :-/
has comment: http://stackoverflow.com/comment/37008609
score: 0
accepted answer: http://stackoverflow.com/a/24011676
tagged with: abstract
has title: AWT ActionListener as abstract class
has comment: http://stackoverflow.com/comment/37008221
tagged with: final
has comment: http://stackoverflow.com/comment/37008033
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37008359
has comment: http://stackoverflow.com/comment/37009055
tagged with: java
has answer: http://stackoverflow.com/a/24011676
has comment: http://stackoverflow.com/comment/37009117

http://stackoverflow.com/q/24007814
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/37001590
type: Question
has body: I am creating two SharedPreferences file to maintain my sessions in my app. While I create a Logout functionality in the app, the SharedPreferences do not get cleared and when the next user tries to login, he still sees the previous user details or no detials at all. Here are my two files for the SharedPreferences:- StorageHelper.java public class StorageHelper { private static Context myContext = Login.getMyContext(); public static Login myLogin = new Login(); public String deviceId; public static String UserDataFile = "UserData"; SharedPreferences localSettings; SharedPreferences.Editor editor; public StorageHelper(String deviceID) { // TODO Auto-generated constructor stub deviceId = deviceID; } public StorageHelper() { // TODO Auto-generated constructor stub } public void SetDeviceId(String deviceId) { // TODO Auto-generated method stub localSettings = myContext.getSharedPreferences(UserDataFile,0); editor = localSettings.edit(); editor.putString("DeviceId", deviceId); editor.commit(); } public String GetDeviceId() { String deviceId = ""; localSettings = myContext.getSharedPreferences(UserDataFile,0); if (localSettings.contains("DeviceId")) { deviceId = localSettings.getString("DeviceId", "Nothing found"); } return deviceId; } public static Boolean GetRegistrationInformation() { // TODO Auto-generated method stub return true; } public void SetRegistrationInformation(Boolean value) { // TODO Auto-generated method stub localSettings = myContext.getSharedPreferences(UserDataFile,0); editor = localSettings.edit(); editor.putBoolean("Registration", value); editor.commit(); } public void ClearData() { localSettings = myContext.getSharedPreferences(UserDataFile,0); editor = localSettings.edit(); editor.clear(); editor.commit(); } } SessionManagement.java SharedPreferences pref; // Editor for Shared preferences Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "UserDetails…
has title: Entire SharedPreference not getting cleared
tagged with: session
has answer: http://stackoverflow.com/a/24008344
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24008479
has comment: http://stackoverflow.com/comment/37002220
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37002240
has comment: http://stackoverflow.com/comment/37002164
tagged with: java

http://stackoverflow.com/comment/37481892
score: 0
type: Comment
has text: The oracle ones contain the problem with LocateRegistry.getRegistry(). Sadly I don't remember the rest of the sites I investigated
type: AnswerComment
comment on: http://stackoverflow.com/a/24048255

http://stackoverflow.com/comment/37001312
score: 0
type: Comment
has text: You should move `ScrollTableConnector` to the `com.abhiram.app.client` package and then recompile the widgetset. I've updated my answer with info on how to do that.
comment on: http://stackoverflow.com/a/23991306
type: AnswerComment

http://stackoverflow.com/q/23977875
favorite count: 0
tagged with: hash
tagged with: bucket
accepted answer: http://stackoverflow.com/a/23978040
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23978040
has title: How to map a list of items into another list of buckets, given a key for each item?
answer count: 1
has body: I have a list of items, say List&lt;Item&gt; listOfItems and each item has a key, say String cluster_key. I want to cluster all items with the same cluster_key into a bucket, giving me the result List&lt;Bucket&gt; listOfBuckets. The list of buckets starts off empty. Any suggests on how to do this elegantly Java? Perhaps with hashing? I can think of 2 implementations that are less than elegant: brute force, where we traverse the listOfItems, and for each item, traverse the list of buckets until we find a match. If we find a match, add the item to the bucket. Else, . for item in listOfItems { for bucket in listOfBuckets { if item.getKey() equals bucket.getKey() add item to bucket else create new bucket add item to bucket add bucket to listOfBuckets } } sorting, then cluster: . sort listOfItems by their cluster_key; get first item from listOfItems; create a bucket, currentBucket, with key: firstItem.getKey() add first item to bucket for item in listOfItems, starting at the second item { if item.getKey() equals currentBucket.getKey() add item to currentBucket else create new bucket add item to new bucket add new bucket to listOfBuckets set new bucket to currentBucket }
downvote count: 0

http://stackoverflow.com/a/24045087
upvote count: 2
has comment: http://stackoverflow.com/comment/37071964
has comment: http://stackoverflow.com/comment/37071841
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24044912
has body: First of all I would move the check for the escape word into the loop. Secondly the check for the file would have thrown you out of your loop. while (true) { System.out.print("\nWhere would you like to go?\n"); filename = keyboard.nextLine(); if(filename.equals(escapeWord)) { break; } File file = new File(filename); if (!file.exists()) { System.out.println("You can't go that way!"); continue; } Scanner inputFile = new Scanner(file); while (inputFile.hasNext()) { String fileRead = inputFile.nextLine(); System.out.println(fileRead); dayCount += 1; } inputFile.close(); }
type: Answer
has comment: http://stackoverflow.com/comment/37072082

http://stackoverflow.com/comment/37174437
comment on: http://stackoverflow.com/q/24100375
score: 0
has text: What is your SecondaryFragment class?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37489828
has text: We did stop the BTG rule that was causing the btw errors but we are seeing the same error pop up with carts and cartentries even after BTG was disabled, server was restarted and running system updated. Is it possible that our caches have not been cleared even after that?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24242783
type: AnswerComment

http://stackoverflow.com/comment/37074542
score: 0
has text: What encoding is the file in and how are you reading it? Also, put your code in backticks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24033871

http://stackoverflow.com/comment/37160288
comment on: http://stackoverflow.com/a/24092588
has text: Okay, let's forget about child components. Simply replace in the example the line `add(new Button("Button"));` with `setBackground(Color.black);`. We still override the paint method with an empty method. So we have simply a panel without any child components. If we execute the program, we get a black panel, although we instruct the panel to paint nothing. Who paints this black background? Sorry for being "stubborn", but I still haven't understood this whole mechanism.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37162934
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24093722
has text: To me this is hack (based on what I believe you want to do). By declaring it private, the default setting will not display a javadoc description. However, you can change the javadoc settings to display documentation for private fields/methods. If the intention is to disallow the programmer from instantiating the class, then this is the proper way to ensure that.
score: 0

http://stackoverflow.com/comment/37004696
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24009411
has text: @Muel I am prompted for my login credentials but then I get a page not found error when I login. Our git server is hosted using a local GitStack instance (http://gitstack.com/). I edited the question for the error
score: 0

http://stackoverflow.com/q/23987323
has answer: http://stackoverflow.com/a/23987365
has body: For the first time I dealing with Java Annotations. So please pardon me if I m doing anything wrong ! But this class compiled successfully using javac MyFirstAnnotation.java but when I try to run this source code using java TestMyAnnotation it throws an error like this package Annotations; import java.lang.annotation.*; import java.util.*; import java.lang.reflect.*; @Documented @Target(ElementType.METHOD) @Inherited @Retention(RetentionPolicy.RUNTIME) public @interface MyFirstAnnotation { String author() default "Chiranjib Nandy"; int revisionNumber() default 1; String date(); } class MySuperClass { public String showMe() { return "Do Something"; } } class MyAnnotation extends MySuperClass { @Override @MyFirstAnnotation(author="Recmach",revisionNumber=2,date="1st June,2014") public String showMe() { return "Display Something"; } @Deprecated @MyFirstAnnotation(revisionNumber=2,date="2nd June,2014") public void oldMethod() { System.out.println("It is a deprecated method"); } @SuppressWarnings({"unused","deprecation"}) @MyFirstAnnotation(author="Papai",date="1st June,2014") public void myMethod() { int j; oldMethod(); System.out.println("It is defined in my way"); } } class TestMyAnnotation { public static void main(String[] args) throws ClassNotFoundException { Method myMethods[]=Class.forName("Annotations.MyAnnotation").getDeclaredMethods(); for(Method m : myMethods) { Annotation[] annotations=m.getDeclaredAnnotations(); for(Annotation anno : annotations) { if(anno instanceof MyFirstAnnotation) { MyFirstAnnotation myFirstAnnotation = (MyFirstAnnotation) anno; System.out.println("name : "+myFirstAnnotation.author()); System.out.println("name : "+myFirstAnnotation.revisionNumber()); System.out.println("name : "+myFirstAnnotation.date()); } } } } }
has title: How to resolve exception in thread main NoClassDefFoundError in Java?
possible better answer: http://stackoverflow.com/a/23987365
has answer: http://stackoverflow.com/a/23987349
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36963042
has answer: http://stackoverflow.com/a/23987372
accepted answer: http://stackoverflow.com/a/23987372
tagged with: java
tagged with: annotations
type: Question
score: 0
answer count: 3

http://stackoverflow.com/a/23983693
type: Answer
score: 3
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36956328
answers question: http://stackoverflow.com/q/23983655
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23983655
has comment: http://stackoverflow.com/comment/36956299
has body: Just break out of the loop: catch (InterruptedException e) { e.printStackTrace(); System.out.println(threadName + " was Interupted!"); Thread.currrentThread().interrupt(); break; }
has comment: http://stackoverflow.com/comment/36971597

http://stackoverflow.com/comment/36898424
has text: Thanks for the quick reply. Is there a way to achieve what I am heading for or is this simply not possible in Java?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23952694
type: Comment

http://stackoverflow.com/a/24015709
has comment: http://stackoverflow.com/comment/37041848
score: 0
answers question: http://stackoverflow.com/q/24015544
type: Answer
has body: it's rather easy. Build a HashMap or another Basic Class which hold several childs. Do you want to randomize it which question should be choosen? Why dont you create a helperClass which is called (for example Question) which keep an array(list)? class Question { Arraylist&lt;String&gt; questions; //;getter and setter } public ArrayList&lt;Question&gt; getQuestions(){ for (Question c : mQuestions) { ArrayList&lt;String&gt; dummyArray = c.getQuestions(); if (c.size() &gt; 0) { //randomize it, get it out, whateer. } } } But getting back to your Question (and a Solution which is not a good technique doing this). public ArrayList&gt;Questions&gt; getQuestions() { if (question_array_1 != null &amp;&amp; question_array_2 != null) { int qCnt = (questions_array_1.size() &gt; question_array_2.size()) ? question_array_1.size() : question_array_2.size(); for (int i = 0; &lt;= qCnt; i++) { String myQuestion = (Math.random(0,1) == 1) ? question_array_2.getQuestion() : question_array_1.getQuestion(); //or merge it to another arraylist... } } } Another Technique would be storing it directly into a SQLITEDatabase (which i pfefer!). A last but not not least (and maybe not a good technique in your case) is adding all into one with ArrayList&lt;Question&gt; array_list_all = new ArrayList&lt;Question&gt;(); array_list_all.addAll(first_question_array); array_list_all.addAll(second_question_array); Then you can foreach it and get the Question which triggers your level or questionID.

http://stackoverflow.com/comment/37163293
comment on: http://stackoverflow.com/q/24094544
has text: Then my follow-up question would be "what's currently wrong with what you have already", since if you start it up again, it's a blank slate.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37042975
score: 0
type: Comment
type: QuestionComment
has text: This has been resolved, see Masud's answer below.
comment on: http://stackoverflow.com/q/24028869

http://stackoverflow.com/comment/37081267
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24049370
has text: Im not seeing any STARTTLS commands in the debug messages. Probably the debug doesnt say that? Im not sure. Also, im still unable to understand on why one way works without encryption and the other with encryption. Stumbling across the internet doesnt support a theory that attachments over MIME requires an SSL.

http://stackoverflow.com/a/24074771
accepted answer of: http://stackoverflow.com/q/23962769
has body: From what is specified[difference of 4-5 blocks], you may be obtaining the location from networkProvider only. With this gpsTracker code mentioned in the question, there are a few modifications required, instead of using the code as it is: 1. There are 2 if loops which verify the source of location is enabled or not and No 'else': if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("Network", "Network"); if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } // if GPS Enabled get lat/long using GPS Services if (isGPSEnabled) { if (location == null) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("GPS Enabled", "GPS Enabled"); if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } } This means the application is going to do twice the work when you can obtain the location from both sources. Further, the source of location obtained always remains ambiguous. This is good when you just need approximate location which should not be null majorly. If you want to use only this class to obtain location, try structuring the if-else according to requirement and ensuring that its not going to repeat if the location is obtained. Eg. if GPS is on a higher preference, applies in your case, shift that if above and put the network condition with an else like: if (isGPSEnabled) { if (location == null) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("GPS Enabled", "GPS Enabled"); if…
score: 9
has comment: http://stackoverflow.com/comment/37175299
has comment: http://stackoverflow.com/comment/37182951
upvote count: 10
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/23962769
type: Answer

http://stackoverflow.com/q/23964666
favorite count: 0
has comment: http://stackoverflow.com/comment/36921365
has comment: http://stackoverflow.com/comment/36921310
linked to: http://stackoverflow.com/q/2690544
has body: Another common source of confusion is that you do not have to declare the types of arguments. The following is wrong! int hour = 11; int minute = 59; printTime(int hour, int minute); // WRONG! In this case, Java can tell the type of hour and minute by looking at their declarations. It is not necessary to include the type when you pass them as arguments. The correct syntax is printTime(hour, minute) Above is a quote from ThinkJava by Green Tea Press. I'm wondering: Why does the author say "have to" and "not necessary"? I tried this code, and I had compile errors. Is the author incorrect? Should he be saying "can't" and "impossible", respectively? If the author is incorrect, please provide an example illustrating this point? Strong note Not looking at method declaration, but instead looking at method initialization, as in the example or as-in: printTime(int hour, int minute);.
has comment: http://stackoverflow.com/comment/36921328
has answer: http://stackoverflow.com/a/23964749
accepted answer: http://stackoverflow.com/a/23964765
type: Question
tagged with: arguments
possible better answer: http://stackoverflow.com/a/23964790
score: -2
has answer: http://stackoverflow.com/a/23964790
tagged with: declaration
upvote count: 1
has answer: http://stackoverflow.com/a/23964830
has answer: http://stackoverflow.com/a/23964765
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36928379
has comment: http://stackoverflow.com/comment/36921376
answer count: 4
has title: Arguments declared during method invocation?
type: AnsweredQuestion

http://stackoverflow.com/comment/36937065
comment on: http://stackoverflow.com/q/23971980
score: 0
has text: For example, if you want to write a view where All the selected Item's are printed. And you want to user to add the GarbageType data to each selection so you can (at the end) all the selection of Garbage (selected Items and inputted GarbageType's) into a GarbageCan.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37236211
type: AnswerComment
has text: I would just recommend MQ as a trigger (queue processing job requests), and not as a state/lifecycle manager. The batch spec already provides that. You already can have transactional states on your batch steps (Injecting EJBs, decorating with @Transactional, etc.), so adding MQ would be a little overhead.
comment on: http://stackoverflow.com/a/24129552
score: 0
type: Comment

http://stackoverflow.com/a/24056877
accepted answer of: http://stackoverflow.com/q/24056607
has body: Store the results of a query into a table: INSERT INTO table_xyz (an_existing_column) SELECT an_existing_column FROM an_existing_table; Create a table from another table: All Columns: CREATE TABLE table_xyz AS SELECT * FROM an_existing_table WITH NO DATA; Specific Column: CREATE TABLE table_xyz AS SELECT an_existing_column FROM an_existing_table WITH NO DATA;
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37093007
score: 6
type: Answer
answers question: http://stackoverflow.com/q/24056607
has comment: http://stackoverflow.com/comment/37093072
upvote count: 6

rgb
tags question: http://stackoverflow.com/q/24094545
type: Tag
tags question: http://stackoverflow.com/q/24104867
tag name: rgb
tags question: http://stackoverflow.com/q/23999442

http://stackoverflow.com/comment/37052466
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24029037
has text: Yeah! Went through the `timer` and it is so easy. Got want I wanted thanks @Holger

http://stackoverflow.com/a/24083995
has comment: http://stackoverflow.com/comment/37142713
has body: com.example.meetingpointlocator_03Test00.Intro it looks like, there is some kind of spelling mistake by launching intro app, in your manifest file, the activity with package name is com.example.meetingpointlocator_03test00.Intro and in exception the activity with package name is: com.example.meetingpointlocator_03Test00.Intro see the T is capital in exception Test00 and in manifest is test00. hope that solves your problem!
answers question: http://stackoverflow.com/q/24083577
has comment: http://stackoverflow.com/comment/37146302
accepted answer of: http://stackoverflow.com/q/24083577
has comment: http://stackoverflow.com/comment/37143446
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24049964
type: AnsweredQuestion
has body: I'm taking a java class and im having some trouble understanding inheritance. I'm not asking for you guys to do any coding for me but pointing me in the right direction would go a long ways. (wouldn't let me use the homework or schoolwork tags but i wanted to be upfront with what i was asking) Basically i'm writing a banking application with a class called Account that acts as the super constructor for two subclasses called Checking and Savings. It's my understanding that if i instantiate an array of the Account object i can then call the sub-class (which in turn calls the superclass constructor with some minute differences in arguments) and using the new command assign it to some position of the object array. My issue then is accessing certain methods in the subclass. The compiler still sees the object array as Account but i want it to access methods that belong to either the Checking or Savings subclass. My question is would making the Account an abstract class work out better? or would it be possible to declare a method in the Account Class and the subclass' and if i call the Account method would it be able to differentiate between which subclass method to call in turns? I'm trying to avoid using typecasting into the subclass where possible and trying to keep the Account subclass as generic and encapsulated as possible. Any help would be appreciated. I can write pseudocode if you need references but i would rather rather do all the coding on my own.
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24050032
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37080479
tagged with: arrays
tagged with: inheritance
has title: Java- Inheritrance issue. Accessing subclass methods on an object array initially instantiated off the super()
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24050032
has comment: http://stackoverflow.com/comment/37080467
favorite count: 0
has comment: http://stackoverflow.com/comment/37082119
tagged with: subclass
has comment: http://stackoverflow.com/comment/37080526

http://stackoverflow.com/comment/36935808
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23967567
type: Comment
has text: It's inside the `catalina.jar` reside in tomcat lib folder. Read more on [The Apache Tomcat 5.5 Servlet/JSP Container](http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html)

http://stackoverflow.com/q/24095424
answer count: 2
has comment: http://stackoverflow.com/comment/40050440
linked to: http://stackoverflow.com/q/19602727
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/47269565
has answer: http://stackoverflow.com/a/33350473
tagged with: model-view-controller
possible better answer: http://stackoverflow.com/a/47269565
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: javafx
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/33350473
has body: I'm just starting to develop a javafx application, and i'm reading some tutorials. In those tutorials there are no mentions to good practices or propper (standard) ways to structure your app. Even though FXML documents provide a separation of the presentation layer, .fxml and .css files are stored in the same directory as .java files, and since I come from developing using frameworks like django and rails, the lack of a standard structure or layer separation disturbs me. Is there any propper (more MVCish) way to structure a project? or is the one proposed by those tutorials the propper way? thanks for your help, and notice that I'm not implying that that way is not correct. It's only that I'm used to the kind of structure proposed by popular web frameworks, and I would like to work like that with this new app (which is my grade project, btw).
has title: Are there any standard for JavaFX directory/package structure?

http://stackoverflow.com/comment/36970270
comment on: http://stackoverflow.com/a/23990995
type: AnswerComment
has text: worst case `O(n^2)` ? (solution 1)
score: 0
type: Comment

http://stackoverflow.com/comment/36977058
type: AnswerComment
type: Comment
score: 0
has text: @user3698939 If you are interested in the encoding itself, please have a look at the W3C link I've posted.
comment on: http://stackoverflow.com/a/23994187

http://stackoverflow.com/comment/36956823
comment on: http://stackoverflow.com/a/23983453
type: Comment
has text: Inside `remove()`. As I said before. And I think it would be ideal to *not* think of this problem as unique ID only, because if you assume unique ID you lose flexibility. What happens if OP wants to remove by name in addition to ID? Then you have to use a different solution anyways.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37168582
type: Comment
type: QuestionComment
score: 0
has text: But this method signature contains generic wild card. Was this code refactored?
comment on: http://stackoverflow.com/q/24097251

http://stackoverflow.com/a/24034363
type: Answer
has body: Instead of comparing firstDate against secondDate, compare secondDate against firstDate: retVal = secondDate.compareTo(firstDate); And don't forget to return retVal instead of 0 ;)
answers question: http://stackoverflow.com/q/24034253
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/37181231
comment on: http://stackoverflow.com/q/24103660
score: 0
type: QuestionComment
has text: you sure it return false, cause it return true on mine
type: Comment

http://stackoverflow.com/q/24016266
has comment: http://stackoverflow.com/comment/39368699
has comment: http://stackoverflow.com/comment/39178000
has comment: http://stackoverflow.com/comment/37020090
answer count: 3
upvote count: 1
has body: I have two projects in eclipse foo and bar. bar is included as part of foo using the build path configuration in eclipse. This allows me to access all of the Java files i need from bar inside of foo. However, I also have some PDF help documents which are contained inside of bar. These files are contained within a help/ directory. When I try to access the files like this, help/file.pdf, it works in bar, but not foo. How can I access these PDF files in foo? Q&amp;A How are files accessed? Files are accessed by searching the class path for a resource. (i.e. getClassLoader().getResource(path))
accepted answer: http://stackoverflow.com/a/25167438
possible better answer: http://stackoverflow.com/a/25164994
has comment: http://stackoverflow.com/comment/39178343
tagged with: java
has comment: http://stackoverflow.com/comment/39177824
has answer: http://stackoverflow.com/a/25164994
tagged with: eclipse
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25166422
type: Question
has answer: http://stackoverflow.com/a/25167438
score: 1
has title: Access PDF file from another project

vaadin
tags question: http://stackoverflow.com/q/24063475
tags question: http://stackoverflow.com/q/23957265
tags question: http://stackoverflow.com/q/24097723
tags question: http://stackoverflow.com/q/23976811
tag name: vaadin
tags question: http://stackoverflow.com/q/24010006
tags question: http://stackoverflow.com/q/24012682
type: Tag
tags question: http://stackoverflow.com/q/24077178
tags question: http://stackoverflow.com/q/24081409
tags question: http://stackoverflow.com/q/23967353
tags question: http://stackoverflow.com/q/23996709
tags question: http://stackoverflow.com/q/24062383
tags question: http://stackoverflow.com/q/24065778
tags question: http://stackoverflow.com/q/24039476
tags question: http://stackoverflow.com/q/24061089
tags question: http://stackoverflow.com/q/24037248
tags question: http://stackoverflow.com/q/24041557

http://stackoverflow.com/comment/37205784
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24104517
has text: @DavidDossot Sorry, i updated my Question :)
score: 0

http://stackoverflow.com/q/24047738
type: UnansweredQuestion
tagged with: architecture
has body: I understand that a properties file cannot be modified inside a war ( I cannot write to it) . my war is essentially a java wrapper to make rest calls . so essentially , I make a POST call to the app , the app does its magic makes a few calls to different services and returns the data to me in a particular format . I am using apikey authentication to communicate with the application . I now want now design a private rest call to update some of these parameters incase we need to change the apikey at a later time . so essentially the app will read everything off an properties file . I now understand that I cannot write to a properties file when it is packaged in a war and am in quite a pickle . I cannot use a database because I am not sure which env it will be deployed to and I need it to be self contained . Any help on how I can get over this problem will be greatly appreciated .
tagged with: war
tagged with: properties
tagged with: java
has title: Modifying a properties file inside a war
type: Question
linked to: http://stackoverflow.com/q/2031248
has comment: http://stackoverflow.com/comment/37077048
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24116819

http://stackoverflow.com/a/24058377
score: -1
answers question: http://stackoverflow.com/q/24058255
downvote count: 1
type: Answer
upvote count: 0
has body: Use a Comparator in the TreeMap constructor. And String.CASE_INSENSITIVE_ORDER.

http://stackoverflow.com/comment/36995734
score: 0
type: Comment
type: AnswerComment
has text: Could you please explain. A bit more about this ?
comment on: http://stackoverflow.com/a/23981638

http://stackoverflow.com/q/23978952
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23986840
answer count: 2
tagged with: automation
has comment: http://stackoverflow.com/comment/36948959
has title: Verify a link in Selenium WebDriver?
score: 0
possible better answer: http://stackoverflow.com/a/23994400
has answer: http://stackoverflow.com/a/23994400
has answer: http://stackoverflow.com/a/23986840
has body: I'm having a web link which directs to the "/login.html" page. How can I verify whether the link works properly. I already have this : WebDriver driver = new FirefoxDriver(); driver.get("www.something.com/login.html"); String mesg = "Login Page"; Assert.assertEquals(mesg, driver.getTitle()); but I want a proper way to verify.

http://stackoverflow.com/q/24026734
tagged with: java
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24026787
favorite count: 0
tagged with: android-asynctask
linked to: http://stackoverflow.com/q/9447646
tagged with: android
duplicate of: http://stackoverflow.com/q/9447646
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24026769
upvote count: 1
has title: Using variable from AsyncTask in main code
has answer: http://stackoverflow.com/a/24026787
type: Question
has body: What I want I'm determining whether or not a user is in my database. To do that, I look at the JSON response from my webpage. This is determined in the inner-class HasUser which extends AsyncTask&lt;String, Void, String&gt;. It's a running a background process to find the user. I want to get the result of that back in my main method. So the background process should look for the user, and then a boolean back in my main method should be true if the user was found. What I've done I have added a method to the HasUser class called hasUser() which returns whether or not the user was found (as a boolean). The class has an instance variable called found which is assigned in the onPostExecute method. So in my main method, I execute the background process, then assign the boolean value of whether or not the user was found to be hasUser.hasUser(). It's like this: private class HasUser extends AsyncTask&lt;String, Void, String&gt; { boolean found = false; String user; public HasUser(String user) { this.user = user; } @Override protected String doInBackground(String... params) { String result = ""; // return the JSON string response from webpage } @Override protected void onPostExecute(String result) { try { // JSON stuff if (/*success == 0*/) { // user not found found = false; } else { // found user found = true; } } catch(JSONException e) { // handle exception } } public boolean hasUser() { return found; } @Override protected void onPreExecute() { } @Override protected void onProgressUpdate(Void... values) { } } And then in my main method, I attempt to get the appropriate result: public void logIn() { HasUser hasUser = new HasUser("username"); hasUser.execute(); boolean found = hasUser.hasUser(); } Problem Even when the user is correctly found (verified by toasting the success message), the found variable in logIn() will always be false because it is assigned before the background process is complete. Is there any way I can make sure the background process is complete before …
possible better answer: http://stackoverflow.com/a/24026769

http://stackoverflow.com/comment/36943623
has text: The problem is not in your code, so copy-pasting it won't help. If you are launching Jetty from Eclipse, then the problem is most likely in the launch configuration. (I'm not familiar with that plugin ...)
comment on: http://stackoverflow.com/a/23976851
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36912833
comment on: http://stackoverflow.com/q/23959495
score: 0
type: Comment
type: QuestionComment
has text: It's hard to say without knowing how you update your state. It sounds like you might have a classic game loop, if you don't that's okay. Can you provide more details? How do you go about updating your game's state, like positions and time spent on current animation and such? How is your drawing being done, is it just a custom JComponent with paintComponent overridden which draws whatever your game state object depicts, or are you using a BufferStrategy in a loop?

http://stackoverflow.com/q/24074749
has answer: http://stackoverflow.com/a/47432579
type: Question
has answer: http://stackoverflow.com/a/51093364
accepted answer: http://stackoverflow.com/a/24086178
has answer: http://stackoverflow.com/a/40668788
has answer: http://stackoverflow.com/a/49994268
tagged with: spring-boot
has answer: http://stackoverflow.com/a/54858773
has answer: http://stackoverflow.com/a/50160158
has answer: http://stackoverflow.com/a/70108055
has answer: http://stackoverflow.com/a/32095553
linked to: http://stackoverflow.com/q/20854585
has answer: http://stackoverflow.com/a/25340415
linked to: http://stackoverflow.com/q/33022827
has answer: http://stackoverflow.com/a/43511600
has answer: http://stackoverflow.com/a/45571291
has answer: http://stackoverflow.com/a/44190020
has answer: http://stackoverflow.com/a/28950546
has answer: http://stackoverflow.com/a/34921106
has answer: http://stackoverflow.com/a/48663055
has answer: http://stackoverflow.com/a/24087111
has comment: http://stackoverflow.com/comment/37129545
possible better answer: http://stackoverflow.com/a/25340415
upvote count: 242
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/49915992
has answer: http://stackoverflow.com/a/46321962
has title: Spring Boot - Cannot determine embedded database driver class for database type NONE
has answer: http://stackoverflow.com/a/53441352
favorite count: 0
linked to: http://stackoverflow.com/q/28042426
has answer: http://stackoverflow.com/a/43043020
has answer: http://stackoverflow.com/a/24086178
has answer: http://stackoverflow.com/a/38806026
linked to: http://stackoverflow.com/q/15359784
has answer: http://stackoverflow.com/a/51372713
has answer: http://stackoverflow.com/a/33451297
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/39314301
has answer: http://stackoverflow.com/a/54132859
has answer: http://stackoverflow.com/a/69222355
has answer: http://stackoverflow.com/a/33085173
has answer: http://stackoverflow.com/a/32720979
has answer: http://stackoverflow.com/a/30875876
has answer: http://stackoverflow.com/a/34918484
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39606774
answer count: 36
score: 242
tagged with: java
has answer: http://stackoverflow.com/a/75629252
tagged with: spring-data
has answer: http://stackoverflow.com/a/27814926
has comment: http://stackoverflow.com/comment/37127106
has answer: http://stackoverflow.com/a/44826982
has body: This is the error that is thrown when trying to run my web app: [INFO] WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource()] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath.: [INFO] org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. [INFO] at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:91) [INFO] at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource(DataSourceAutoConfiguration.java:100) [INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delega…
has comment: http://stackoverflow.com/comment/70013734
has answer: http://stackoverflow.com/a/50696222

http://stackoverflow.com/comment/36927903
has text: Hirak, I updated to org.slf4j:slf4j-api:jar:1.7.7, ch.qos.logback:logback-classic:jar:1.0.13, ch.qos.logback:logback-core:jar:1.1.2, and also updated slf4j-log4j12-1.7.7 (I added this (1.7.1) after posting the question). Running the code yields exactly the same error.
score: 0
comment on: http://stackoverflow.com/q/23966074
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/92168719
score: 0
type: Comment
has text: .getRoot() should not be there in the first line
type: AnswerComment
comment on: http://stackoverflow.com/a/23974350

http://stackoverflow.com/comment/37013813
score: 0
comment on: http://stackoverflow.com/a/24009629
type: AnswerComment
has text: You need to check setting in every onCreate() method and set content view after that only
type: Comment

http://stackoverflow.com/comment/37109654
comment on: http://stackoverflow.com/a/24054273
type: Comment
score: 1
has text: After resetting the java and netbean on my computer your code has worked well on my computer. Thanks great man.
type: AnswerComment

http://stackoverflow.com/comment/37127652
comment on: http://stackoverflow.com/a/24075129
type: AnswerComment
has text: Then you should accept the answer which helped you most and come back later! And be sure to register! ;)
score: 0
type: Comment

http://stackoverflow.com/a/23980192
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23973284
type: Answer
answers question: http://stackoverflow.com/q/23973284
has body: Your snippets don't show how the commits are created / in which state the repository is. Though, one is for sure: setting the system property user.dir like in your last snippet is useless, it is not evaluated by JGit. The following is not quite the answer but a working example of how git log can be limited to a specific file in a folder. Running the code with a recent version of JGit succeeds. public class LogLearningTest { @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); private Git git; private File file; @Test public void testCountNumberOfCommitsOnFile() throws Exception { writeFile( "initial content" ); commitAll( "Create file in folder" ); commitAll( "Unrelated commit" ); writeFile( "changed content" ); commitAll( "Change file in folder" ); git.commit().setMessage( "Other commit" ).call(); Iterable&lt;RevCommit&gt; logs = git.log().addPath( "folder/file" ).call(); int count = 0; for( RevCommit revCommit : logs ) { count++; } assertEquals( 2, count ); } @Before public void setUp() throws GitAPIException { git = Git.init().setDirectory( tempFolder.getRoot() ).call(); File folder = new File( git.getRepository().getWorkTree(), "folder" ); folder.mkdir(); file = new File( folder, "file" ); } @After public void tearDown() { git.getRepository().close(); } private void writeFile( String content ) throws IOException { FileOutputStream outputStream = new FileOutputStream( file ); outputStream.write( content.getBytes( "UTF-8" ) ); outputStream.close(); } private void commitAll( String message ) throws GitAPIException { git.add().addFilepattern( "." ).call(); git.commit().setMessage( message ).call(); } }
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36950554

string
tags question: http://stackoverflow.com/q/23973561
tags question: http://stackoverflow.com/q/24032554
tags question: http://stackoverflow.com/q/24086968
tags question: http://stackoverflow.com/q/24087459
tags question: http://stackoverflow.com/q/24084693
tags question: http://stackoverflow.com/q/24052595
tags question: http://stackoverflow.com/q/23945973
tags question: http://stackoverflow.com/q/24007818
tags question: http://stackoverflow.com/q/24024888
tags question: http://stackoverflow.com/q/23947012
tags question: http://stackoverflow.com/q/23962504
tags question: http://stackoverflow.com/q/23999582
tags question: http://stackoverflow.com/q/24008657
tags question: http://stackoverflow.com/q/24000813
tags question: http://stackoverflow.com/q/23989201
tags question: http://stackoverflow.com/q/23976309
tags question: http://stackoverflow.com/q/24036458
tags question: http://stackoverflow.com/q/24054132
tags question: http://stackoverflow.com/q/23999900
tags question: http://stackoverflow.com/q/24055345
tags question: http://stackoverflow.com/q/24051701
tags question: http://stackoverflow.com/q/23953553
tags question: http://stackoverflow.com/q/24099456
tags question: http://stackoverflow.com/q/24095516
tags question: http://stackoverflow.com/q/24073573
tags question: http://stackoverflow.com/q/23949440
tags question: http://stackoverflow.com/q/24051152
tags question: http://stackoverflow.com/q/24068472
tags question: http://stackoverflow.com/q/23960479
tags question: http://stackoverflow.com/q/24030551
tags question: http://stackoverflow.com/q/24002910
tags question: http://stackoverflow.com/q/24042347
tags question: http://stackoverflow.com/q/24020461
tags question: http://stackoverflow.com/q/23966149
tags question: http://stackoverflow.com/q/23967654
tag name: string
tags question: http://stackoverflow.com/q/23951020
tags question: http://stackoverflow.com/q/24015314
tags question: http://stackoverflow.com/q/24048559
tags question: http://stackoverflow.com/q/24053587
tags question: http://stackoverflow.com/q/24030489
tags question: http://stackoverflow.com/q/23945586
tags question: http://stackoverflow.com/q/24042516
tags question: http://stackoverflow.com/q/24021228
tags question: http://stackoverflow.com/q/24063471
tags question: http://stackoverflow.com/q/23971589
tags question: http://stackoverflow.com/q/23988594
tags question: http://stackoverflow.com/q/24069733
tags question: http://stackoverflow.com/q/23975640
tags question: http://stackoverflow.com/q/24073546
type: Tag
tags question: http://stackoverflow.com/q/24098617
tags question: http://stackoverflow.com/q/23948419
tags question: http://stackoverflow.com/q/24081618
tags question: http://stackoverflow.com/q/24056577
tags question: http://stackoverflow.com/q/24021344
tags question: http://stackoverflow.com/q/23958624
tags question: http://stackoverflow.com/q/24053394
tags question: http://stackoverflow.com/q/24059266
tags question: http://stackoverflow.com/q/24085257
tags question: http://stackoverflow.com/q/23981287
tags question: http://stackoverflow.com/q/24074485
tags question: http://stackoverflow.com/q/24090357
tags question: http://stackoverflow.com/q/23982134
tags question: http://stackoverflow.com/q/23964633
tags question: http://stackoverflow.com/q/24067702
tags question: http://stackoverflow.com/q/23996609
tags question: http://stackoverflow.com/q/23944422
tags question: http://stackoverflow.com/q/24093449
tags question: http://stackoverflow.com/q/24066462
tags question: http://stackoverflow.com/q/24001150
tags question: http://stackoverflow.com/q/24074798
tags question: http://stackoverflow.com/q/24025302
tags question: http://stackoverflow.com/q/24008946
tags question: http://stackoverflow.com/q/24079134
tags question: http://stackoverflow.com/q/24055502
tags question: http://stackoverflow.com/q/24023310
tags question: http://stackoverflow.com/q/23999575
tags question: http://stackoverflow.com/q/24044665
tags question: http://stackoverflow.com/q/24002752

http://stackoverflow.com/comment/37149383
comment on: http://stackoverflow.com/q/24083697
score: 0
has text: @Jens okey, if a user type 144, the result is still 144. leading zeros are removed and i need them so as i can convert the nuber back to string, get substring fro index[2-5] e.g 0001, convert the number back to maybe integer and still get 0001, and square the number. thats what i expect sir
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36889794
score: 0
type: QuestionComment
has text: Hey, no please, wait a momment, as i said before, i am new on java. and i am using this code to understand better the funcionality, so i can develop my own. in fact, i left the copyrigth intentionally.
type: Comment
comment on: http://stackoverflow.com/q/23947921

forms
tags question: http://stackoverflow.com/q/24011386
type: Tag
tags question: http://stackoverflow.com/q/23971980
tags question: http://stackoverflow.com/q/24026792
tags question: http://stackoverflow.com/q/24103393
tags question: http://stackoverflow.com/q/24032380
tags question: http://stackoverflow.com/q/24083457
tag name: forms

http://stackoverflow.com/q/24054517
type: Question
tagged with: jpa
answer count: 1
tagged with: database
downvote count: 0
has comment: http://stackoverflow.com/comment/37088791
favorite count: 0
has title: Is there a way to migrate JPA table names with Hibernate?
has comment: http://stackoverflow.com/comment/37088556
upvote count: 2
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24054567
has body: I have JPA table annotations and I would like to change some table names to follow a specific naming convention. The problem is that those tables are already in production. I don't like the idea of manually creating a new table and inserting the data because I have no idea how to deal with id's and associations. What is the best way to approach this problem? Edit: I am using hibernate.hbm2ddl.auto=update.
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/37088581

http://stackoverflow.com/comment/36887315
type: QuestionComment
has text: @zbz.lvlv is your julianDate is off by thousand years??? I got the same as today julian date today based from your code..
score: 0
comment on: http://stackoverflow.com/q/23946424
type: Comment

http://stackoverflow.com/comment/36926507
score: 0
type: Comment
type: QuestionComment
has text: Memory setup seems fine. When we install an Eclipse Birt webviewer on a fresh Tomcat, Tomcat still starts very fastly so the problem is probably not related to JARs themselves. May be there is a conflict due to the fact you put them in a shared library, you could try to move all birt jars in WEB-INF/lib folder of the webapp which makes use of the birt runtime.
comment on: http://stackoverflow.com/q/23955703

http://stackoverflow.com/comment/37181668
score: 0
type: Comment
has text: "Make a function in all of your elements of the group that is returning a Rectangle." i can't find a way how to do that, all i can add to the group is an object of a type Image, for e.g, in my game i have a class called Paddle, this one is supposed to be a group Actor but i can't add an instance of it so i was forced to create a method that return an image and then add it to the group. thank you
comment on: http://stackoverflow.com/a/24103549
type: AnswerComment

http://stackoverflow.com/a/24025133
accepted answer of: http://stackoverflow.com/q/24024574
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24024574
type: Answer
has body: Try implementing onInterceptTouchEvent(MotionEvent event) and passing whatever functionality you need to onTouchEvent. Source.

http://stackoverflow.com/a/24090783
type: Answer
answers question: http://stackoverflow.com/q/24090637
has body: Let ReportGUI implement ActionListener. Then you will implement actionPerformed for the button click. On button click, create the second frame (if it doesn't exist). Finally, set the second frame visible (if it is currently not visible): import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class ReportGUI extends JFrame implements ActionListener { private static final long serialVersionUID = 8679886300517958494L; private JButton button; private ViewCourseGUI frame2 = null; public ReportGUI() { //frame1 stuff setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(300,200); setLayout(new FlowLayout()); //create button button = new JButton("Open other frame"); button.addActionListener(this); add(button); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ReportGUI frame = new ReportGUI(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == button) { if (frame2 == null) frame2 = new ViewCourseGUI(); if (!frame2.isVisible()) frame2.setVisible(true); } } } This is a simple example. You'll have to add the rest of your code here.
score: 0

http://stackoverflow.com/q/24066487
has title: can't findViewById inside AsyncTask
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24066619
score: 0
upvote count: 1
tagged with: android-intent
downvote count: 1
type: Question
has body: Can't findViewById inside AsyncTask inside ArrayAdapter costum listAdapter inside SherlockListFragment inside FragmentPagerAdapter. !!! OK here is the scenario: I have a fragment like this: public class Fragment_Conversation_Section extends SherlockListFragment { View myFragmentView; public Fragment_Conversation_Section() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ListAdapter listAdapter = new Adapter_ConversationFragmentAdapter(getActivity(), R.layout.items_conversation,myFragmentView); setListAdapter(listAdapter); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { myFragmentView = inflater.inflate(R.layout.fragment_conversation, container, false); return myFragmentView; } } I created myFragmentView variable to pass it to my custom ListAdapter. ListAdapter listAdapter = new Adapter_ConversationFragmentAdapter(getActivity(), R.layout.items_conversation,myFragmentView); Now this is inside my custom ListAdapter public class Adapter_ConversationFragmentAdapter extends ArrayAdapter&lt;Array_Object_Chat_Interface&gt; { Context context; int layoutResourceId; int conversationsNo; List&lt;Array_Object_Chat_Interface&gt; conversationsItems; View rootView; public Adapter_ConversationFragmentAdapter(Context context, int layoutResourceId,View myView) { super(context, layoutResourceId); this.layoutResourceId = layoutResourceId; this.context = context; this.rootView = myView; this.conversationsNo = 0; conversationsItems = new ArrayList&lt;Array_Object_Chat_Interface&gt;(); ArrayList&lt;String&gt; fName = new ArrayList&lt;String&gt;(); AsyncTask&lt;Void, Integer, String&gt; getConversationsTask = new AsyncTask&lt;Void, Integer, String&gt;(){ private ProgressBar pb; @Override protected String doInBackground(Void... params) { //doing some http request stuff in background } @Override protected void onPostExecute(String result) { Log.d("result.&gt;&gt;&gt;", result); }…
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/24066619
answer count: 2
possible better answer: http://stackoverflow.com/a/24066525
has answer: http://stackoverflow.com/a/24066525
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/37111076
tagged with: android

buttonclick
type: Tag
tag name: buttonclick
tags question: http://stackoverflow.com/q/24082184

http://stackoverflow.com/a/24061043
downvote count: 0
type: Answer
has body: I think that we can argue that there is no global keyword in java but your example can be treated like a global. In most languages where you can define a global variable the problem is that they pollute the global namespace and name clashes can occur (like in php). In this regard there are no globals in java since there is no global namespace: variables are always in a class. So the main thing is: there is no explicit globan in java and there is no globan namespace in java. This frees you from name clashes and accidental overwrites which is a good thing. But there is nothing stopping you from creating a Global class with a lot of public static fields in it. Please note that most guys (including me) would break both of your hands for doing so. :)
answers question: http://stackoverflow.com/q/24060921
score: 3
has comment: http://stackoverflow.com/comment/37101495
upvote count: 3

http://stackoverflow.com/q/24070959
has comment: http://stackoverflow.com/comment/37119296
downvote count: 0
has body: Sorry but I'm not able to phrase this question properly without an example. Say oneMethod has such a signature: void oneMethod(String... strings); I call oneMethod by void callOneMethod(int numStrings) { oneMethod("s" + 0, "s" + 1, ..., "s" + (numStrings - 1)); } How should I write my callOneMethod? Also, I very much appreciate it if anyone can help rephrase this question better :)
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7607353
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24071089
accepted answer: http://stackoverflow.com/a/24071089
type: Question
answer count: 1
has title: Using unspecified number of arguments in another method
upvote count: 1
tagged with: method-call
favorite count: 0
has comment: http://stackoverflow.com/comment/37119534

http://stackoverflow.com/a/24056386
type: Answer
answers question: http://stackoverflow.com/q/24055854
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37098193
has body: I think the XPATH 2.0 dependecy is missing in your project. Please check it! XML Schema 1.1 'assertions' and 'type alternatives' require an XPath 2.0 processor for evaluation. For XSD 1.1 assertions, full XPath 2.0 support is required. For XSD 1.1 type alternatives, XML schema engines can provide full XPath 2.0 support or they can implement a smaller XPath 2.0 subset, as defined by the XSD 1.1 language. From: http://xerces.apache.org/xerces2-j/faq-xs.html
upvote count: 1

http://stackoverflow.com/comment/37183227
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24104636
type: Comment
has text: The issue will come down to at what the key strokes are recognized by the programs and when they reach your key handler...

http://stackoverflow.com/q/24053861
tagged with: ant
score: 0
tagged with: junit
has body: I am having a problem trying to run junit tests in ant with forkmode set to anything else but "perTest"(the default) Whenever I am running the tests, right as it is executing the last test(it might actually happen after it is finished, but thats the order the output appears on the screen) it generates the following exception: Exception in thread "main" java.lang.NullPointerException [junit] at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.getHostname(XMLJUnitResultFormatter.java:165) [junit] at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.startTestSuite(XMLJUnitResultFormatter.java:141) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireStartTestSuite(JUnitTestRunner.java:822) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:519) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1165) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:988) [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec [junit] Tests FAILED (crashed) Here is the junit line of my build.xml: &lt;junit fork="yes" forkmode="perBatch" printsummary="yes" haltonerror="false" haltonfailure="false"&gt; I am running ant 1.9, any suggestions on what could be causing this? I should add that this does not happen if I have it set to perTest, but then the tests take forever.
has title: Ant getting nullpointerexception after tests
answer count: 0
has comment: http://stackoverflow.com/comment/37199516
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37088104
tagged with: java
has comment: http://stackoverflow.com/comment/37088009
type: Question
has comment: http://stackoverflow.com/comment/37142004

http://stackoverflow.com/a/23954995
answers question: http://stackoverflow.com/q/23954830
has comment: http://stackoverflow.com/comment/36903246
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36903755
has comment: http://stackoverflow.com/comment/36903702
has comment: http://stackoverflow.com/comment/36903039
has comment: http://stackoverflow.com/comment/36903673
has body: You can put the selected checkboxes into an ArrayList&lt;CheckBox&gt; and onCheckedChangeListener confirm that the checked CheckBox is on the list by using arrayList.contains(checkedCheckbox). If true, uncheck it. If false check for the ArrayList#size(). If it is less than 5, check it. otherwise return ArrayList&lt;CheckBox&gt; checboxes = new ArrayList&lt;CheckBox&gt;(); // The containing class should implement OnCheckedChangeListener checkbox1.setOnCheckedChangeListener(this); checkbox2.setOnCheckedChangeListener(this); checkbox3..... @Override public void onCheckedChange(CompoundButton checkbox, boolean isChecked) { if(checkboxes.contains(checkbox)) { checkbox.setChecked(false); checkboxes.remove(checkbox); } else { if(checkboxes.size() &lt; 5) { checkbox.setChecked(true); checkboxes.add(checkbox); } else { checkbox.setChecked(false); } } } EDIT: your problem is here, this is not how you implement an interface Veg.setOnCheckedChangeListener(this); { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub String checkboxes; CheckBox checkbox; if (checkboxes.contains((CharSequence) checkbox)) { ((CompoundButton) checkbox).setChecked(false); checkboxes.remove(checkbox); } else { if (checkboxes.size() &lt; 5) { checkbox.setChecked(true); checkboxes.add(checkbox); } else { checkbox.setChecked(false); } } } }); The right way to do it is: @Override public void onCreate(Bundle savedInstanceState) { // Here goes your onCreate's code and the checkbox reference etc... // DO NOT set a single listener for each checkbox, instead pass "this" // Also, you don't need to use `setOnClickListener` Veg.setOnCheckedChangeListener(this); Nonveg.setOnCheckedChangeListener(this); } @Override public void onCheckedChangeListener(CompoundButton checkbox, boolean isChecked) { // Here define your logic, possibly put a similar implementation from my original answer. // if you NEED to implement distinct logic for each checkbox, d…
has comment: http://stackoverflow.com/comment/36903360

http://stackoverflow.com/a/24008030
score: 3
answers question: http://stackoverflow.com/q/24007891
has comment: http://stackoverflow.com/comment/37002221
has comment: http://stackoverflow.com/comment/37002415
downvote count: 0
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/37001897
has comment: http://stackoverflow.com/comment/37002191
has body: public class Tester { public static double lowbase(double v) { return Math.pow(10, Math.floor(Math.log10(Math.abs(v)))); } public static void main(String [] args){ System.out.println(lowbase(0.12)); System.out.println(lowbase(0.00351)); System.out.println(lowbase(0)); System.out.println(lowbase(-1)); } } Gives: 0.1 0.001 0.0 1.0 The abs is for handling the negative numbers, you may fiddle with that for a different take on negatives.

http://stackoverflow.com/comment/36950793
type: Comment
score: 1
type: QuestionComment
has text: Post all code that you are asking your question about here, in your question on SO. Don't post links. Links go stale, and if you want people to help you don't want to send them over the internet to find your problem.
comment on: http://stackoverflow.com/q/23980923

http://stackoverflow.com/comment/37009477
score: 0
comment on: http://stackoverflow.com/q/24012047
type: Comment
type: QuestionComment
has text: About the Java part: the JVM pre-allocates `Integer` objects (not `int` primitives) for some range (I think 0-100), so that when you create 2 `Integer` objects for e.g. the value `1`, they reference to the same actual Object. see http://stackoverflow.com/questions/3131136/integers-caching-in-java Maybe he was referring to this...

http://stackoverflow.com/a/23968850
accepted answer of: http://stackoverflow.com/q/23962359
type: AcceptedAnswer
has body: Idea behind the Thread pool is that create a specified number of threads at start and then assign task to them. Alternatively removing headache of creating threads each time. I was implemented it a little some days ago, here is what I done. Create some threads at start they share a request queue Threads are constantly looking for queue and when a request come one of the thread dispatch the request and perform action The Queue will be synchronized 3. Here are some queue methods Queue#add(); //add the socket at the end Queue#removeFront();//remove socket Queue#isEmpty();//boolean if queue is empty Queue#size(); //return size of queue Queue#getMaxSize();//get maximum allowed size for queue Your Request processing runnable public class Processor implements Runnable { private Queue<Socket> requests; private boolean shut; Processor(Queue<Socket> requests) { this.requests = requests; shut = false; } @Override public void run() { while(!shut) { if(requests.isEmpty()) { try{ Thread.sleep(#rendomeTimemill); } catch(InterruptedException e){} }else { Socket skt = Queue.removeFront(); try { //System.out.println("processing request from " + socket.getInetAddress().getHostName()); //do you want } catch (Exception e) { } finally { if(skt != null) { try{ skt.close(); skt = null; } catch(IOException ex){} } } } } } public void stopNow() { shut = true; Thread.interrupt(); } } in your main thread create a queue to put requests //start your server socket Queue<Socket> requests = new Queue<Socket>(); Start worker thread pool Precessor []workers = new Processor[NUM_WORKER]; for(int i=0;i<NUM_WORKER; i++) { worker[i] = new Processor(requests); Thread th = new Thread(worker[i]); th.strat(); } in request listening //while loope that run forever // accept socket if(requests.size() == requests.getMaxSize()) { socket.getOutputStream().write("HTTP/1.0 505 Error\n\n".getBytes()); socket.getOutputStream().write(" Try again \n\n".getBytes()); socket.close(); } else { requests.add(socket); } when yo…
answers question: http://stackoverflow.com/q/23962359
has comment: http://stackoverflow.com/comment/37019556
has comment: http://stackoverflow.com/comment/37188581
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/36941993
score: 0
comment on: http://stackoverflow.com/a/23976160
type: AnswerComment
has text: Didnt work same problem i think the problem is how i scroll my background or character or something
type: Comment

http://stackoverflow.com/q/24010282
possible better answer: http://stackoverflow.com/a/71379128
type: AnsweredQuestion
tagged with: spring-boot
downvote count: 0
has answer: http://stackoverflow.com/a/71379128
tagged with: java
has comment: http://stackoverflow.com/comment/38331587
tagged with: gradle
score: 46
type: Question
has comment: http://stackoverflow.com/comment/37009124
has answer: http://stackoverflow.com/a/38733329
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/55521569
has title: IntelliJ does not terminate Spring Boot applications build with gradle
has body: I am using IntelliJ 13.1 on Linux and try to build a basic REST application following the example http://spring.io/guides/gs/spring-boot/ When I execute the target bootRun from within IntelliJ the intergrated tomcat server is started and everything works fine. 10:09:35: Executing external task 'bootRun'... :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :findMainClass :bootRun But stopping the execution does not affect the gradle task: 10:11:40: External task execution finished 'bootRun'. I still can access the tomcat instance on the configured port. Only closing IntelliJ will destroy the process. I searched on this topic but could not find any reasonable answers. I wonder if it is a gradle problem (using gradle wrapper version 1.11) Linux problem (Ubuntu 12.04) IntelliJ problem (IDEA 13.1.2) Spring Boot problem (tried different versions from 1.0.0.RELEASE to 1.1.0.M2)
has comment: http://stackoverflow.com/comment/37008930
answer count: 4
upvote count: 46
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/24011649
accepted answer: http://stackoverflow.com/a/24011649

http://stackoverflow.com/q/23941202
tagged with: drawing2d
has body: I'm stuck trying to convert an array of points which represent a drawing(simple 2D black lines) taken from a mobile phone. I pass that array of points to a server which then emails that drawing to another person. I can't find a way to convert that array of points to an image, png, or something else. And then upload it to an static server so I can insert it in an email and send to the other person. I'm looking something like canvas on android but on the serverside so I can output an image. Preferably Java, but at this point I would take anything. An ex of the array of points: { "drawing_objects": [ [ { "x": 177, "y": 246 }, { "x": 177, "y": 246 }, { "x": 177, "y": 246 } ], [ { "x": 870, "y": 298 }, { "x": 866.5316, "y": 302.62445 } ] ] } These are two lines, in a drawing, the first with 3 point, the second one with 2.
has comment: http://stackoverflow.com/comment/36876731
has answer: http://stackoverflow.com/a/23942632
answer count: 1
favorite count: 0
has title: Array of points to image
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36876778
accepted answer: http://stackoverflow.com/a/23942632
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36876963
downvote count: 1
type: Question
tagged with: canvas

http://stackoverflow.com/comment/36973814
comment on: http://stackoverflow.com/q/23993169
has text: yes it does mean checkData + " - " + text +" - " + "min"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23974584
answers question: http://stackoverflow.com/q/23974517
has body: AuditingHandlerBeanDefinitionParser is in another package in spring-data-commons-1.6.0.RELEASE: org.springframework.data.config.AuditingHandlerBeanDefinitionParser. So, where this class is used is being used with the incorrect package.
accepted answer of: http://stackoverflow.com/q/23974517
score: 0
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/37007507
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24010920
score: 0
has text: http://tutorials.jenkov.com/java-reflection/dynamic-class-loading-reloading.html gives a lot of good examples of how to load classes dynamically.

http://stackoverflow.com/q/24058030
downvote count: 0
tagged with: selenium
has comment: http://stackoverflow.com/comment/37116423
tagged with: webdriver
type: Question
score: 3
tagged with: internet-explorer
tagged with: java
has title: Webdriver - IE Flickering while taking the screenshot
upvote count: 3
has answer: http://stackoverflow.com/a/24139829
accepted answer: http://stackoverflow.com/a/24139829
has comment: http://stackoverflow.com/comment/37101094
answer count: 1
has body: I have a problem of Flickering while taking the screenshot in IE, i have searched all over the internet and found no solution for this issue. I have found this alternate solution for taking the screenshots for the test steps. I have not used the webdriver API to take the screenshot but instead relied on Java Robot API to take the screenshot. I have used the following code for taking the screenshots in IE without any flickering. public static boolean TakeScreenshot(String filePath){ boolean b = false; try { BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); b = ImageIO.write(image, "png", new File(filePath)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return b; } is there any solution to the webdriver API for this flickering issue in Internet Explorer?
favorite count: 0
has comment: http://stackoverflow.com/comment/37211584
tagged with: selenium-webdriver
type: AnsweredQuestion

http://stackoverflow.com/comment/36883373
comment on: http://stackoverflow.com/q/23944514
type: QuestionComment
has text: And the topic is set up on JBoss EAP 5.2.0
score: 0
type: Comment

http://stackoverflow.com/q/24052012
type: Question
tagged with: filenotfoundexception
score: 0
answer count: 1
has title: I'm getting a FileNotFoundException while trying to httpcon.getInputStream(). Is there a way to easily check if it's a 404 webpage?
tagged with: exception
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37083895
has body: So in part of my code I'm trying to access a web page, and in the circumstance that the webpage doesn't exist (which I'm testing) I get a FileNotFoundException. at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) I really just want to be able to check if it doesn't exists, and if it doesn't I wouldn't bother with the getInputStream or BufferedReader or whatever. Is there a simple IF clause that would satisfy this? oracle = new URL(scholarURL); HttpURLConnection httpcon = (HttpURLConnection) oracle.openConnection(); httpcon.addRequestProperty("User-Agent", "Mozilla/4.76"); BufferedReader in = new BufferedReader(new InputStreamReader(httpcon.getInputStream()));
tagged with: java
has answer: http://stackoverflow.com/a/24052149

http://stackoverflow.com/comment/37136458
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24080710
has text: Unary operators have higher [precedence](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html)
score: 0

http://stackoverflow.com/comment/36966396
type: QuestionComment
has text: Now I know it's wrong. But there is no example how to get ID when using intent to add event. There is an example using ContentValues, but no with intents. When using intent http://developer.android.com/guide/topics/providers/calendar-provider.html#intent-edit the id is set eventId=208 :/ but how to get it they do not mention. Is this possible to get the ID when using intents to add event?
comment on: http://stackoverflow.com/q/23988266
score: 0
type: Comment

http://stackoverflow.com/q/24101799
tagged with: arraylist
has answer: http://stackoverflow.com/a/24101815
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24102128
has answer: http://stackoverflow.com/a/24102128
accepted answer: http://stackoverflow.com/a/24101815
tagged with: swing
has body: This is my FileIOManagement class that I want to handle all of the reading from text files etc that grabs data to display in the GUI. This is the code for my current FileIOManagement class: package swinging; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Scanner; public class FileIOManagement { private ArrayList&lt;String&gt; nameList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; courseList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; semesterList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; moderatorList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; programList = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; majorList = new ArrayList&lt;String&gt;(); public FileIOManagement(){ readTextFile(); } private void readTextFile(){ try{ Scanner scan = new Scanner(new File("Course.txt")); while(scan.hasNextLine()){ String line = scan.nextLine(); String[] tokens = line.split("~"); String course = tokens[0].trim(); String examiner = tokens[1].trim(); String moderator = tokens[2].trim(); String semester = tokens[3].trim(); String program = tokens[4].trim(); String major = tokens[5].trim(); courseList.add(course); semesterList.add(semester); nameList.add(examiner); moderatorList.add(moderator); programList.add(program); majorList.add(major); HashSet hs = new HashSet(); hs.addAll(nameList); nameList.clear(); nameList.addAll(hs); Collections.sort(nameList); } scan.close(); } catch (FileNotFoundException e){ e.printStackTrace(); } } } This is the class I need the ArrayList data passed to. As you can see I am attempting to populate comboBox1 and comboBox2 with data I am attempting to get via ArrayList: package swinging; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.border.EmptyBorder; public class Repor…
type: Question
tagged with: java
score: 0
answer count: 2
has title: Passing data from ArrayList in back end to JComboBox GUI front end - Java Swing

http://stackoverflow.com/comment/36967721
type: QuestionComment
comment on: http://stackoverflow.com/q/23989924
score: 1
has text: Shouldn't `ss-MMM-yyyy HH:mm:sss` be `dd-MMM-yyyy HH:mm:ss`?
type: Comment

http://stackoverflow.com/a/60437428
answers question: http://stackoverflow.com/q/24078820
has body: For me the reason was not bad Maven configuration. I was simply giving a parameter with wrong name when generating the report.
score: 0
type: Answer

http://stackoverflow.com/comment/37192118
score: 0
type: AnswerComment
has text: Good call, overlook on my part. You should accept your awnser.
type: Comment
comment on: http://stackoverflow.com/a/24108866

http://stackoverflow.com/comment/37145673
comment on: http://stackoverflow.com/q/24080272
score: 0
type: Comment
type: QuestionComment
has text: First you need to convert mouse screen coords to world tile coords. Plenty of resources out there tell you how. Then just do your thing when a user clicks -> check tile -> run code.

http://stackoverflow.com/q/24021606
accepted answer: http://stackoverflow.com/a/24582515
answer count: 2
tagged with: jpa
downvote count: 0
has body: How do I create a map property that has both key column and a map key as parts of PK of the detail class? Like this: &lt;class entity-name="Person" &gt; &lt;id name="id"/&gt; &lt;property name="birthDate" type="date"/&gt; &lt;map name="names"&gt; &lt;key column="personId"/&gt; &lt;map-key type="string" column="code"/&gt; &lt;one-to-many class="PersonName" /&gt; &lt;/map&gt; &lt;/class&gt; &lt;class entity-name="PersonName"&gt; &lt;composite-id&gt; &lt;key-many-to-one name="personId" class="Person"/&gt; &lt;key-property name="code" type="string" length="32"/&gt; &lt;/composite-id&gt; &lt;property name="lastName" type="string" length="64" index="nameSearch"/&gt; &lt;property name="firstName" type="string" length="64" index="nameSearch"/&gt; &lt;property name="middleName" type="string" length="64" index="nameSearch"/&gt; &lt;property name="isActual" type="boolean"/&gt; &lt;/class&gt; I need to avoid creating a surrogate key in PersonName class that would require a special handling. Json shown below should be automatically persisted in the DB, inserting and updating detail record when necessary, based on PersonId-code key. It's natural that "code" property identifies the row together with the person Id. I tried different combinations of "inverse", "not-null" etc. I admit that I don't fully get how it works. I get different error messages, like: ERROR: null value in "person" column violates NOT NULL constraint Details: Erroreous row contains (null, null, lastname, ffffirst, null, null). or: org.hibernate.MappingException: Repeated column in mapping for entity: PersonName column: person (should be mapped with insert="false" update="false") It should look like this, if represented as json: { "birthDate": "33-44-55", "names": { "mainName": { "lastName": "lastname", "firstName": "ffffirst" }, "maidenName": { "lastName": "lastname1", "firstName": "ffffirst2" }, "old": { "lastName": "lastname3", "firstName": "ffffirst4" } } } UPD (clarification of question) Actually this is a …
favorite count: 0
has answer: http://stackoverflow.com/a/24510261
tagged with: hibernate-mapping
possible better answer: http://stackoverflow.com/a/24510261
has answer: http://stackoverflow.com/a/24582515
tagged with: orm
has comment: http://stackoverflow.com/comment/38032373
type: AnsweredQuestion
has title: Both key column and map-key are PK
tagged with: java
tagged with: hibernate
score: 4
type: Question
upvote count: 4

http://stackoverflow.com/comment/36926031
type: AnswerComment
comment on: http://stackoverflow.com/a/23964787
has text: How To impliment This Method??
score: 0
type: Comment

http://stackoverflow.com/a/23998793
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23993942
has body: add the below code in your <s:iterator value="something"> </s:iterator> Prev Next In Your Struts.xml div_ajax_result.jsp div_ajax_result.jsp <s:iterator value="something"> </s:iterator> Prev Next in each time ajax calling you need to load different result in list. I hope now you have get a basic idea in ajax.

http://stackoverflow.com/comment/37009932
score: 0
comment on: http://stackoverflow.com/q/24011142
type: Comment
type: QuestionComment
has text: I did not modify anything! Your codes works as is for (it prints the various json fields)

http://stackoverflow.com/comment/37083936
comment on: http://stackoverflow.com/a/24051726
type: AnswerComment
has text: @Payeli I am asking him to think of 'is a' relationship.
type: Comment
score: 0

http://stackoverflow.com/q/23951999
has comment: http://stackoverflow.com/comment/36897937
has comment: http://stackoverflow.com/comment/36910557
tagged with: java
has title: how to store reference of 2d array in a 1d array in java?
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23952076
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23952215
tagged with: multidimensional-array
type: UnansweredQuestion
has body: I have a collection of 2d arrays for representing graph. i want to store this collection in a array so that each element of that 1d array points to corresponding 2D array.M using java

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/23977848
type: Tag

http://stackoverflow.com/a/24073952
has comment: http://stackoverflow.com/comment/37124353
has comment: http://stackoverflow.com/comment/37124368
has body: You're reading the contents of the file on quitButton if (source == quitButton) { try { fis = new FileInputStream("userfile.txt"); ois = new ObjectInputStream(fis); ois.readObject(); ois.close(); } catch (IOException | ClassNotFoundException ev) { ev.printStackTrace(); } System.exit(0); } instead of writing... You could try something more like... if (source == quitButton) { try (ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("userfile.txt"))) { os.writeObject(users); } catch (IOException exp) { exp.printStackTrace(); } System.exit(0); } instead... To read the contents back in, you simply need to do something like... try (ObjectInputStream is = new ObjectInputStream(new FileInputStream("userfile.txt"))) { users = (ArrayList&lt;User&gt;) is.readObject(); } catch (IOException exp) { exp.printStackTrace(); } Now, because the JTextArea now needs to be updated in two places, I created a simple method... protected void updateList() { for (User object : users) { S.append(object + "\n"); } String text = S.toString(); data.setText(text); } Which simply updates the JTextArea with the current contents of the User list. This I added to the load code... try (ObjectInputStream is = new ObjectInputStream(new FileInputStream("userfile.txt"))) { users = (ArrayList&lt;User&gt;) is.readObject(); updateList(); } catch (IOException exp) { exp.printStackTrace(); } Which I placed at the end of your classes constructor (so that the UI was initialised first) As Braj keeps mentioning, this code comes from your actionPerformed method (after the two if statements), which means it really is in the wrong place. The only time you want to execute this code is when the list has changed, for example... public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == submitButton) { name = realname.getText(); uname = username.getText(); getPassword(); for (int i = 0; i &lt; users.size(); i++) { System.out.println(users.get(i).toString()); } updateList(); }…
has comment: http://stackoverflow.com/comment/37124361
answers question: http://stackoverflow.com/q/24073871
downvote count: 0
has comment: http://stackoverflow.com/comment/37124417
type: Answer
has comment: http://stackoverflow.com/comment/37149048
upvote count: 1
score: 1

apache-poi
tags question: http://stackoverflow.com/q/23978299
tags question: http://stackoverflow.com/q/24033788
tags question: http://stackoverflow.com/q/23949288
type: Tag
tag name: apache-poi
tags question: http://stackoverflow.com/q/24029904
tags question: http://stackoverflow.com/q/24035230
tags question: http://stackoverflow.com/q/24057120
tags question: http://stackoverflow.com/q/24057886
tags question: http://stackoverflow.com/q/24085366
tags question: http://stackoverflow.com/q/24040997

http://stackoverflow.com/comment/37126391
type: Comment
has text: All the connections are closed properly after being opened
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24074973

http://stackoverflow.com/q/24049285
has comment: http://stackoverflow.com/comment/37079545
has body: I am getting a NullPointerException on line 40 of this code. Below is the Google example of implementation of the new ad-mob ad service, which takes effect by august this year. This code is literally cut and pasted from thier documentation, yet I am getting the exception and can't resolve it. Here is the class: package com.example.com.stringtheory.newadmobtest; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.LinearLayout; /** * A simple {@link Activity} that embeds an AdView. */ public class MainActivity extends Activity { /** The view to show the ad. */ private AdView adView; /* Your ad unit id. Replace with your actual ad unit id. */ private static final String AD_UNIT_ID = "ca-app-pub-6817177749834558/8445203226"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create an ad. adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); // Add the AdView to the view hierarchy. The view will have no size // until the ad is loaded. LinearLayout layout = (LinearLayout) findViewById(R.id.linear); if (layout == null) { Log.w("", "LinearLayout is null"); } layout.addView(adView); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a physical device. AdRequest adRequest = new AdRequest.Builder() .build(); // Start loading the ad in the background. adView.loadAd(adRequest); } @Override public void onResume() { super.onResume(); if (adView != null) { adView.resume(); } } @Override public void onPause() { if (adView != null) { adView.pause(); } super.onPause(); } /** Called before the activity is destroyed. */ @Override public void onDestroy() { // Destroy the AdView. if (adView != null)…
tagged with: admob
type: Question
has answer: http://stackoverflow.com/a/24049648
has title: LinearLayout NullPointerException in Eclipse
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/37079762
answer count: 1
has comment: http://stackoverflow.com/comment/37079305
has comment: http://stackoverflow.com/comment/37079369
type: UnansweredQuestion
tagged with: java

serversocket
tags question: http://stackoverflow.com/q/24062569
tags question: http://stackoverflow.com/q/24041876
tags question: http://stackoverflow.com/q/24003992
tags question: http://stackoverflow.com/q/23967236
type: Tag
tag name: serversocket
tags question: http://stackoverflow.com/q/23979149

http://stackoverflow.com/comment/37123289
score: 1
comment on: http://stackoverflow.com/q/24073254
has text: @EdwinTorres: my apologies, you are right: He is in fact shooting himself in the foot with his own Rectangle constructor.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24070779
has title: Is there a model change listener mechanism in android
answer count: 2
score: 2
downvote count: 0
has body: I am designing a android user interface for a sports app. One of the features of the app is that the text of buttons and menu items changes as the game state progresses. So you go from setup game -> start first half -> half time -> second half -> game over etc. The buttons and the menu item text change to indicate the next valid actions in the app. Now so far I am doing that by watching a global var of the state and basically checking this in the various onCreate, onResume methods. at least for the buttons anyway. Not sure about menu items and how to make them dynamic. Now I figure there must be a better way to do this in android ? In swing you might have a modelchangelistener and you could register as a listener of that in your view. Does something similar exist in android ? Also I know in Java you can do the Observer pattern but I was looking for something built into android. I imagine this scenario is fairly common. But if there is not then NO YOU HAVE TO DO IT YOURSELF is an acceptable response to my question too. Thanks in advance. Frank.
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24071215
has answer: http://stackoverflow.com/a/24071546
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/24071215
possible better answer: http://stackoverflow.com/a/24071546
type: Question
tagged with: java

http://stackoverflow.com/q/24028676
tagged with: java
type: Question
upvote count: 2
tagged with: html-entities
answer count: 1
has body: i need to get the text from jtextpane with as is format what am giving as input in set text private void test() { myFrame = new JFrame("JEditorPane Unicode Test"); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); myFrame.setSize(300,200); myPane = new JEditorPane(); myPane.setContentType("text/html;charset=utf-8"); myPane.setText( "Hello computer! - 电脑你好！ " + "Welcome to Herong's Website! " + "欢迎你访问和荣网站" + "！ www.herongyang.com பாரதீய ஜனதா இளைஞர் அணி தலைவர் அனுராக்சிங் தாகூர் எம்.பி. நேற்று தேர்தல் ஆணையர் வி.சம்பத்தை"); myFrame.setContentPane(myPane); String test = myPane.getText(); try { JOptionPane.showMessageDialog(null, "myPane.gettext --> "+myPane.getText()); System.out.println("myPane.getText() -->"+myPane.getText()); } catch (Exception ex) { Logger.getLogger(JEditorPaneUnicode.class.getName()).log(Level.SEVERE, null, ex); } @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } } But my output for get text is like below myPane.getText() → Hello computer! - 电脑你好！ Welcome to Herong's Website! 欢迎你访问和荣网站！ www.herongyang.com பாரதீய ஜனதா இளைஞர் அணி தலைவர் அனுராக்சிங் தாகூர் எம்.பி. நேற்று தேர்தல் ஆணையர் வி.சம்பத்தை my expected output is Hello computer! - 电脑你好！ Welcome to Herong's Website! 欢迎你访问和荣网站！ www.herongyang.com பாரதீய ஜனதா இளைஞர் அணி தலைவர் அனுராக்சிங் தாகூர் எம்.பி. நேற்று தேர்தல் ஆணையர் வி.சம்பத்தை
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/37040786
score: 2
has comment: http://stackoverflow.com/comment/37040764
tagged with: jeditorpane
downvote count: 0
has answer: http://stackoverflow.com/a/24262323
accepted answer: http://stackoverflow.com/a/24262323
has title: How to get proper Unicode string (no &#enties;) from a JEditorPane?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37040821

http://stackoverflow.com/a/24000003
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23998044
answers question: http://stackoverflow.com/q/23998044
upvote count: 3
score: 3
has body: I am not sure of the exact reason, but may be, the error is caused because the Label on the Button is also calling the same method. Have you tried using onAction="#starClick" instead of onMouseClicked="#starClick"

http://stackoverflow.com/comment/37127834
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24074358
type: Comment
has text: if you mean a single instance from a memory standpoint its not possible, but for the contents of the class, you could use Redis to share the content between VM's, this is a in-memory solution which is super fast

http://stackoverflow.com/comment/40198211
type: Comment
comment on: http://stackoverflow.com/q/23981982
has text: When I say _last constructor call_, I mean the last `this()` invocation in constructor chaining. You would have something like `cons1 -> cons2 -> instance initializers -> cons3` assuming `cons1` called `this(..)` referring to `cons2` and `cons2` called `this(..)` referring to `cons3`.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23990373
type: Answer
answers question: http://stackoverflow.com/q/23990317
downvote count: 0
score: 1
upvote count: 1
has body: You need to build an executable jar file. A double-click on this will normally simply kick off the program, provided you have a Java runtime installed. Note for this solution you will have to package all third party libraries into your jar, such that you have one file. But generally it's the simplest solution. An alternative is to make the program available via Java web start. In this scenario you can click on a hyperlink, and your installed JRE will download your program and all packaged libraries, and launch that locally. The advantage is that your program updates will be identified and downloaded each time someone runs your program. The downside is that you have to host the Web Start files yourself.

http://stackoverflow.com/comment/37077090
comment on: http://stackoverflow.com/a/24047398
score: 0
type: AnswerComment
has text: No. with that class you need to make the request from an AsyncTask or a thread that is not running on the UI Thread. To understand how to use it you can browse that project on github and you will see some classes with an inner AsyncTask using the methods. @GCTheLegend - I have a empty constructor just because I wanted to.
type: Comment

http://stackoverflow.com/comment/37127096
has text: That seems like a viable solution
type: AnswerComment
comment on: http://stackoverflow.com/a/24074639
type: Comment
score: 0

http://stackoverflow.com/comment/37091619
comment on: http://stackoverflow.com/a/24055871
type: AnswerComment
score: 0
type: Comment
has text: Not really sure how to do that xD, the fact of the matter is that I do not know a lot of Java coding. Tried tutorials and stuff before, hands-on works more for me so its a learn as I go process. Would you mind showing how to do that?

http://stackoverflow.com/comment/37094568
type: Comment
type: QuestionComment
has text: @ratchetfreak you're right - I just assumed the varags method was `first, rest...` rather than `delim, data...`. Good spot!
score: 0
comment on: http://stackoverflow.com/q/24053499

http://stackoverflow.com/comment/37087737
comment on: http://stackoverflow.com/a/24052766
type: AnswerComment
score: 0
type: Comment
has text: it means overall conclusion is that if I close the ObjectInputStream or ObjectOutputStream then my httpRequest.getInputStream() or httpResponse.getOutputStream() respectively are also closed.So, you want to say that it is better to remain them open and later it is automatically close by the container. Am I right ?

http://stackoverflow.com/comment/37059840
comment on: http://stackoverflow.com/q/24039017
has text: There are lots of ways, from opening a socket to sharing data storage at a database.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/47178271
score: 0
has text: Thanks! I have the identical problem, only that I have it happen in a jar I'm producing. so, I prefer to exclude `javax.servlet` once from the dependencies coming with my artifact, instead of manually excluding it from all my other modules which depend on it. Did you by any chance find a way to that?
type: Comment
comment on: http://stackoverflow.com/a/26232535
type: AnswerComment

http://stackoverflow.com/comment/37094573
comment on: http://stackoverflow.com/q/24009149
score: 0
has text: Just to clear any doubts: Android expects the shorts from -amplitude to +amplitude (like in your code sample). The bytes are the same thing but in LE order (for PCM 16bits).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23974467
upvote count: 5
answers question: http://stackoverflow.com/q/23973362
downvote count: 0
type: Answer
has body: Background I found out the answer to my own question. It was never a problem with any of the actual database handling. It turns out, when I was passing the id to be used as the foreign id in hashtags and references, I was getting my id from a counter in the main class; where every new tweet had a number that went with each hashtag and reference for that tweet that would later be used as a foreign key. That foreign key would reference the primary key in the tweets table, which auto increments. Here was the problem: It turns out that MySQL is NOT zero-indexed when you auto-increment; where the first value is zero, then one, then two, etc. Instead, it starts at one. So when I tried to reference the primary key with the foreign key, the counter that started at zero for every tweet that I assigned (the foreign key) was being incorrectly matched to the auto incrementing tweet id in the tweets table (primary key). Therefore, I was always off by one. I hope this helps anyone that may have a similar issue.
score: 5

http://stackoverflow.com/comment/37071590
comment on: http://stackoverflow.com/q/24045207
score: 3
type: Comment
has text: When you say it doesn't work, are you getting an exception or just a wrong value?
type: QuestionComment

http://stackoverflow.com/a/24000317
type: Answer
has comment: http://stackoverflow.com/comment/37035998
has body: A simple solution without using (explicitly) regex is to split the String using token (in your case it's a white space. line = "wall 100 300 50"; String[] words = line.split("\\s+"); You can then get the words[2] convert to an int etc. Then you can write back to a new file (or the same if you have read all file contents). Regex are more powerful but to me a bit more intimidating so you can pick whatever matches your needs.
answers question: http://stackoverflow.com/q/23999900
upvote count: 1
has comment: http://stackoverflow.com/comment/36988001
downvote count: 0
score: 1

http://stackoverflow.com/a/24081326
type: Answer
has body: Strictly speaking, ++a is not prefix operator in Java, it's unary. And it has less precedence than postfix operator (a++). At general, compiler will execute operators with higher precedence first. So, first postfix operator (in your case a++ is executed first, and additive operator + second.
score: 1
answers question: http://stackoverflow.com/q/24080710
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/26532286
upvote count: 5
has comment: http://stackoverflow.com/comment/42624805
has comment: http://stackoverflow.com/comment/42874056
downvote count: 0
has comment: http://stackoverflow.com/comment/42802690
answers question: http://stackoverflow.com/q/24013082
type: Answer
has body: You'll have to build this functionality yourself, but it's actually pretty easy to accomplish by defining a custom Marker and Tooltip Layout. Start by defining your Tooltip layout. It has to be a RelativeLayout obviously to position the callout image. Set your context to whatever Activity is creating the markers. The TipView at the bottom must be included, because it controls sizing of the custom Tooltip. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:background="@color/white" android:id="@+id/parent_layout" android:padding="5dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" tools:context="com.XXX.MainActivity"&gt; &lt;TextView android:id="@+id/tooltip_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:textSize="18sp" android:maxEms="17" android:layout_gravity="left" android:layout_weight="1" android:text="@string/toolTipTitle"/&gt; &lt;TextView android:id="@+id/tooltip_description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/black" android:textSize="14sp" android:maxEms="17" android:text="@string/toolTipDescription" android:layout_below="@+id/tooltip_title" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/marker_about" android:src="@drawable/ic_action_about" android:layout_toEndOf="@+id/tooltip_description" android:layout_toRightOf="@+id/tooltip_description" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_marginLeft="10dp" /&gt; &lt;com.mapbox.mapboxsdk.views.TipView android:layout_width="132dp" android:layout_height="10dp"/&gt; &lt;/RelativeLayout&gt; Then create a custom Marker class and override the createTooltip method …
has comment: http://stackoverflow.com/comment/42820022
score: 5

http://stackoverflow.com/comment/37111144
score: 0
has text: theres also this possibility http://stackoverflow.com/questions/14043042/compiling-java-7-code-via-maven try the awnsers on that question and see if that helps. (PS: are you guys sharing a maven installation?!)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24066591

http://stackoverflow.com/q/24100604
has comment: http://stackoverflow.com/comment/37174716
has comment: http://stackoverflow.com/comment/37174478
downvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/37174683
has comment: http://stackoverflow.com/comment/37174485
answer count: 2
has comment: http://stackoverflow.com/comment/37174472
upvote count: 0
has comment: http://stackoverflow.com/comment/37174557
accepted answer: http://stackoverflow.com/a/24100632
score: -7
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37174573
has body: Consider the following Java class and another class that overrides its method hello(). class Greeter { public void hello(String name) { System.out.println("Hello "+name+"."); } } class Greeter_mean extends Greeter { public void hello(String name) { System.out.println("You are NOT welcome, "+name+"!"); } } Now I'll create an instance of Greeter_mean but I'll cast it to Greeter. Greeter test = (Greeter)new Greeter_mean(); test.hello("Tomáš"); What will the output be?
has comment: http://stackoverflow.com/comment/37174500
has comment: http://stackoverflow.com/comment/37174474
has title: When I cast object to its supertype do I access the original or overriden methods?
favorite count: 0
has comment: http://stackoverflow.com/comment/37174599
has comment: http://stackoverflow.com/comment/37174518
has answer: http://stackoverflow.com/a/24100632
has comment: http://stackoverflow.com/comment/37174761
has comment: http://stackoverflow.com/comment/37174629
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37174624
possible better answer: http://stackoverflow.com/a/24100641
has comment: http://stackoverflow.com/comment/37174515
tagged with: java
has answer: http://stackoverflow.com/a/24100641

http://stackoverflow.com/a/23950005
type: Answer
accepted answer of: http://stackoverflow.com/q/23949929
answers question: http://stackoverflow.com/q/23949929
has body: It looks like you expect the caller to be passing in a class that is or extends KSoapObjectParseable, so try this (with the necessary try/catch logic): public static &lt;T extends KSoapObjectParseable&gt; T parseObject(SoapObject soapObject, Class&lt;T&gt; clazz) { T obj = clazz.newInstance(); // stuff return obj; } Note also that since you're passing in that SoapObject, it would be better to make this an instance method there if you control that class. Finally, don't ever just swallow exceptions like you're doing here, and don't catch Exception; in fact, most of the time, printing the stack trace isn't even helpful (because the caller will want to log it using the appropriate logging system for the application). Instead, wrap that InstantiationException into an IllegalArgumentException (because they passed in an uninstantiable class) and rethrow.
has comment: http://stackoverflow.com/comment/36894045
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36893723
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/q/23974017
tagged with: sql
favorite count: 0
possible better answer: http://stackoverflow.com/a/23975635
downvote count: 1
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: tcp
tagged with: java
has body: I seem to be running into the error: Cannot open database requested by the login. The login failed. when connecting my SQL Server database to a Java application written in netbeans. I have read numerous articles and done the following: Allowed the 1433 port to the firewall under UDP and TCP Set SQL Server Configuration Manager TCP/IP ports to 1433 Changed the server authentication in SQL Server Management Studio to mixed authentication Allowed remote connections in SQL Server Management Studio My connection string is as follows: jdbc:sqlserver://localhost\\SQLEXPRESS:1433;DatabaseName = SASS; IntegratedSecurity=true; Trusted_Connection=true; and I am still getting the following error: Cannot open database "SASS" requested by the login. The login failed. ClientConnectionId:894b97b9-54d6-47cc-afd7-1473a460c09d After reading for 3 days straight, I am at my wits end.
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24362258
has title: Java SQL Server 2012 Cannot open database error
accepted answer: http://stackoverflow.com/a/24362258
tagged with: sql-server
has answer: http://stackoverflow.com/a/23975635

http://stackoverflow.com/a/24061247
has body: When writing a String to an output stream (bytes), you need to specify the encoding to do the conversion. One way to do is to wrap the output stream in a OutputStreamWriter that will use UTF-8 charset for the encoding. conn.setRequestProperty("content-type", "application/json; charset=utf-8"); Writer writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8")); writer.write(json); writer.close(); The flush() is also optional if you call close(). Another option, as mentionned by peter.petrov is to first convert your String to bytes (in memory) and then output the byte array to your output stream. And to make it obvious on the server side, you can pass the charset used in the content-type header ("content-type", "application/json; charset=utf-8").
upvote count: 7
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24060787
score: 7

http://stackoverflow.com/comment/36900068
has text: Yes, I think the `FactoryPattern` is the best solution, but the OP ask for reflection!, and in some cases, when the posible instances is not know at compile time, this can be the only solution, for example, when you're writing a library.
type: AnswerComment
comment on: http://stackoverflow.com/a/23953811
type: Comment
score: 1

http://stackoverflow.com/comment/48652661
has text: Unfortunately, no. Problem is still there. I'm usually just add new fields manually. You can generate metamodel using Maven or similar method and then copy generated classes to source folder. Also, my colleague recently found another method, which is using hibernate-jpamodelgen.jar. This solution works perfectly in his project, however, in mine I'm getting scary Eclipse-level AspectJ error and nothing I've tried so far solves the problem. But it's worth a try for you, I think :) You need to specify custom annotation processor (which is aforementioned jar is) in your project configuration.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23957295

http://stackoverflow.com/comment/37041079
has text: @user3117081 can you replace \\ by /
type: Comment
comment on: http://stackoverflow.com/q/24028869
score: 0
type: QuestionComment

http://stackoverflow.com/a/23985792
has comment: http://stackoverflow.com/comment/36960421
has comment: http://stackoverflow.com/comment/36960353
has comment: http://stackoverflow.com/comment/36960335
score: 0
has comment: http://stackoverflow.com/comment/36960478
has body: Since you already in a try-catch-block, can't you just throw an exception? public Pollen(int zipcode, final Context context) { this.context = context; this.zipcode = zipcode; Document doc; try { // pass address to Wunderground's website using our inputted zipcode doc = Jsoup.connect("http://www.wunderground.com/DisplayPollen.asp?Zipcode=" + this.zipcode).get(); if(doc.select("div.columns").first().text() == null) { // Oh no! div.colums is empty. Lets throw an exception, which // will prevent the code below from executing. throw new IllegalStateException("div.columns is NULL"); } // get "location" from XML Element location = doc.select("div.columns").first(); this.location = location.text(); // get "pollen type" from XML Element pollenType = doc.select("div.panel h3").first(); this.pollenType = pollenType.text(); SimpleDateFormat format = new SimpleDateFormat("EEE MMMM dd, yyyy"); // add the four items of pollen and dates // to its respective list for(int i = 0; i &lt; 4; i++) { Element dates = doc.select("td.text-center.even-four").get(i); Element levels = doc.select("td.levels").get(i); // Removed nested try-catch block pollenMap.put(format.parse(dates.text()), levels.text()); } } catch (IOException e) { displayToast(context); } catch (ParseException e) { // We catch the ParseException here instead of nesting try-catch blocks. displayToast(context); } catch (IllegalStateException e) { // Catch the IllegalStateException thrown when div.columns was null, // and let the user know what went wrong. displayToast(context); } } private void displayToast(Context context) { ((Activity) context).runOnUiThread(new Runnable() { public void run() { Toast toast = Toast.makeText(context, R.string.toast_parse_fail, Toast.LENGTH_LONG); toast.show(); } }); }
has comment: http://stackoverflow.com/comment/37179433
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23985661
answers question: http://stackoverflow.com/q/23985661
type: Answer
has comment: http://stackoverflow.com/comment/36960378

http://stackoverflow.com/comment/36931057
type: Comment
has text: I found that ant has a task called depend for your scenario. The problem is that is not very reliable because it can miss some changes that should trigger recompilation. Link http://stackoverflow.com/questions/627868/do-you-use-ants-depend-task
type: AnswerComment
comment on: http://stackoverflow.com/a/23969842
score: 0

http://stackoverflow.com/comment/37171134
comment on: http://stackoverflow.com/q/24076434
has text: I trace my code and find that when a form submitted, i get none unicode form field data in my action
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23942373
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36881139
has body: I have made a tiny android application to attempt to resolve an issue I've been seeing on a different app. I'm trying to achieve an effect where the TextViewstarts off screen, then scrolls on. What I did looks like it's working well on my 4.0.4, but when I use the Android Virtual Device (4.1.2) there is a "flicker" showing the TextView in the original place before the animation starts. I've noticed the same thing on a friend's Tablet (4.4). I uploaded a video to show the issue here. My layout: &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:id="@+id/txtV" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; During my MainActivity's onResume() function I move the TextView off screen for a starting position: @Override protected void onResume(){ super.onResume(); View v = findViewById(R.id.txtV); Animation hideWords = AnimationUtils.loadAnimation(getBaseContext(), R.anim.hidetext); hideWords.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { View v = findViewById(R.id.txtV); int xOffset = (int)(v.getWidth() * .1); RelativeLayout.LayoutParams rlParams = (RelativeLayout.LayoutParams)v.getLayoutParams(); rlParams.setMargins(-1*xOffset, 0, xOffset, 0); v.setLayoutParams(rlParams); } And then there's a Button which just has onClick set to the function animateIt() the source of which is: public void animateIt(View v){ v = findViewById(R.id.txtV); AnimationSet as = new AnimationSet(true); Animation showWords = AnimationUtils.loadAnimation( getBaseContext(), R.anim.texnation); as.addAnimation(showWords); v.startAnimation(as); } The animation just slides the View onscreen: &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" android:duration="700" android:fillAfter="true" android:interpolator="@android:anim/linear_interpolator" &gt; &lt;translate a…
tagged with: android
has title: What is causing this animation flicker and how do I remove it?
tagged with: android-4.0-ice-cream-sandwich
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: animation
upvote count: 1
has comment: http://stackoverflow.com/comment/36880724
tagged with: android-layout
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36881106

http://stackoverflow.com/q/23988745
has comment: http://stackoverflow.com/comment/36982448
has comment: http://stackoverflow.com/comment/36965538
has title: how to import classes not already present in eclipse
has body: I am using eclipse IDE- Android Developer tools Build: v22.6.2- 108550 I have to run the program import org.eclipse.gef4.dot.DotExport; import org.eclipse.gef4.dot.DotImport; import org.eclipse.gef4.graph.Graph; import org.eclipse.gef4.zest.core.widgets.GraphWidget; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class SampleUsage { public static void main(String[] args) { Shell shell = new Shell(); Graph graph = new DotImport( "digraph{ " + "node[label=zested]; edge[style=dashed]; " + "1-&gt;2; 2-&gt;3; 2-&gt;4; 3-&gt;5; 4-&gt;6 " +"}").newGraphInstance(); open(graph, shell); System.out.println(new DotExport(graph).toDotString()); } private static void open(Graph graph, final Shell shell) { new GraphWidget(graph, shell, SWT.NONE); shell.setText(Graph.class.getSimpleName()); shell.setLayout(new FillLayout()); shell.setSize(600, 300); shell.open(); Display display = shell.getDisplay(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose(); } } but all the import commands above public class SampleUsage has error or we can say red bulbs with them means these packages are not already present the error is The import org.eclipse cannot be resolved. How can I import these packages to my IDE to run this program? If you could tell me the location of these packages as well, that would be great.
has answer: http://stackoverflow.com/a/24007387
has comment: http://stackoverflow.com/comment/36966074
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24007030
tagged with: eclipse
answer count: 2

http://stackoverflow.com/comment/37146767
score: 0
has text: I don't think that's the case. When I don't send any char, but only receive data from the Arduino, it gets displayed alright on the screen. It's only when I send data that I get the crash.
type: Comment
comment on: http://stackoverflow.com/a/24085960
type: AnswerComment

http://stackoverflow.com/comment/36940879
type: Comment
has text: Maybe you should be using `<` instead of `<=`.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23975665

http://stackoverflow.com/a/23988418
has comment: http://stackoverflow.com/comment/80284256
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/80281832
type: Answer
accepted answer of: http://stackoverflow.com/q/23957409
has body: Based on @JoseM comment, this link helped. A quick fix I applied for now was to downgrade my guava lib from 16.0.1 to 14.0.1.
answers question: http://stackoverflow.com/q/23957409
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/80257499
has comment: http://stackoverflow.com/comment/74126043

http://stackoverflow.com/comment/36930898
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23969842
type: Comment
has text: The problem is that you don't have outdated files. Everything is shiny new to the compiler (All timestamps are newer). To collaborate with it you must obey to its meaning of outdated. It's that really hard to add a script that only copies the modified files? If you do it, you can rebuild the project easy. Example: generateTool -generate && copyScript && cd ../compileDirectory && mvn install. copyScript should compare files content and copy only if they are changed.

http://stackoverflow.com/comment/70877672
type: Comment
has text: Answers should contain the solution, not just a link to a blog that may go missing in the future. Especially when that blog post is just a link to another site, discussing the solution given to you in an earlier comment!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25590474

http://stackoverflow.com/comment/36974135
type: QuestionComment
comment on: http://stackoverflow.com/q/23989616
score: 0
has text: @trashgod I need docked panels inside my docked TopComponents. AFAIK we can't nest TopComponents (hence the name) so I needed another tool (and Docking Frames seems perfect). It might look confusing, but that's what the users want.
type: Comment

http://stackoverflow.com/comment/37105056
type: QuestionComment
comment on: http://stackoverflow.com/q/24063471
has text: It's best if you try it yourself first and ask stackoverflow users what is wrong with your code rather than asking for a complete answer from scratch
score: 1
type: Comment

http://stackoverflow.com/comment/37043171
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24029867
score: 0
has text: @Makoto Then if I can only use the tree for a specific type, either int or String without using Compare I could have used just`int element` and not use `CompareTo` method.What's the purpose of using Comparable.Also can you please tell me where I should use the generic.Because I am not familiar with it

http://stackoverflow.com/comment/37019969
has text: I don't think that ASP Classic is obsolete, but... You need generate some charts, right? Why don't you use one based on JavaScript, like Google Charts? I Use this with ASP and it works great. Please, take a look here: https://developers.google.com/chart/interactive/docs/gallery
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24010377

http://stackoverflow.com/q/24055159
tagged with: groovy
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/10187344
favorite count: 0
type: UnansweredQuestion
has body: I'm pretty new in groovy, trying to encode a URL in my first piece of groovy code. Here is a section of my code： import java.net.URLEncoder String url = baseUrl + URLEncoder.encode(parameter); It looks quite the same as many examples I check online but it throws error as below. General error during canonicalization: Importing [java.net.URLEncoder] is not allowed java.lang.SecurityException: Importing [java.net.URLEncoder] is not allowed I have also tried to use the class directly as illustrated here String url = baseUrl + java.net.URLEncoder.encode(parameter); and another version: String url = baseUrl + URLEncoder.encode(parameter); both throw me error: General error during canonicalization: Indirect import checks prevents usage of expression java.lang.SecurityException: Indirect import checks prevents usage of expression appreciate if any guru can help clear the doubts.
score: 3
tagged with: urlencode
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24055286
has title: Unable to import java.net.URLEncoder in groovy
has comment: http://stackoverflow.com/comment/37090658
has comment: http://stackoverflow.com/comment/37104143

http://stackoverflow.com/a/25985941
answers question: http://stackoverflow.com/q/23993706
has body: The user can't change his own password if he can't login. If his password is expired you have to reset it as an administrator and then log him in with that password and force him to change it immediately.
score: 0
has comment: http://stackoverflow.com/comment/47600242
type: Answer

http://stackoverflow.com/q/23958792
has comment: http://stackoverflow.com/comment/36910422
has comment: http://stackoverflow.com/comment/36910504
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23959280
type: Question
has comment: http://stackoverflow.com/comment/36910446
has comment: http://stackoverflow.com/comment/36910343
has comment: http://stackoverflow.com/comment/36910305
has comment: http://stackoverflow.com/comment/36910282
answer count: 1
has title: Use sharedPreferences to add values to a string
has body: My goal is to save a value to a string, and then store the string to sharedPreferences. Moreover, every time the app generates a new value, I would like to add this string to the string array, which would increase the length of the string array by 1 every time the app is used. I have spent 200+ hours trying to make this work, but I still can't get it to work properly. This is what I have so far: public class MainActivity extends Activity { Set set = new HashSet(); set.add(EnterText.mynumber); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences sharedPreferences = getSharedPreferences(days,Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putStringSet("strings", set); Boolean flag = editor.commit(); SharedPreferences prefs = getSharedPreferences("MyPrefs",Activity.MODE_PRIVATE); Set set=new HashSet(); set=prefs.getStringSet("strings", null); } } If anyone knows the right method to do this, or how I can fix this code to make it work, I would greatly appreciate it. Thanks for your help
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36910373

http://stackoverflow.com/q/24016163
has answer: http://stackoverflow.com/a/24016622
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37016977
score: 1
tagged with: java
has body: I am having some trouble understanding where to place a properties file in a java project. I have the following project structure . src. | java | test.properties | a.java Parameters.properties I have the following code to read the properties file . Properties prop = new Properties(); try { InputStream in = this.getClass().getResourceAsStream("Parameters.properties"); // load a properties file prop.load(in); // get the property value and print it out System.out.println(prop.getProperty("hello.world")); } catch (IOException ex) { ex.printStackTrace(); System.out.println("The code has failed here"); } my properties file has the following line hello.world=Hello World I keep getting a null pointer error which leads me to believe it is not able to read the file because it has not got the file yet .
has title: Placing a properties file in a java project
linked to: http://stackoverflow.com/q/1318347
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37016897
downvote count: 0
has answer: http://stackoverflow.com/a/24016361
has comment: http://stackoverflow.com/comment/37017203

http://stackoverflow.com/q/24066123
tagged with: rcp
tagged with: eclipse
tagged with: export
has body: I have an eclipse RCP application which can be exported using the "product export wizard" when I dont select the option to "Bundle JRE for this environment for this product". When I do select the "Bundle JRE for this environment for this product", I get the following error D:\Data\workspace\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:92: The following error occurred while executing this line: D:\Data\workspace\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86.xml:459: D:\Data\workspace\.metadata\.plugins\org.eclipse.pde.core\temp\assemblyLocation\tmp\eclipse\jre\bin does not exist. I am using Eclipse SDK 4.3.1 and tried changing the workspace but I am getting the same problem. Will appreciate some pointers.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37116426
has comment: http://stackoverflow.com/comment/37129474
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has title: Eclipse 4 RCP Product Export JRE Not Found Error
type: Question
tagged with: java

http://stackoverflow.com/a/23967388
answers question: http://stackoverflow.com/q/23961215
score: 0
type: Answer
has body: While your question is confusing, the answer by Bevilaqua seems correct. Joda-Time FYI, here is the same code as written by Bevilaqua but using the Joda-Time library. Joda-Time offers a LocalDate class for when you are certain you want a date only without a time-of-day. ISO 8601 Since your date string is in ISO 8601 format, and Joda-Time handles the ISO 8601 formats by default, no need for parsing. Joda-Time can use its built-in default parsers. String date = "2014-05-03"; LocalDate dateParsed = new LocalDate(date); // Automatically parses ISO 8601 format string. List&lt;String&gt; dateList = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 6; i++) { LocalDate localDate = dateParsed.minusDays( i ); dateList.add( localDate.toString() ); // By default, "toString" generates ISO 8601 format string. }

http://stackoverflow.com/a/23984674
has body: OK based on AntonH's suggestion I added while (paymentSum &lt;=0) instead of what I had originally written at the end while (paymentSum &gt; 0) and it worked. Thanks AntonH! The new working code is: public void InsertMoney() { String soption; productName = " Nothing"; // Vending machine welcome dialog soption = JOptionPane.showInputDialog( "============================================" + "\nWelcome to the College Vending Machine!" + "\n============================================" + "\n\nOptions: i for insert money, s for select item, q for quit." + "\n\n============================================"); switch (soption) { case "q": // user chooses q to quit JOptionPane.showMessageDialog(null, "Have a Nice Day!"); System.exit(0); // terminate application break; case "i": // if user chooses i: insert money; do { spaymentSum = JOptionPane.showInputDialog( "=============================" + "\nPlease enter some money (in pence)" + "\n============================="); // Inserting money paymentSum = Integer.parseInt(spaymentSum); // Parsing for calculations if (paymentSum &lt;= 0) { JOptionPane.showMessageDialog(null,"Must be a positive input! Try again."); } } while (paymentSum &lt;= 0); // ADDED CHANGES HERE break; case "s": // if user chooses s: select item break; } }
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23983230
type: Answer
accepted answer of: http://stackoverflow.com/q/23983230

http://stackoverflow.com/a/35722777
downvote count: 0
has body: the simple way is use @path , example i want get Route from node Soap/Body/BuslocationResponse/Vehicles/Vehicle Response.java @Root(name = "soap:Envelope", strict = false) public class Response { @Element(name = "Route") @Path("Body/BuslocationResponse/Vehicles/Vehicle") private int route; public int getRoute() { return route; } } Main.java class Main { public static void main(String args[]) { String xml = "<soap:Envelope \n" + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" + "soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" + "<soap:Body>\n" + " \n" + " 1.0 \n" + " 0 \n" + " <Input>\n" + " 801 \n" + " N \n" + " \n" + " \n" + " \n" + " 801 \n" + " N \n" + " 09:42 PM \n" + " 5007 \n" + " 801-06 \n" + " -2 \n" + " S \n" + " Y \n" + " N \n" + " N \n" + " Y \n" + " 20.61 \n" + " 3 \n" + " 44916 \n" + " \n" + " 30.221222,-97.765007 \n" + " 30.218363,-97.766747 \n" + " 30.215282,-97.768715 \n" + " 30.212505,-97.770485 \n" + " 30.204943,-97.774765 \n" + " 30.204035,-97.775078 \n" + " \n" + " \n" + " \n" + " \n" + "</soap:Body>\n" + "</soap:Envelope>"; try { Serializer serializer = new Persister(); Response r = serializer.read(Response.class, xml); System.out.println("route: " + r.getRoute()); } catch (Exception e) { e.printStackTrace(); } } } Result: /usr/lib/jvm/java-8-oracle/bin/java.... route: 801 Process finished with exit code 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24102741
score: 2

http://stackoverflow.com/comment/37125218
type: QuestionComment
comment on: http://stackoverflow.com/q/24073676
score: 0
has text: Uninstall the app from your phone and again reinstall.
type: Comment

http://stackoverflow.com/comment/37066055
has text: Yes, reposting is bad. Edit your OP to make it more clear. After reading both, I am still confused on what you are saying.
comment on: http://stackoverflow.com/q/24042368
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36908548
has text: @user3619389 check my edit and make sure you read through it carefully. If status is of type String[] then change your return type to type String[], or similarly for whatever it may be.
comment on: http://stackoverflow.com/a/23957890
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24006040
downvote count: 0
has comment: http://stackoverflow.com/comment/43718912
type: Answer
has body: The short answer is that it's because when using null layout, you are responsible for specifying the exact position and size of all components added. The correct answer is: This is one more reason why you should not use null layout. Period. Use of null layout makes for very inflexible GUI's that while they might look good on one platform look terrible on most other platforms or screen resolutions and that are very difficult to update and maintain. Instead you will want to study and learn the layout managers and then nest JPanels, each using its own layout manager to create pleasing and complex GUI's that look good on all OS's. The layout manager tutorial can be found here: Layout Manager Tutorial Edit Also note that you are adding your JTable to two containers, a JPanel and a JScrollPane. Do not do this. Only add it to the JScrollPane and then add the scrollPane to wherever you wish.
answers question: http://stackoverflow.com/q/24006030
score: 4
has comment: http://stackoverflow.com/comment/43718834
upvote count: 4

http://stackoverflow.com/q/24008697
linked to: http://stackoverflow.com/q/8477677
tagged with: api
upvote count: 1
answer count: 1
has title: Add contact/friend in skype using api in Java
favorite count: 0
has answer: http://stackoverflow.com/a/32642684
type: UnansweredQuestion
tagged with: skype
downvote count: 0
has body: I want to add new contact to a skype account using java with skype api. Is there any java package available to use for the objective? Also if there is any sample code available for it please share the link Thanks in advance
score: 1
tagged with: java
tagged with: skype4java
has comment: http://stackoverflow.com/comment/37004872
type: Question

http://stackoverflow.com/comment/36901097
type: QuestionComment
has text: Note: AlphaNumeric usually means containing any combination of letters or digits and can be only letters or digits.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23954218

http://stackoverflow.com/q/24087654
type: Question
accepted answer: http://stackoverflow.com/a/24092781
score: 0
answer count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/37151443
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24092781
has title: @Aspect with RMI
tagged with: java
has body: I have an application server-client RMI with spring configuration. Now I wont to add method calls logging using @Aspect. I added in my spring-context.xml: &lt;aop:aspectj-autoproxy&gt; &lt;/aop:aspectj-autoproxy&gt; &lt;bean id="loggerAspect" class="my.aspect.LoggerAspect" /&gt; My loggerAspect has defined @Pointcut("execution(* my.rmi.service.*.*(..))") When i try to run my application i get: Caused by: java.io.NotSerializableException: org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeArray(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) at java.io.ObjectOutputStream.writeSerialData(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) ... 8 more My RMI interface extends Serializable and all classes used in this interface also implements Serializable.

http://stackoverflow.com/q/24001535
tagged with: file
has comment: http://stackoverflow.com/comment/36990563
has body: I noticed in : Why does not File.deleteOnExit work with directory? that I couldn't delete a non empty folder with File.deleteOnExit(). Is there any way to do a similar operation? Or should I try to register all files below it and then the parent directory using file.deleteOnExit()? Or should I try * shudders * a finalizer?
has title: File.deleteOnExit() For Non-Empty Folders?
tagged with: java
has comment: http://stackoverflow.com/comment/36990284
type: Question
upvote count: 4
downvote count: 0
linked to: http://stackoverflow.com/q/15038065
score: 4
tagged with: file-io
tagged with: io
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24053886
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: java
has title: What is the testng equivalent of junits @ClassRule
tagged with: unit-testing
type: Question
has body: Junit has a decorator called @ClassRule that is applied around the test class. I am trying to find the same thing in testng without any success this far. What would be the best way to do a @ClassRule in testng?
has answer: http://stackoverflow.com/a/24058335
downvote count: 0
accepted answer: http://stackoverflow.com/a/24058335
tagged with: junit
answer count: 1
tagged with: testng
favorite count: 0

http://stackoverflow.com/comment/37040331
comment on: http://stackoverflow.com/a/24028201
type: Comment
has text: This was very helpful thank you! I didn't know that a JSON Object had curly braces. Which is the problem since my JSON starts with []. I should probably then look for a way in which i tell it to look for a JSON Array instead of an Object.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24084724
tagged with: java
has comment: http://stackoverflow.com/comment/37147629
score: 9
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/59768538
has comment: http://stackoverflow.com/comment/37144483
downvote count: 0
answer count: 1
tagged with: uribuilder
favorite count: 0
has comment: http://stackoverflow.com/comment/37144248
tagged with: decoding
type: UnansweredQuestion
has title: URIBuilder setParameter adds + instead of %20 for space
has comment: http://stackoverflow.com/comment/37144602
has body: I'm trying to build a URL using URIBuilder and for some reason I get + instead of %20 for space. this is my code: URI uri=null; try { uri = ub.setScheme("http") .setHost("myalcoholist.com") .setPath("/drink-management/view-drink-json") .setParameter("flavor",(String)params[1]) .setParameter("brand",(String)params[2]) .setParameter("company",(String)params[3]) .build(); } catch (URISyntaxException e) { Log.e("url", "could not parse url", e); return null; } the parameters: params[3] = {java.lang.String@831933398520}"contreau france." params[2] = {java.lang.String@831933398384}"cointreau" params[1] = {java.lang.String@831933398256}"orange" the result URL: "GET /drink-management/view-drink-json?flavor=orange&amp;brand=cointreau&amp;company=contreau+france. HTTP/1.1" 200 538 "-" "Apache-HttpClient/UNAVAILABLE (java 1.4)" what do I need to change for the parameters to be properly encoded ? thanks

http://stackoverflow.com/comment/36947468
type: Comment
score: 0
type: AnswerComment
has text: Note that when you just pass a string to `ImageIcon` is will search in the file system. So you can either pass the URL to it or an `Image` obtained from `ImageIO.read()`
comment on: http://stackoverflow.com/a/23979136

http://stackoverflow.com/comment/37253310
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23992253
score: 2
has text: Have you tried contacting IBM support?

http://stackoverflow.com/comment/37123749
comment on: http://stackoverflow.com/a/24072131
has text: @camickr Nope, never really had some whinge about that, most people want auto complete, which `JComboBox` doesn't really do, which ends up in a different component - that's just what I've experienced ;)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23954665
has answer: http://stackoverflow.com/a/23954856
downvote count: 1
has title: Adding content to a JPanel
answer count: 4
favorite count: 0
has body: I'm new to Java and actually designing the GUI for an application. My main is a JFrame with 5 buttons and 1 panel which will have the "content", for the first button for example, I've designed a Jframe which has a JTabbedPane. Now I would like to know how can I incorporate the content from that frame to the "content" panel when clicking on the button ? I tried to use .add but I get: java.lang.IllegalArgumentException: adding a window to a container (seems we can't add Jframe to Jpanel). I also tried the setVisible way but it doesn't meet what I need since it will hide the panel completely and I will get a tiny window with the buttons. ![Jframe content][1] ![Main Jframe with buttons and Jpanel to show the jframe content][2] The code is generated by netbeans, and I forgot to mention that I did research on adding a Jframe into another Jframe but here isn't my problem at all. I tried by changing the Jframe by JInternalFrame but clicking on button doesn't do anything. Button has contentPanel.add(new GestionUtilisateur()); So basically when you click on the "Gestion Utilisateur" button for example, you get that JTabbedPane that has to appear in the content area (which is blank here)
tagged with: swing
has answer: http://stackoverflow.com/a/23954992
accepted answer: http://stackoverflow.com/a/23954992
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/36901659
tagged with: java
has comment: http://stackoverflow.com/comment/36901795
score: -1
has answer: http://stackoverflow.com/a/23954792
type: Question
has comment: http://stackoverflow.com/comment/36901760
has comment: http://stackoverflow.com/comment/36901681
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/23954792
has answer: http://stackoverflow.com/a/23954864

http://stackoverflow.com/comment/37132845
score: 1
has text: Did you or your colleague change the `serialVersionUID` in between?
type: QuestionComment
comment on: http://stackoverflow.com/q/24077413
type: Comment

http://stackoverflow.com/comment/37009117
type: Comment
has text: I have in my actionPerformed method (within the abstract class) a call to a method they is in the main-class. On the top there is the edited example.
score: 0
comment on: http://stackoverflow.com/q/24011432
type: QuestionComment

http://stackoverflow.com/q/24068456
has title: Specify the string display java
answer count: 1
favorite count: 0
downvote count: 3
upvote count: 0
has body: I would like to know how to display a string (character by character) with Java, that is to say, a display char in a JTextField and then display another after 2 seconds for example? Can someone point me how to fix this? private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { String s = jTextField4.getText (), s1 = ""; String str = ""; int L = s.length(); int x = 1500; for (int i=0; i&lt; L; i++) { char prem = s.charAt(i); str= str + prem; x = x + 2000; final Thread th4 = new Thread (new Runnable() { public void run() { try { Thread.sleep(x); } catch (InterruptedException ex) { } } }); th4.start(); s1 = s1.concat(str); jTextField3.setText(s1); } }
has comment: http://stackoverflow.com/comment/37115187
score: -3
type: Question
has comment: http://stackoverflow.com/comment/37114813
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24068636
accepted answer: http://stackoverflow.com/a/24068636

http://stackoverflow.com/q/23963297
upvote count: 1
has title: Integration of Rapidminer with Java: Obtaining the output Example Set (Process Result)
type: Question
possible better answer: http://stackoverflow.com/a/24131691
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24131691
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26701530
accepted answer: http://stackoverflow.com/a/26701530
favorite count: 0
tagged with: rapidminer
has body: I want to execute a Rapidminer process from Java to use the output ExampleSet (Process Result) for subsequent operations (with Java). I managed the process execution with the code below, but I don't have a clue how to obtain the process Result Example Set. Ideally, I want to get any Example Set independent of the variables, but if you need to generate the metadata beforehand, will have to be. package com.companyname.rm; import com.rapidminer.Process; import com.rapidminer.RapidMiner; import com.rapidminer.operator.OperatorException; import com.rapidminer.tools.XMLException; import java.io.File; import java.io.IOException; public class RunProcess { public static void main(String[] args) { try { RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE); RapidMiner.init(); Process process = new Process(new File("//my_path/..../test_JAVA.rmp")); process.run(); } catch (IOException | XMLException | OperatorException ex) { ex.printStackTrace(); } } }
type: AnsweredQuestion

http://stackoverflow.com/comment/37151646
comment on: http://stackoverflow.com/a/24088359
score: 0
type: AnswerComment
has text: @AdamYost Yes, I was in the middle of editing my answer. I am not sure why I didn't described it sooner (maybe OP added that part later but before 5 min grace time so this change is not in edit history).
type: Comment

http://stackoverflow.com/q/23977769
answer count: 3
accepted answer: http://stackoverflow.com/a/23977837
has comment: http://stackoverflow.com/comment/36945114
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36945150
linked to: http://stackoverflow.com/q/1196586
linked to: http://stackoverflow.com/q/5113016
score: 0
upvote count: 1
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23978711
has comment: http://stackoverflow.com/comment/36945275
has body: I couldn't remove object.How can I remove a object from an arraylist? my code List<kisi> x=new ArrayList<kisi>(); x.add(new kisi("1","betül")); x.add(new kisi("2","hatice")); x.add(new kisi("3","selma")); kisi k=new kisi("2","hatice"); for (int i = 0; i < x.size(); i++) { if (x.get(i).id==k.id) { Object obj = x.remove(i); break; } } my constructor public class kisi { public static String id="0"; public static String ad="0"; public kisi(String id,String ad) { // TODO Auto-generated constructor stub this.id=id; this.ad=ad; }
has answer: http://stackoverflow.com/a/23978711
tagged with: java
has title: How to remove a element from arraylist in android
has answer: http://stackoverflow.com/a/23977837
has answer: http://stackoverflow.com/a/23977785
has comment: http://stackoverflow.com/comment/36945242
favorite count: 0

http://stackoverflow.com/comment/36933579
score: 0
type: Comment
has text: I think I did, since System.getenv("JAVA_HOME") prints this to console: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home, which is correct JDK path on my MAC.
comment on: http://stackoverflow.com/a/23967729
type: AnswerComment

http://stackoverflow.com/comment/37111456
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24066373
has text: Just a block of code is not a high quality answer. A better answer explains what the code does and why the approach was chosen.
type: AnswerComment

http://stackoverflow.com/q/24076508
has answer: http://stackoverflow.com/a/24076654
has body: I am still learning Android programming, had this app and its giving me the unfortunately stopped error. MainActivity package com.nyt.ilm.ilmsarf; import android.os.Bundle; 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; public class MainActivity extends FragmentActivity { ViewPager viewpager; @Override protected void onCreate(Bundle arg0) { // TODO Auto-generated method stub super.onCreate(arg0); setContentView(R.layout.activity_main); viewpager = (ViewPager) findViewById(R.id.pager); viewpager.setAdapter(new MyPageAdapter(getSupportFragmentManager())); } } class MyPageAdapter extends FragmentPagerAdapter { public MyPageAdapter(FragmentManager fm) { super(fm); // TODO Auto-generated constructor stub } @Override public Fragment getItem(int arg0) { // TODO Auto-generated method stub Fragment fr=null; if (arg0==0) fr=new P1(); if(arg0==1) fr=new P2(); if(arg0==2) fr=new P3(); return fr; } @Override public int getCount() { // TODO Auto-generated method stub return 3; } } P1.java (Fragment) package com.nyt.ilm.ilmsarf; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class P1 extends Fragment { private OnFragmentInteractionListener mListener; public P1() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.p1, container, false); } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Activity activity) { sup…
has comment: http://stackoverflow.com/comment/37128988
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37129042
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24076654
type: Question
has comment: http://stackoverflow.com/comment/37129023
tagged with: android
has title: Android App Unfortunately App has stopped
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37128989

http://stackoverflow.com/comment/36940948
score: 0
type: Comment
has text: More precisely, if the fractional part is an integer multiplied by a power of two. 3.0/4.0 is exact.
type: AnswerComment
comment on: http://stackoverflow.com/a/23975691

http://stackoverflow.com/q/23968237
accepted answer: http://stackoverflow.com/a/23968369
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23968369
type: Question
tagged with: android
has body: Which is the best way to develop simple android games like this one FingerSlayer I have tried to use simple ImageViews,TextViews,TranslateAnimations,AlphaAnimations But I understood that it isn`t the best way to create simple android games, I have tried libGDX , I could create animations there but I could not put buttons there.So which is the best way to develop games like Flappy Bird,2048,Finger Slayer etc.
has title: Java Android Game Development
answer count: 1
score: 0
tagged with: java

http://stackoverflow.com/a/24015881
score: 0
has body: I solved it using a connection pooling library - C3P0 http://www.mchange.com/projects/c3p0/#idleConnectionTestPeriod Using property idle_test_period, which pings database server after specified interval. &lt;property name="hibernate.c3p0.idle_test_period" value="100" /&gt; &lt;property name="hibernate.c3p0.preferredTestQuery" value="select 1;" /&gt;
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24007966
accepted answer of: http://stackoverflow.com/q/24007966

http://stackoverflow.com/comment/37087479
score: 1
has text: Why two `SQLiteHelper`? create both `Table` separately in same `DB`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24053976

http://stackoverflow.com/comment/36943669
has text: localhost is also an internal address. Change it to anything.com and then add that domain in your hosts file and point it to your local webserver and see if that works
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23977013

http://stackoverflow.com/a/23980990
upvote count: 1
has comment: http://stackoverflow.com/comment/36951357
has body: I agree with the answer from Abhi Beckert on some aspects - typically the following: It is never acceptable for the model to communicate with anything other than the model. The view should communicate only with other view objects and not have knowledge about the controller. In addition the Controller must know anything about the composition of the View since this would couple the Controller and the View. And this coupling would mean that were you needed to change the view representation or for that matter provide a choice of various data representations to a user you would have to write a new controller for each of the representation. Let me make this point concrete by stating an example. When you take open a Word document in a Word Processor like MS-Word, the page can various layout such as Portrait, Landscape, Print and Html. In each of these layouts, the visible user elements are different. However the data is the same. Hence the most logical way to approach the problem would be to either: Have the controller send a command to the model to update the appropriate view. Have the controller query the model to obtain the data and simply pass the obtained data to the view for rendering. I went through the code that you have posted and identified that your controller knows about the contents of the view for e.g. the MainController calls into MainView.getinfobox().Based on the above explanation, you would want to change that. As about the second question related to sending data using a PipedStream, I do not see anything technically wrong in it - since a stream is a also a container of data. But, I have personally not seen or come across until now a design or code snippet that would follow this pattern. Hope this helps
has comment: http://stackoverflow.com/comment/36951634
accepted answer of: http://stackoverflow.com/q/23973673
answers question: http://stackoverflow.com/q/23973673
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36956371
type: Answer
has comment: http://stackoverflow.com/comment/36951422
score: 1

http://stackoverflow.com/comment/37142649
score: 0
type: Comment
type: QuestionComment
has text: Do you have to do this on the server side? It may be easier done on the client side using javascript
comment on: http://stackoverflow.com/q/24083924

http://stackoverflow.com/a/29522128
upvote count: 4
has body: I did by myself Let's try import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util. public class YouTubeDurationUtils { /** * * @param duration * @return "01:02:30" */ public static String convertYouTubeDuration(String duration) { String youtubeDuration = duration; //"PT1H2M30S"; // "PT1M13S"; Calendar c = new GregorianCalendar(); try { DateFormat df = new SimpleDateFormat("'PT'mm'M'ss'S'"); Date d = df.parse(youtubeDuration); c.setTime(d); } catch (ParseException e) { try { DateFormat df = new SimpleDateFormat("'PT'hh'H'mm'M'ss'S'"); Date d = df.parse(youtubeDuration); c.setTime(d); } catch (ParseException e1) { try { DateFormat df = new SimpleDateFormat("'PT'ss'S'"); Date d = df.parse(youtubeDuration); c.setTime(d); } catch (ParseException e2) { } } } c.setTimeZone(TimeZone.getDefault()); String time = ""; if ( c.get(Calendar.HOUR) &gt; 0 ) { if ( String.valueOf(c.get(Calendar.HOUR)).length() == 1 ) { time += "0" + c.get(Calendar.HOUR); } else { time += c.get(Calendar.HOUR); } time += ":"; } // test minute if ( String.valueOf(c.get(Calendar.MINUTE)).length() == 1 ) { time += "0" + c.get(Calendar.MINUTE); } else { time += c.get(Calendar.MINUTE); } time += ":"; // test second if ( String.valueOf(c.get(Calendar.SECOND)).length() == 1 ) { time += "0" + c.get(Calendar.SECOND); } else { time += c.get(Calendar.SECOND); } return time ; } }
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24078662

http://stackoverflow.com/comment/37046741
type: AnswerComment
score: 0
type: Comment
has text: *Everything should work for 1.5>Java<1.8* - Java 1.5 will work, too. Maybe it should be `>=`. :-)
comment on: http://stackoverflow.com/a/24010540

http://stackoverflow.com/q/24048990
has answer: http://stackoverflow.com/a/24049031
has title: EJB Dependency Injection with interface
accepted answer: http://stackoverflow.com/a/24049289
score: 4
has body: I have an interface I with method m and two concrete implementations A and B. public interface I{ public void m(); } public class A implements I{ public void m(){ // } } public class B implements I{ public void m(){ // } } I want to know when I inject I which of the two methods will be executed @EJB private I service; /// service.m(); /////
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
answer count: 2
tagged with: dependency-injection
tagged with: ejb
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24049289
possible better answer: http://stackoverflow.com/a/24049031

http://stackoverflow.com/a/23975151
type: Answer
has comment: http://stackoverflow.com/comment/36940549
has body: topline is actually NOT null - it's perfectly fine. The problem is the use of System.console() which returns null (and hence you get NPE on .writer()). Use System.out.println() instead and it'll work just fine. An explanation as to why System.console() doesn't work in your IDE can be found here
has comment: http://stackoverflow.com/comment/36940492
has comment: http://stackoverflow.com/comment/36940239
has comment: http://stackoverflow.com/comment/36940147
has comment: http://stackoverflow.com/comment/36940439
has comment: http://stackoverflow.com/comment/36940279
has comment: http://stackoverflow.com/comment/36940233
score: 0
answers question: http://stackoverflow.com/q/23975093
has comment: http://stackoverflow.com/comment/36940300
has comment: http://stackoverflow.com/comment/36939827
has comment: http://stackoverflow.com/comment/36940539
has comment: http://stackoverflow.com/comment/36940155

http://stackoverflow.com/q/23977654
score: -1
tagged with: background
accepted answer: http://stackoverflow.com/a/23977709
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/36944790
answer count: 1
has title: Background color does not change in bluej
tagged with: awt
favorite count: 0
has body: I have written a code that has a label and a button in a frame. I have also changed the background but it never changes. import javax.swing.*; import java.awt.*; import javax.swing.border.*; public class Frames { JFrame Main_Menu=new JFrame("MAIN MENU");JFrame CIRCUMFERENCE=new JFrame("CIRCUMFERENCE"); JFrame AREA=new JFrame("AREA");JFrame PERIMETER=new JFrame("PERIMETER");JFrame SETS=new JFrame("SETS"); JFrame FUNDAMENTAL_OPRATIONS=new JFrame("FUNDAMENTAL OPRATIONS");JFrame POWER_AND_ROOTS=new JFrame("POWER_AND_ROOTS"); void Main_Menu() { JPanel contentPane = (JPanel) Main_Menu.getContentPane(); contentPane.setLayout(new BorderLayout(10,10)); contentPane.setBorder(new EmptyBorder(300, 150, 300, 150)); contentPane.setLayout(new GridLayout(4, 4)); JPanel buttonPanel = new JPanel(new GridLayout(8,8)); contentPane.add(Labels.Main_MENU,BorderLayout.NORTH); contentPane.add(Buttons.SETS,BorderLayout.SOUTH); Main_Menu.setBackground(Color.YELLOW); Main_Menu.pack(); Main_Menu.setVisible(true); } }
has answer: http://stackoverflow.com/a/23977709
type: AnsweredQuestion
upvote count: 0
tagged with: jframe
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/36944850
type: Question
has comment: http://stackoverflow.com/comment/36944814
tagged with: java

http://stackoverflow.com/q/23947460
favorite count: 0
has comment: http://stackoverflow.com/comment/36888903
accepted answer: http://stackoverflow.com/a/23947624
upvote count: 1
linked to: http://stackoverflow.com/q/6470651
has comment: http://stackoverflow.com/comment/36889305
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36888987
tagged with: performance
has comment: http://stackoverflow.com/comment/36888926
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23950104
type: Question
has comment: http://stackoverflow.com/comment/36888998
has body: Hello I am using jdk7 and ram of 6GB with intel corei5 processor.I have a java code which has an arraylist of size more than 6000 and each element in that arraylist contains 12 double values.The processing speed has decreased very much and now it takes around 20 mins to run that entire code. What the code does is as follows: There are some 4500 iterations happening due to nested for loops..and in each iteration a file of 400 kb is read and some processing happens and some values are stored in arraylist. Once the arraylist is ready the values of arraylist are written in another file through csvwriter.and then i have used jtable and the jtable also required the arraylist for referring to some values in that arraylist.so basically i cant clear this arraylist. I have given the values for heap memory as follows -Xms1024M -Xmx4096M I am new to programming and I am rather confused as to what should i do?Can i increase heap size more than this?will that help?My senior suggests to use hard disk memory for storing arraylist elements or processing but i doubt if that is possible. Please help.Any help will be appreciated
has answer: http://stackoverflow.com/a/23947624
downvote count: 0
has comment: http://stackoverflow.com/comment/36888935
has answer: http://stackoverflow.com/a/23947538
answer count: 3
possible better answer: http://stackoverflow.com/a/23947538
has title: java performance degrading due to arraylist of size more than 6000
has comment: http://stackoverflow.com/comment/36889112

http://stackoverflow.com/comment/36955837
comment on: http://stackoverflow.com/a/23961811
type: Comment
has text: `==` doesn't matter, the implementation in the `List.indexOf()` only considers `.equals()` so identity comparison isn't a concern.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23970840
has comment: http://stackoverflow.com/comment/36932428
score: 0
tagged with: android
tagged with: textview
has comment: http://stackoverflow.com/comment/36932900
has title: Phone call on textview tap
answer count: 0
has comment: http://stackoverflow.com/comment/36933195
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36932436
type: Question
tagged with: java
has body: I have this fragment with a two columns list view, the second of which has phone numbers in it. I'm trying to make those numbers clickable, in order to make a phone call (using an Intent). Problem is when I run the app, nothing happens on tapping the text. (Note that i've already set the &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt; in the manifest). @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_my, container, false); ListView lview = (ListView)view.findViewById(R.id.contact_list); populateList(); listviewAdapter adapter = new listviewAdapter(getActivity(), list); lview.setAdapter(adapter); final TextView tv= (TextView)LayoutInflater.from(getActivity()).inflate(R.layout.rows, null).findViewById(R.id.number); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent callIntent = new Intent(Intent.ACTION_CALL); String phone_no=tv.getText().toString().trim(); callIntent.setData(Uri.parse("tel:"+phone_no)); startActivity(callIntent); }}); return view; } rows.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingTop="4dip" android:paddingBottom="6dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;TextView android:id="@+id/name" android:layout_width="100dip" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/number" android:layout_width="50dip" android:layout_height="wrap_content" android:clickable="true" /&gt; &lt;/LinearLayout&gt; listviewAdapter.java public class listviewAdapter extends BaseAdapter { public static final String FIRST_COLUMN = "Column 1"; public static final String SECOND_COLUMN = "Column 2"; public ArrayList&lt;HashMap&lt;String,String&gt;&gt; list; Activity activity; public listviewAdapter(Activity activi…

http://stackoverflow.com/a/24057068
has body: No, if you have a third-party binary program written in plain C, there is no way to run that program on the GPU using OpenCL (or any other method). That binary will be using a CPU instruction set (x86, ARM etc) that will not compatible with whatever instruction set the GPU uses. You would need to rewrite the computationally expensive code using OpenCL (or some other GPU-capable language + API) to get it run on the GPU.
answers question: http://stackoverflow.com/q/24055235
accepted answer of: http://stackoverflow.com/q/24055235
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23976264
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has body: I write the following code for send mail.(java maven web application). public class MailAction extends ActionSupport { private String mailId; public String getMailId() { return mailId; } public void setMailId(String mailId) { this.mailId = mailId; } final String username = "my email"; final String password = "my password"; public String execute() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse servletResponse; 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() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("my email")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(request.getParameter("mailId"))); message.setSubject("Testing Subject"); message.setText("Dear Mail Crawler," + "\n\n No spam to my email, please!"); System.out.println(request.getParameter("mailId")); System.out.println(message); Transport.send(message); System.out.println("Done"); } catch (MessagingException e) { throw new RuntimeException(e); } return SUCCESS; } When i run the program The API package 'mail' or call 'Send()' was not found Exception appear. Please help me to solve this problem.
type: Question
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: email
has title: The API package 'mail' or call 'Send()' was not found Exception
has answer: http://stackoverflow.com/a/42550096

http://stackoverflow.com/comment/36917641
type: QuestionComment
has text: These are the kinds of questions you should ask someone at your company. Unless yours is the first web application ever to be written at your company, they will already have web servers and a web application methodology.
score: 1
comment on: http://stackoverflow.com/q/23962742
type: Comment

http://stackoverflow.com/comment/36966046
has text: Does `result` contain anything?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23988718

http://stackoverflow.com/q/24018496
has answer: http://stackoverflow.com/a/24034634
answer count: 2
tagged with: serial-port
has body: Hi everyOne it's my first topic on this website; and sorry for my bad english i'am not a native english speaker So i wanna save my data received from my embedded card into an array here is my fonctions public void serialEvent(SerialPortEvent evt) { if (evt.getEventType() == SerialPortEvent.DATA_AVAILABLE) { System.out.println("Data available event received"); try { byte singleData = (byte)input.read(); if (singleData &gt;= Debut_caracter) { System.out.println("Reçu : "+singleData); logText =new String(new byte[] {singleData}); window.txtLog.append(logText); System.out.println("le LogText est : "+logText+"\n"); } else { window.txtLog.append(" "); } if (singleData &lt; 0) { window.txtLog.append("\n"); } } catch (Exception e) { logText = "Failed to read data. (" + e.toString() + ")"; window.txtLog.setForeground(Color.red); window.txtLog.append(logText + "\n"); } } // waiting(1); } i received from my card data like this : le LogText est : R Data available event received Reçu : 70 le LogText est : F Data available event received Reçu : 69 le LogText est : E Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Data available event received Reçu : 83 le LogText est : S Data available event received Reçu : 84 le LogText est : T Data available event received Reçu : 80 le LogText est : P Data available event received Reçu : 48 le LogText est : 0 Data available event received Reçu : 49 le LogText est : 1 Data available event received Reçu : 54 le LogText est : 6 Data available event received Reçu : 54 le LogText est : 6 Data available event received Reçu : 48 le LogText est : 0 Data available event received Reçu : 50 le LogText est : 2 Data available event received Data available event received Data avail…
has title: Save data on array
score: 0
tagged with: java
tagged with: rxtx
has answer: http://stackoverflow.com/a/24026674
type: AnsweredQuestion
tagged with: embedded
accepted answer: http://stackoverflow.com/a/24026674
possible better answer: http://stackoverflow.com/a/24034634
type: Question

http://stackoverflow.com/comment/36912020
has text: @user3651925 Creating a runnable to invoke with SwingUtilities is the multithreading analog of `System.out.println("Hello World!");`. Anyway, these tutorials explain quite a lot, including some aspects of multithreading. If you find them helpful, feel free to upvote/accept the answer.
comment on: http://stackoverflow.com/a/23959410
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36882071
score: 1
has text: http://stackoverflow.com/questions/12828416/generate-test-jar-along-with-jar-file-in-test-package shows how to have a second jar with the tests.
comment on: http://stackoverflow.com/q/23943410
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37101645
type: QuestionComment
has text: @EmanuelSeibold There's usually a graceful way of doing things. If there's something that waits or blocks for a long time, there's almost always some kind of way to wake it up without just terminating the thread. You deal with these things on a per-case basis. This was the point of them deprecating `Thread.stop()` because there's always better ways. We need more details about what is waiting, because that will change how to wake it up.
comment on: http://stackoverflow.com/q/24061497
score: 0
type: Comment

http://stackoverflow.com/comment/36882629
score: 0
comment on: http://stackoverflow.com/a/23944162
type: AnswerComment
has text: Ermmm ... you don't need to create a custom plugin to solve this.
type: Comment

android-edittext
tags question: http://stackoverflow.com/q/23976970
tags question: http://stackoverflow.com/q/24059440
type: Tag
tags question: http://stackoverflow.com/q/24058968
tags question: http://stackoverflow.com/q/24100375
tag name: android-edittext
tags question: http://stackoverflow.com/q/24025290
tags question: http://stackoverflow.com/q/24042368
tags question: http://stackoverflow.com/q/24055215

http://stackoverflow.com/q/23952257
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36897319
has body: I have a quite large amount of java sources (an open Source Project), where i want to "patch" some class files with my own for debugging pruposes, without touching the original code. So I made Patch-Project where i altered eg. com.package.abc.java Now i want to tell eclipse and/or maven to build the original Project, but overwirte its own (original) com.package.abc.java from /src with the patched abc.java from my second Project, which i exported as a library.jar and added to /libs in the original Project. The Stucture looks like this Original: /src com/package/ abc.java def.java /libs patch.jar patch: /src com/package/ abc.java How do i do this with eclipse and maven plugin?
upvote count: 1
answer count: 1
has title: replace classes with library classes
favorite count: 0
has answer: http://stackoverflow.com/a/23952340
downvote count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: classpath
type: Question

http://stackoverflow.com/comment/37168039
type: Comment
comment on: http://stackoverflow.com/q/24096543
score: 0
type: QuestionComment
has text: Please edit your question to include an [mcve](http://stackoverflow.com/help/mcve) that shows your approach.

jenkins
tags question: http://stackoverflow.com/q/24025277
tag name: jenkins
tags question: http://stackoverflow.com/q/23951321
tags question: http://stackoverflow.com/q/23975272
tags question: http://stackoverflow.com/q/24081388
tags question: http://stackoverflow.com/q/23991694
tags question: http://stackoverflow.com/q/23942241
tags question: http://stackoverflow.com/q/24069464
tags question: http://stackoverflow.com/q/24063233
tags question: http://stackoverflow.com/q/24084745
tags question: http://stackoverflow.com/q/24029349
tags question: http://stackoverflow.com/q/24001032
tags question: http://stackoverflow.com/q/23996767
tags question: http://stackoverflow.com/q/24086380
tags question: http://stackoverflow.com/q/24084973
type: Tag

http://stackoverflow.com/comment/37109400
has text: A valid point. But I'm confident we will see this feature in future JPA specifications. Positional parameters are a pain in the ass when dealing with really complex queries, where parameters appear multiple times. Until then, we have no plans to go for another JPA implementation. The same holds for databases. While it's important to stick as close to the SQL standard as possible, you sometimes have to use database specific features or dialects to achieve high-performance, maintainable queries. One always has to make decisions and find a balance between migration cost and overhead while coding.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24059491

http://stackoverflow.com/q/24099904
answer count: 2
has comment: http://stackoverflow.com/comment/37208623
tagged with: jpa
has comment: http://stackoverflow.com/comment/37173419
accepted answer: http://stackoverflow.com/a/24315564
score: 0
has comment: http://stackoverflow.com/comment/37173125
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37195890
has title: No suitable driver found for jdbc:mysql://localhost:3306/ jpa
has comment: http://stackoverflow.com/comment/37173229
has comment: http://stackoverflow.com/comment/37173183
has answer: http://stackoverflow.com/a/24237225
has comment: http://stackoverflow.com/comment/37183596
has body: I've put the drivers jar in modules\com\mysql\main, in standalone\lib and created the module.xml: <?xml version="1.0" encoding="UTF-8"?> <resource-root path="mysql-connector-java-5.1.30-bin.jar"/> My Standalone.xml is: jdbc:mysql://localhost:3306/fmiunibuc com.mysql TRANSACTION_READ_COMMITTED 10 100 true root 1234 <prepared-statement-cache-size>32</prepared-statement-cache-size> <share-prepared-statements/> <drivers> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource I want to use jpa so my persistence.xml is : org.hibernate.ejb.HibernatePersistence ro.unibuc.entity.Departments ro.unibuc.entity.Employees ro.unibuc.entity.Projects <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> <property name="hibernate.connection.username" value="root" /> <property name="hibernate.connection.password" value="1234" /> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/fmiunibuc" /> I have also created a beans.xml and put the mysql jar in WEB-INF/lib. When i created the jpa facets and created the connection, the ping to this link: jdbc:mysql://localhost:3306/fmiunibuc was a succes. I have no more ideas of what i should do. If you need i can also provide the error code. I will try to answer as fast as i can to any of your question and I hope this is not a repost. UPDATE error message: 22:11:24,276 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) SQL Error: 0, SQLState: 08001 22:11:24,278 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) No suitable driver found for jdbc:mysql://localhost:3306/fmiunibuc 22:11:24,288 ERROR [org.jboss.as.ejb3.tx.CMTTxInterceptor] (http-localhost-127.0.0.1-8080-1) javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.JD…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24237225
has answer: http://stackoverflow.com/a/24315564
tagged with: java
has comment: http://stackoverflow.com/comment/37196241
tagged with: mysql
tagged with: jboss
type: Question

http://stackoverflow.com/comment/37069427
has text: @Cruncher i added the code without the bukkit stuff in the main post
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24042963
type: Comment

http://stackoverflow.com/q/23980120
upvote count: 6
favorite count: 0
score: 6
has answer: http://stackoverflow.com/a/76618695
tagged with: java-8
has comment: http://stackoverflow.com/comment/36987409
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/32329482
has title: Cannot open some applications in VisualVM
tagged with: java
has comment: http://stackoverflow.com/comment/36968488
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36968904
type: Question
has answer: http://stackoverflow.com/a/58597308
downvote count: 0
possible better answer: http://stackoverflow.com/a/58597308
tagged with: visualvm
answer count: 3
has answer: http://stackoverflow.com/a/32329482
has body: I am using Ubuntu 14.04 with Oracle JDK 8. I want to inspect performance of my application using VisualVM. I can inspect other applications like JDownloader but I can't inspect my own applications and Eclipse 4.3. Before I made fresh install of Ubuntu, I was using JDK 7 and I have no problem and using it without any configuration. It gives following log. SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor com.sun.tools.visualvm.core.ui.DataSourceWindowManager$1 java.lang.IllegalArgumentException: Unexpected composite type for ThreadInfo at sun.management.ThreadInfoCompositeData.validateCompositeData(ThreadInfoCompositeData.java:372) at sun.management.ThreadInfoCompositeData.getInstance(ThreadInfoCompositeData.java:68) at java.lang.management.ThreadInfo.&lt;init&gt;(ThreadInfo.java:263) at java.lang.management.ThreadInfo.from(ThreadInfo.java:794) Caused: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275) at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaFrom.fromCompositeData(DefaultMXBeanMappingFactory.java:1018) Caused: java.io.InvalidObjectException: Failed to invoke from(CompositeData) at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory.invalidObjectException(DefaultMXBeanMappingFactory.java:1457) at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaFrom.fromCompositeData(DefaultMXBeanMappingFactory.java:1021) …
has comment: http://stackoverflow.com/comment/36987537

import
type: Tag
tags question: http://stackoverflow.com/q/23996859
tag name: import
tags question: http://stackoverflow.com/q/24022449
tags question: http://stackoverflow.com/q/24000699
tags question: http://stackoverflow.com/q/24013022
tags question: http://stackoverflow.com/q/24045109
tags question: http://stackoverflow.com/q/24087342
tags question: http://stackoverflow.com/q/24019198
tags question: http://stackoverflow.com/q/24076971
tags question: http://stackoverflow.com/q/24096369

http://stackoverflow.com/comment/36973589
score: 0
has text: Well, what other choice do you have?
type: AnswerComment
comment on: http://stackoverflow.com/a/23990661
type: Comment

http://stackoverflow.com/a/40228243
has comment: http://stackoverflow.com/comment/68080823
has body: I saw the same behavior, though after following the thread on the GitHub issue it seems to be fixed in 1.6.5, which proved true for me. Hopefully this will save someone a headache later :). Working configuration with: jacoco-maven-plugin 0.7.7.201606060606 powermock 1.6.5 I am not using offline instrumentation.
score: 8
type: Answer
has comment: http://stackoverflow.com/comment/122278258
downvote count: 1
has comment: http://stackoverflow.com/comment/93796199
answers question: http://stackoverflow.com/q/23983740
upvote count: 9

http://stackoverflow.com/a/24009629
score: 0
has body: Try below code: Locale locale = new Locale("en_US"); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; context.getApplicationContext().getResources().updateConfiguration(config, null); Save locale in SharedPreferences: /* SETTINGS_NAME - string variable or constant LANG_SETTINGS - lang settings identificator lang - language, en_US for example */ SharedPreferences preferences = getSharedPreferences(SETTINGS_NAME, MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor = editor.putString(LANG_SETTINGS, lang); editor.commit(); Load SharedPreferences: SharedPreferences preferences = getSharedPreferences(SETTINGS_NAME, MODE_PRIVATE); String lang = preferences.getString(LANG_SETTING, "")
has comment: http://stackoverflow.com/comment/37008691
has comment: http://stackoverflow.com/comment/37009252
type: Answer
has comment: http://stackoverflow.com/comment/37010284
has comment: http://stackoverflow.com/comment/37010186
has comment: http://stackoverflow.com/comment/37008800
has comment: http://stackoverflow.com/comment/37012198
has comment: http://stackoverflow.com/comment/37008626
has comment: http://stackoverflow.com/comment/37013813
has comment: http://stackoverflow.com/comment/37012134
has comment: http://stackoverflow.com/comment/37011937
has comment: http://stackoverflow.com/comment/37014417
has comment: http://stackoverflow.com/comment/37012877
answers question: http://stackoverflow.com/q/24009528

http://stackoverflow.com/comment/37165059
has text: If you can detect that some other software puts something into the clipboard and then immediately clear it it might be enough.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24095407
type: Comment

http://stackoverflow.com/a/50327773
type: Answer
has body: In case that you may trying to locate where the problem is, I found mine in the following path of my project: /app/build/reports/lint-results-release-fatal.html(or .xml). Hope this helps!
score: 43
upvote count: 43
downvote count: 0
has comment: http://stackoverflow.com/comment/95388924
answers question: http://stackoverflow.com/q/24098494

http://stackoverflow.com/comment/37089435
score: 0
type: Comment
has text: these kind of dependencies problems could dissapear. That is the reason that I think that the way to manage the dependencies with graddle and maven is more flexible.
type: QuestionComment
comment on: http://stackoverflow.com/q/24054102

http://stackoverflow.com/a/24066640
type: Answer
has body: Because Java references are passed by value, the object pointed to by a and b.a is the exact same one, meaning that changing one 'value' changes both. So if you call a cup a tumbler and I call it a container if I put something water in it the water is in that same utensil that you call 'tumbler' and I call 'container.' Hope this example helps.
answers question: http://stackoverflow.com/q/24055414
score: 0

http://stackoverflow.com/a/24065752
score: 0
type: Answer
has body: replace the following in MainActivity java file setContentView(R.layout.activity_main); with setContentView(R.layout.fragment_main);
answers question: http://stackoverflow.com/q/24065642

http://stackoverflow.com/comment/37019494
has text: Hello All, please let me know some solution
comment on: http://stackoverflow.com/a/24012888
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24026292
has comment: http://stackoverflow.com/comment/131403050
has comment: http://stackoverflow.com/comment/131381057
has comment: http://stackoverflow.com/comment/131403779
has comment: http://stackoverflow.com/comment/44150118
accepted answer of: http://stackoverflow.com/q/24016962
has comment: http://stackoverflow.com/comment/110039986
score: 220
has comment: http://stackoverflow.com/comment/106963182
has comment: http://stackoverflow.com/comment/116441186
has comment: http://stackoverflow.com/comment/55573259
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/131403054
has comment: http://stackoverflow.com/comment/37271368
has body: This is yet another of those language design issues that seems "obviously a good idea" until you start digging and you realize that its actually a bad idea. This mail has a lot on the subject (and on other subjects too.) There were several design forces that converged to bring us to the current design: The desire to keep the inheritance model simple; The fact that once you look past the obvious examples (e.g., turning AbstractList into an interface), you realize that inheriting equals/hashCode/toString is strongly tied to single inheritance and state, and interfaces are multiply inherited and stateless; That it potentially opened the door to some surprising behaviors. You've already touched on the "keep it simple" goal; the inheritance and conflict-resolution rules are designed to be very simple (classes win over interfaces, derived interfaces win over superinterfaces, and any other conflicts are resolved by the implementing class.) Of course these rules could be tweaked to make an exception, but I think you'll find when you start pulling on that string, that the incremental complexity is not as small as you might think. Of course, there's some degree of benefit that would justify more complexity, but in this case it's not there. The methods we're talking about here are equals, hashCode, and toString. These methods are all intrinsically about object state, and it is the class that owns the state, not the interface, who is in the best position to determine what equality means for that class (especially as the contract for equality is quite strong; see Effective Java for some surprising consequences); interface writers are just too far removed. It's easy to pull out the AbstractList example; it would be lovely if we could get rid of AbstractList and put the behavior into the List interface. But once you move beyond this obvious example, there are not many other good examples to be found. At root, AbstractList is designed for single inheritance. But interfaces must be …
type: Answer
has comment: http://stackoverflow.com/comment/128898309
answers question: http://stackoverflow.com/q/24016962
upvote count: 222
has comment: http://stackoverflow.com/comment/37274955
has comment: http://stackoverflow.com/comment/78489924
downvote count: 2

http://stackoverflow.com/comment/37115711
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24066935
has text: @EricAm People tend not to like when questions ask for help with homework or internet puzzles. But I'm not one of the downvoters (just explaining why I think you're getting them)

http://stackoverflow.com/comment/36936957
score: 0
type: AnswerComment
has text: Hi Rod. Thank you very much for your reply. I assume the `RetrievePollenTask` goes inside my `Fragment` class am I right? I cannot access the `textview` object without doing so.
type: Comment
comment on: http://stackoverflow.com/a/23973770

http://stackoverflow.com/q/24040572
tagged with: java
has title: Sonar Violation: Security - Array is stored directly - Why only arrays?
type: Question
accepted answer: http://stackoverflow.com/a/24040908
tagged with: sonarqube
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24040908
has body: I have seen the link before asking question here, I wonder why SONAR complaining only arrays and not custom objects. Because same problem can occur in the custom objects we declare in the bean as well. And also, i couldnt agree why we need to take copy as we like to modify the same array that's why we have setters and all correct? Kindly help me to understand, SONAR is showing more number of violations in this category.
linked to: http://stackoverflow.com/q/11580948
type: AnsweredQuestion

http://stackoverflow.com/comment/36986812
score: 0
type: Comment
type: QuestionComment
has text: Guys I know this question is subjective but this is something that everyone wants to know, so if you cant answer it dont vote for close as we may get a constructive discussion as an answer to this question.
comment on: http://stackoverflow.com/q/23999780

http://stackoverflow.com/q/24009240
answer count: 1
tagged with: osgi
has comment: http://stackoverflow.com/comment/37005079
tagged with: plugins
linked to: http://stackoverflow.com/q/23979924
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: rcp
tagged with: eclipse
has answer: http://stackoverflow.com/a/24014191
has title: Can you mix a target platform with both 32 and 64 bit plugins?
score: 0
has body: I have mixed 32 bit and 64 bit plugins with my delta pack to build RCP plugins and products headlessly. Can the PDE build distinguish between platform dependent plugins all the time? Any thoughts are welcome. Also feel free to correct any misused terminology.

http://stackoverflow.com/a/41253225
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23984513
upvote count: 1
has body: From what I understood, debugging for hours, the problem is with the location where the jdk1.8 gets installed(/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home), instead of under System/Library). So the following has to be done to fix in intellij 1. For an existing project, right click and select module settings, and SDK and add 1.8 as a version. 2. Using a terminal go to ~/Library/Preferences//options/. Remove the old JDK specific lines in jdk.table.xml. Update the default version in project.default.xml Clean you project in intellij and build. It should use the new jdk and sync.

http://stackoverflow.com/q/24016319
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24017196
tagged with: hibernate-4.x
upvote count: 2
tagged with: properties
has body: Using the Hibernate 4.3.5 when you want to create a SessionFactory (e.g. unit testing) you will have to supply the properties twice: Once for configuration Second time, when applying settings to the service registry builder The example looks like: Properties properties = new Properties(); properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"); properties.put("hibernate.connection.url", "jdbc:hsqldb:mem:test"); properties.put("hibernate.connection.username", "sa"); properties.put("hibernate.connection.password", ""); properties.put("hibernate.hbm2ddl.auto", "update"); properties.put("hibernate.show_sql", "true"); SessionFactory sessionFactory = new Configuration() .addProperties(properties) .addAnnotatedClass(SecurityId.class) .buildSessionFactory( new StandardServiceRegistryBuilder() .applySettings(properties) .build() ); If I comment: //.addProperties(properties) Then the "hibernate.hbm2ddl.auto" property doesn't get thorough: Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: SECURITYID If I comment: //.applySettings(properties) I the get: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set Coda available on GitHub.
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/24017196
type: Question
tagged with: configuration
downvote count: 0
has title: Hibernate 4.3, when building SessionFactory why do we have to supply the properties twice?

http://stackoverflow.com/a/24075881
type: Answer
has comment: http://stackoverflow.com/comment/37128339
has comment: http://stackoverflow.com/comment/37128056
answers question: http://stackoverflow.com/q/24074358
has comment: http://stackoverflow.com/comment/37127890
score: 0
has body: One pattern for concurrent initialisation is the enum. The other is an inner class (as that is guaranteed to load the inner class on first usage). The usage will have to be adapted, as no longer a static field can be used. public enum MapLoader { INSTANCE; public Map aMap; { //does some processing to load this map aMap = new ConcurrentHashMap(); } } volatile aMap = MapLoader.INSTANCE.aMap; This creates a singleton. I personally generally pass the shared instance to every thread in their constructor, or rely on some container (as in a web application) to provide a singleton. Having the field volatile in the thread ensures that it is not only copied into the thread but on every access updated. A ConcurrentHashMap ensures thread-safe modification.

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/24021142
type: Tag
tags question: http://stackoverflow.com/q/23970479
tags question: http://stackoverflow.com/q/23951911
tags question: http://stackoverflow.com/q/24009707
tags question: http://stackoverflow.com/q/23946349

http://stackoverflow.com/comment/36926719
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23967664
has text: Yes, the string has no "\n" at all

http://stackoverflow.com/a/24018483
type: Answer
downvote count: 0
has body: It isn't possible with an array. However, for that you can use Collections.unmodifiableList instead: Returns an unmodifiable view of the specified list. This method allows modules to provide users with "read-only" access to internal lists. Query operations on the returned list "read through" to the specified list, and attempts to modify the returned list, whether direct or via its iterator, result in an UnsupportedOperationException. This works well in conjunction with Arrays.asList as another answer has already indicated. So your array foo would be written as: final List&lt;Integer&gt; foo = Collections.unmodifiableList(Arrays.asList(1, 2, 3, ...)); and instead of foo[i] you would use foo.get(i).
answers question: http://stackoverflow.com/q/24018455
score: 5
accepted answer of: http://stackoverflow.com/q/24018455
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/a/24135495
score: 0
has body: Take a look to the Shade Plugin of Maven, maybe it could be helpful. http://maven.apache.org/plugins/maven-shade-plugin/
type: Answer
has comment: http://stackoverflow.com/comment/37240937
answers question: http://stackoverflow.com/q/24082427

http://stackoverflow.com/comment/51922435
score: 0
has text: i was getting this error on running `new ActiveXComponent("Word.Application")`. this was gone when I ran the application with a user with admin privileges, strange. Mine was all 32 bit (windows, jdk and office) with jacob-1.14.3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24088146

http://stackoverflow.com/a/23944679
type: Answer
answers question: http://stackoverflow.com/q/23944537
score: 0
has body: if(pet[index] instanceof Dog) { ((Dog)pet[index]).getHairLength(); }

http://stackoverflow.com/comment/36938246
has text: what is your compliace level .. Project-Properties > Java Compiler > Compiler compliance level
type: Comment
comment on: http://stackoverflow.com/q/23974381
type: QuestionComment
score: 1

http://stackoverflow.com/a/24038005
answers question: http://stackoverflow.com/q/24032978
has body: If you need to inspect the parameter, then you can just can use a fake implementation, like: Delegate mock = new Delegate() { public int getSomeStuff(SearchCriteria search) { // Check search param return 0; } };
type: Answer
score: 0

http://stackoverflow.com/a/24014920
has comment: http://stackoverflow.com/comment/119959777
has comment: http://stackoverflow.com/comment/43639660
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38512471
has comment: http://stackoverflow.com/comment/38511518
accepted answer of: http://stackoverflow.com/q/24014919
type: Answer
score: 174
has comment: http://stackoverflow.com/comment/91545403
answers question: http://stackoverflow.com/q/24014919
upvote count: 174
has comment: http://stackoverflow.com/comment/91549212
has body: Migrating XML to @Configuration It is possible to migrate the xml to a @Configuration in a few steps: Create a @Configuration annotated class: @Configuration public class MyApplicationContext { } For each &lt;bean&gt; tag create a method annotated with @Bean: @Configuration public class MyApplicationContext { @Bean(name = "someBean") public SomeClass getSomeClass() { return new SomeClassImpl(someInterestingProperty); // We still need to inject someInterestingProperty } @Bean(name = "anotherBean") public AnotherClass getAnotherClass() { return new AnotherClassImpl(getSomeClass(), beanFromSomewhereElse); // We still need to inject beanFromSomewhereElse } } In order to import beanFromSomewhereElse we need to import it's definition. It can be defined in an XML and the we'll use @ImportResource: @ImportResource("another-application-context.xml") @Configuration public class MyApplicationContext { ... } If the bean is defined in another @Configuration class we can use the @Import annotation: @Import(OtherConfiguration.class) @Configuration public class MyApplicationContext { ... } After we imported other XMLs or @Configuration classes, we can use the beans they declare in our context by declaring a private member to the @Configuration class as follows: @Autowired @Qualifier(value = "beanFromSomewhereElse") private final StrangeBean beanFromSomewhereElse; Or use it directly as parameter in the method which defines the bean that depends on this beanFromSomewhereElse using @Qualifier as follows: @Bean(name = "anotherBean") public AnotherClass getAnotherClass(@Qualifier (value = "beanFromSomewhereElse") final StrangeBean beanFromSomewhereElse) { return new AnotherClassImpl(getSomeClass(), beanFromSomewhereElse); } Importing properties is very similar to importing bean from another xml or @Configuration class. Instead of using @Qualifier we'll use @Value with properties as follows: @Autowired @Value("${some.interesting.property}") private final String someInterestingProperty; T…

http://stackoverflow.com/comment/36934436
type: Comment
type: AnswerComment
has text: Well, the numbers that I did observe flying by in the logs were *representable* in base 2, or could be interepreted as a number in base 2 (128, 64, 32, etc), but the numbers themselves are still base 10.
score: 0
comment on: http://stackoverflow.com/a/23971883

http://stackoverflow.com/comment/36941564
type: AnswerComment
score: 0
type: Comment
has text: @EJP - I was going to pick you up on that typo. But then I thought you might have meant it :-)
comment on: http://stackoverflow.com/a/23975859

http://stackoverflow.com/comment/37110263
comment on: http://stackoverflow.com/q/24066168
score: 1
type: Comment
type: QuestionComment
has text: Add `JTable` inside `JScrollPane` not opposite. `jt.add(jps);` not correct instead it should be like `JScrollPane jps = new JScrollPane(jt);` or call `jps.setView(jt)`

http://stackoverflow.com/a/23968434
accepted answer of: http://stackoverflow.com/q/23968316
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23968316
has comment: http://stackoverflow.com/comment/36937782
has comment: http://stackoverflow.com/comment/37001401
type: Answer
score: 0
has body: Please Add below code line after super.onCreate(savedInstanceState); in onCreate() Method of MainActivity Class, it will solve your problem. setContentView(R.layout.fragment_main);

http://stackoverflow.com/comment/36896692
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23951571
has text: first i want to do in core java

http://stackoverflow.com/a/23961724
type: Answer
has body: You can express this as a character class and include spaces in it: when is ([\w ]+).
score: 0
answers question: http://stackoverflow.com/q/23961684

http://stackoverflow.com/comment/37048449
type: QuestionComment
score: 1
has text: I just downloaded a fresh copy of Eclipse Kepler and it worked flawlessly. I don't know why previous copy didn't work, but I don't care now.
comment on: http://stackoverflow.com/q/24023956
type: Comment

http://stackoverflow.com/q/23990131
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
tagged with: database
has answer: http://stackoverflow.com/a/23992100
tagged with: jtable
score: 0
answer count: 1
has body: 1- I am Using NetBeans 7.4 GUI Builder, and i want to have a JTable that has some data. the Tutorial in netbeans website shows how to connect an existing DB table to the Jtable, but i want to write my own query and show the results in the JTable, how to do that? 2-when i was following the tutorial in netbeans, the table shows its bound to a Table in Java DB, but when I run the program the JTable appears empty, it has rows, but no data, is there a code i have to write to populate the data other than the steps mentioned in the tutorial? this is a link to the tutorial
has title: Connecting JTable content to Java DB
tagged with: netbeans

http://stackoverflow.com/comment/46378124
score: 1
has text: Can you give a code snippet which does not work?
comment on: http://stackoverflow.com/q/24029998
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37155604
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24090357
has text: @Braj I need the replace to be case insensitive, and also, I'm using google web tookit, which compiles the java code to javascript. So the regexes, etc have to be javascript compatible. And so there isn't an easy way available to escape user input so it can be used in replaceAll.
score: 0

http://stackoverflow.com/q/24073964
has comment: http://stackoverflow.com/comment/37124380
accepted answer: http://stackoverflow.com/a/24074011
has comment: http://stackoverflow.com/comment/37126035
tagged with: class
has comment: http://stackoverflow.com/comment/37124402
tagged with: arrays
downvote count: 0
answer count: 1
has title: Java - Checking whether an array of objects contains a certain string
favorite count: 0
linked to: http://stackoverflow.com/q/5010044
has answer: http://stackoverflow.com/a/24074011
linked to: http://stackoverflow.com/q/7702853
score: 2
has body: I'm trying to check whether an array of objects contain a specific string. This is the constructor I have for Product object: public Product() { name = "No name yet"; demandRate = 0; setupCost = 0; unitCost = 0; inventoryCost = 0; sellingPrice = 0; } This is the initialisation of the array: Product[] product = new Product[3]; I found similar questions here Checking if long is in array and here Look if an array has an specified object. So I tried this code: public boolean isAProduct(String nameOfProduct) //Returns true if a name has been found otherwise returns false { boolean found = false; int counter = 0; while (!found &amp;&amp; (counter &lt; MAXNUMBEROFPRODUCTS)) { if (Arrays.asList(product).contains(nameOfProduct)) { found = true; } else { counter++; } } return found; } But this doesn't work as it allows me to enter the same name for a product twice. So my question is, is what I'm attempting even possible? If not, how could I go about solving the problem? Any advice would be greatly appreciated.
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/37124424
tagged with: java
type: Question
tagged with: object

http://stackoverflow.com/q/23998057
has answer: http://stackoverflow.com/a/28897804
type: AnsweredQuestion
tagged with: netbeans
has body: Not quite sure whether I'm using the right terminology here, but Netbeans has a very nice feature where e.g. if you start typing for it will offer to write a code fragment looping over an array or list, basing it on the name and type of an array or list variable actually in scope. If more than one such variable is in scope it will guess, sometimes correctly and sometimes not. Is there a way to aim this feature at the correct array/list variable?
tagged with: java
possible better answer: http://stackoverflow.com/a/29154678
type: Question
has answer: http://stackoverflow.com/a/29154678
accepted answer: http://stackoverflow.com/a/28897804
has title: Aiming Netbeans code snippets
score: 0
answer count: 2

io
tags question: http://stackoverflow.com/q/24009683
tags question: http://stackoverflow.com/q/24007579
tag name: io
tags question: http://stackoverflow.com/q/24089748
tags question: http://stackoverflow.com/q/24072071
tags question: http://stackoverflow.com/q/24001535
tags question: http://stackoverflow.com/q/23980802
tags question: http://stackoverflow.com/q/24073871
type: Tag
tags question: http://stackoverflow.com/q/24059645
tags question: http://stackoverflow.com/q/23981269
tags question: http://stackoverflow.com/q/24067134

http://stackoverflow.com/q/24095168
has comment: http://stackoverflow.com/comment/37164612
linked to: http://stackoverflow.com/q/10812668
has answer: http://stackoverflow.com/a/26182282
has body: i tried different fixes avaiable with this name. but non worked. i have following under printenvi. PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/root/bin:/home/thinkvidya-kiran/programs/jdk1.6.0_45/bin:/home/thinkvidya-kiran/programs/jdk1.6.0_45/bin:/home/thinkvidya-kiran/programs/james-2.3.2/bin:/home/thinkvidya-kiran/programs/grails-2.1.1/bin PWD=/usr/lib/jvm JAVA_HOME=/home/thinkvidya-kiran/programs/jdk1.6.0_45 tried sudo ln -s /path/to/jre*/bin/java /usr/bin/java and java and javac are giving me correct output. and i tried putting -vm thing in eclispe.ini. non working for me its giving following error. | Loading Grails 2.1.1 | Configuring classpath. | Environment set to development..... | Compiling 1 source files.. | Compiling 2 source files. | Error Compilation error: startup failed: General error during semantic analysis: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings java.lang.ClassNotFoundException: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings at org.codehaus.groovy.tools.javac.JavacJavaCompiler.findJavac(JavacJavaCompiler.java:190) at org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:49) at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:97) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:513) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:482) at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:60) at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:216) at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:935) at org.codehaus.groovy.grails.compiler.Grailsc.compile(Grailsc.java:79) at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:629) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun…
has comment: http://stackoverflow.com/comment/37164195
has title: unable to locate the java compiler com.sun.to while running grails app in ubuntu
tagged with: ubuntu
tagged with: grails
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37164331
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25938366
score: 2
has comment: http://stackoverflow.com/comment/37164423
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/51047230
type: Comment
score: 0
has text: See the original question - I added what ended up being the issue: "I just had to change permissions to those files and it successfully built."
type: AnswerComment
comment on: http://stackoverflow.com/a/24068027

http://stackoverflow.com/a/23997076
score: 7
has comment: http://stackoverflow.com/comment/36981459
upvote count: 7
accepted answer of: http://stackoverflow.com/q/23997031
has body: This has nothing to do with XML. You're using Class.getResourceAsStream, which is meant to get a resource to be loaded from the classpath for that class's class loader... but you're passing in a filename instead. If you want to create an input stream for a file, just use FileInputStream: Document document = dBuilder.parse(new FileInputStream("C:\\Tools\\test.xml")); Or better, in order to close the stream: Document document: try (InputStream stream = new FileInputStream("C:\\Tools\\test.xml")) { document = dBuilder.parse(stream); }
answers question: http://stackoverflow.com/q/23997031
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/64074075
type: Answer

http://stackoverflow.com/comment/37065670
score: 0
comment on: http://stackoverflow.com/q/24042095
type: Comment
type: QuestionComment
has text: Only open file for view. User can save the File localy and then upload if they need...

http://stackoverflow.com/comment/37115036
type: Comment
type: QuestionComment
has text: @Sting - The compiler error should never have been "casted away". You don't convert from one type to another by merely casting, and especially between two differing size ints (what is `sizeof(jint)` and `sizeof(DWORD)`? Are they the same?). Remove the cast, and get the compiler to compile the code wihtout it.
score: 0
comment on: http://stackoverflow.com/q/24068308

http://stackoverflow.com/comment/37032384
comment on: http://stackoverflow.com/a/24024079
type: Comment
has text: Hi, good answer but in "Check Status" and "Simple Logic", `editor.commit();` has no sense.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37042651
has text: That's...not an error. That's just a warning. Recompile with `-Xlint:unchecked` to see what the warning is telling you. It may be important.
comment on: http://stackoverflow.com/q/24029867
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24058330
tagged with: hdfs
tagged with: path
favorite count: 0
has answer: http://stackoverflow.com/a/24058967
tagged with: file
upvote count: 1
has body: When I Set the following Path: Path file = new Path("hdfs://hdp2minion1.domain.com:8020/apps/hive/warehouse/temp_hbase/"); It returns a FileNotFoundException (temp_hbase is a folder on HDFS). I want to simply include all the files inside that folder. Is there any other means to achieve this? Use of wildcards doesn't work here.
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/24058967
has title: Including all files in folder in the HDFS path
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36973641
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23993169
type: QuestionComment
has text: why don't you split them and get it in that format?

substance
tag name: substance
type: Tag
tags question: http://stackoverflow.com/q/24094284

http://stackoverflow.com/comment/37012367
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24013819
has text: Don't you use Java 7?
score: 0

http://stackoverflow.com/comment/37033950
type: Comment
has text: _" it encounters Socket Closed errors all the time, and sometimes does not work at all"_ -- this is not sufficient. Please show a stack trace (and tell us what statement threw the exception) for the failures, and explain _"sometimes does not work at all"_.
score: 0
comment on: http://stackoverflow.com/q/24025029
type: QuestionComment

http://stackoverflow.com/comment/36895191
type: QuestionComment
comment on: http://stackoverflow.com/q/23951001
has text: i am getting all the other diagonals as i have found that when we add the indexes, they are the same eg 00 or 01 10 or 12 21 11..... But am not getting the logic fr dese diagonals
score: 0
type: Comment

http://stackoverflow.com/a/23983224
type: Answer
answers question: http://stackoverflow.com/q/23982878
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23982878
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36956090
has body: There are several modifications to be done in the program. When you are asking user to enter the choice for inputting more, you should accept his/her choice in your userAnswer variable before closing off the do-while loop SO THAT THE USER CHOICE CAN BE CHECKED AFTER EACH ITERATION! There is no need to break the OUTER-LOOP without checking user's input! scoreCount &amp; scoreTotal need to be initialised with 0 again in the beginning of the do-while loop. The corrected program along with the imports needed :- import java.text.NumberFormat; import java.util.Scanner; public class JavaApplication7 { public static void main(String[] args) { System.out.println("Please enter the number of test scores to be entered"); System.out.println("To end the program enter 999."); System.out.println(); // print a blank line int scoreCount = 0,scoreTotal = 0; int testScore = 0; int min = 100; int max = 0; int counter = 0; int setNumber = 0; String userAnswer = "n"; Scanner sc = new Scanner(System.in); // get a series of test scores from the user do { // user enters number of test scores to be entered System.out.print("Enter the number of test scores to be entered: "); setNumber = sc.nextInt(); if (setNumber &gt; 0 &amp;&amp; setNumber != 999) { scoreCount=0; scoreTotal=0; while (setNumber &gt; 0) { // user enters test scores System.out.print("Enter score: "); testScore = sc.nextInt(); if (testScore &lt;= 100) { scoreCount += 1; scoreTotal += testScore; setNumber --; } //Added for Exercise 2-2, #4 modified if statement else if (testScore &gt; 100 || testScore &lt; 0) { System.out.println("Invalid entry, score not counted"); } else if (testScore == 999) { System.out.println("Average test score complete"); } if (testScore &gt; max &amp;&amp; testScore &lt;= 100) { max = testScore; } if (testScore &lt; min &amp;&amp; testScore &gt;= 0) { min = testScore; } } // display the score count, score total, and average score // Added casting from int ot double Exercise 3-2 #5 double averageScore = (…

http://stackoverflow.com/a/24091786
downvote count: 0
has body: You can store the return value of the JOptionPane as such: int result = JOptionPane.showConfirmDialog(window, "Are you sure you want to quit?", "Confirm Quit", JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.YES_OPTION) System.exit(0);
answers question: http://stackoverflow.com/q/24091730
has comment: http://stackoverflow.com/comment/37158704
type: Answer
accepted answer of: http://stackoverflow.com/q/24091730
has comment: http://stackoverflow.com/comment/37158360
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/37117888
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24069777
has text: This thread got answered by using "300" as value but mine got also text
score: 0

http://stackoverflow.com/comment/37108576
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24065111
has text: You are in the finally block w/out catching any exceptions. Are you certain something hasn't gone south in makePersistant that might effect this case.

http://stackoverflow.com/comment/37108049
type: Comment
type: QuestionComment
has text: Without having tested it (an http://stackoverflow.com/help/mcve would be helpful here) : I'm pretty sure that you somehow have to *copy* the part of the graph that should appear *twice*. Otherwise, how should the graph remain in a "consistent" state? E.g. what should `g.getOutEdges(3)` return for the output graph? Depending on what your nodes are, you have to think about how you can make them "unique". That is, when your Nodes are simply `Integer` objects, then this will most likely not be possible at all, because you can't distinguish the both `3`-nodes that will exist in the output.
comment on: http://stackoverflow.com/q/24061404
score: 0

http://stackoverflow.com/q/24096006
has answer: http://stackoverflow.com/a/24096035
has body: For Example: int[] array={1, 1, 2, 2, 2, 3, 3} the array is sorted and each element of array occurred more than two times and return true. if int[] array={1, 2, 2, 2, 3, 3} the array is sorted but 1 occur in array only one time should return false. Following are the code for checking the array is sorted or not , if array is sorted return true if not return false: public class Second { public static void main(String[] args){ int[] array = {7,6,3,4,5}; boolean sorted = true; for(int i = 1; i &lt; array.length; i++) { if(array[i-1] &gt; array[i]){ sorted = false; break; } } System.out.println("Sorted: " + sorted); } How i achieve my second task in the above code for occurrence of element more than two times should return true, otherwise return false.
has comment: http://stackoverflow.com/comment/37165885
accepted answer: http://stackoverflow.com/a/24096234
type: AnsweredQuestion
score: -5
tagged with: java
possible better answer: http://stackoverflow.com/a/24096053
downvote count: 5
has comment: http://stackoverflow.com/comment/37165784
has answer: http://stackoverflow.com/a/24096053
type: Question
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/24096234
favorite count: 0
answer count: 3
has title: How to find occurrence of element more than 2 in Arrays

http://stackoverflow.com/q/24057120
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37094515
tagged with: apache-poi
upvote count: 3
has body: I am using SXSSF to write 1 Million(worst case scenario) records. Following is the way i have coded it. I have to write the records to an already existing excel template. This template is available in the class path. I will copy this template to a common location. Load this file using XSSFWorkBook. SXSSFWorkbook is initialized with XSSFWorkBook and window size(-1) as parameter. when ever the record count reaches multiple of 100, i will flush the sheet. Pseudo Code: if(count % 100 == 0){ ((SXSSFSheet)sheet).flush(100); //keeps only 100 rows in memory } But while executing this, heap memory is gradually increasing and it ends up in Outofmemory exception. Maximum heap memory size of my machine is about 1.5 GB. Heap memory might be big in actual server. But i am worried as the application has multiple threads they all creates big excel files. Is it an expected behaviour? ie. is it expected to go beyond 1.5 GB while writing record of size ~ 1 Million? But as given in POI doc, SXSSF is not supposed to go out of memory as it flushes rows to the disk.
downvote count: 1
tagged with: excel
type: Question
has title: outOfmemory exception while writing big excel file using SXSSF
has comment: http://stackoverflow.com/comment/37094363
tagged with: java
has comment: http://stackoverflow.com/comment/90526540
has comment: http://stackoverflow.com/comment/90554736
has answer: http://stackoverflow.com/a/24074409
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/37166518
type: Comment
type: QuestionComment
score: 0
has text: "*I have maze and mdp packages in the same root*" no you don't, they are in separate projects.
comment on: http://stackoverflow.com/q/24096369

http://stackoverflow.com/comment/36944253
has text: Please paste the full error trace. These 4 lines are not indicative enough.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23977324
type: QuestionComment

http://stackoverflow.com/q/24025996
score: 1
tagged with: java
has body: I am trying to do a login in Java as a user. I need to access to a protected folder. I did it as an admin with web.xml. <web-resource-collection> Seguridad /protegido/admin/* </web-resource-collection> admin admin FORM /protegido/admin/login.jsp /protegido/admin/error.jsp I need to access to a folder inside of protegido called usuarioRegistrado. I have some doubts about doing this. My html of login is a bootstrap modal. Inicio de Sesión Usuario Contraseña Iniciar Sesión Cerrar Can I do this with a servlet like in the modal or I have to use j_security_check in the action. And if in the case i have to do the second one how i can set the web.xml
type: Question
upvote count: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/37035629
answer count: 1
has answer: http://stackoverflow.com/a/24027687
has comment: http://stackoverflow.com/comment/37036507
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37038721
has title: Login as a user in Java
has comment: http://stackoverflow.com/comment/37035683
downvote count: 0

http://stackoverflow.com/q/23946694
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24309888
has comment: http://stackoverflow.com/comment/36893055
has body: I am trying to set up a "parent-child" dialog relationship where I want to enter in information on the child dialog (say in a textbox) and allow that information to be displayed (or transferred) to the parent dialog (say on a label) where it can be saved as a String int etc Is there a way to do this? Any code samples would be appreciated.
tagged with: java
tagged with: swt
has title: Java SWT - Parent and Child Dialog Communication
downvote count: 1
type: Question
score: -1
tagged with: swtbot
upvote count: 0

http://stackoverflow.com/q/23993799
tagged with: javascript
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/30876711
has body: We have observed the httpOnly attribute has some changes in java 6 Update 71, due to which my JSessionIDSSO cookie has the attribute httpOnly as true. just need to check , has anyone faced the same issue ? Now my JNLP application which uses JSessionIDSSO is broken as it is not able to read JSessionIDSSO. Doing httpOnly attribute for JSessionIDSSO as false, let it work. Can anyone suggest the solution for this behaviour.? thanks
has title: Changes in Java 6 update 71 regarding httpOnly = true
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36974886
tagged with: cookie-httponly
tagged with: java
tagged with: httponly
type: Question
has comment: http://stackoverflow.com/comment/37148357

http://stackoverflow.com/q/24053786
has title: Can't downgrade database from version 2 to 1 even after fresh install and re-run
linked to: http://stackoverflow.com/q/15018025
has answer: http://stackoverflow.com/a/24053884
has answer: http://stackoverflow.com/a/24053916
accepted answer: http://stackoverflow.com/a/24053893
tagged with: sqlite
downvote count: 0
answer count: 10
favorite count: 0
has answer: http://stackoverflow.com/a/56684317
tagged with: android
has comment: http://stackoverflow.com/comment/44194829
has answer: http://stackoverflow.com/a/45196595
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/57123163
linked to: http://stackoverflow.com/q/11365706
tagged with: java
possible better answer: http://stackoverflow.com/a/54568632
has answer: http://stackoverflow.com/a/24053893
has answer: http://stackoverflow.com/a/54568632
type: Question
upvote count: 15
has comment: http://stackoverflow.com/comment/37087204
has answer: http://stackoverflow.com/a/24053980
has answer: http://stackoverflow.com/a/42424767
tagged with: database
score: 15
has answer: http://stackoverflow.com/a/48235257
has body: I'm writing an android app using SQLite DB. I had few experiments and changed the DB version from 1 to 2. Then my DB schema became stable and because i didn't release the app and it's for my own use I have decided to change the version to 1 again. I did fresh install and everything worked fine. But then running for the second time throws this error: 06-05 10:03:35.683: E/AndroidRuntime(9010): android.database.sqlite.SQLiteException: Can't downgrade database from version 2 to 1 06-05 10:03:35.683: E/AndroidRuntime(9010): at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:361) Why is that, after all I did fresh install and the DB should have been removed as well. No? How can i change the version to 1 again?

http://stackoverflow.com/comment/64061833
has text: same solution works for 2016.1
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/38317411

http://stackoverflow.com/comment/37151003
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24087983
has text: @RandomHuman: do they access other external resources (files, sockets, ...)?
type: AnswerComment

http://stackoverflow.com/q/23965037
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: samba
has body: Why can't I move files in java with source.renameTo(new File(target)); to a samba share mounted to /mnt/foo (cifs mount in /etc/fstab) I can use mv, cp with that share - it works perfectly. The java code works on the local drive and is ok but it doesn't work with the mounted samba share. Any idea why? How can I move files with java to a mounted folder? (I only get a failed to move file (false) no exception ...)
type: Question
has answer: http://stackoverflow.com/a/23965139
has title: java move file to mounted samba share
tagged with: file-io
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23965139
tagged with: linux

http://stackoverflow.com/q/24017645
tagged with: cookies
tagged with: java
type: Question
has body: I'm running in this issue, how can I set session cookie name by code in Jetty 8? ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); sessionHandler = new SessionHandler(); sessionHandler.getSessionManager().setSessionCookie("JSESSIONID_"+runningPort); context.setSessionHandler(sessionHandler); Is wrong, in Jetty8 SessionManager setSessionCookie(String) was removed.
has answer: http://stackoverflow.com/a/31026565
downvote count: 0
linked to: http://stackoverflow.com/q/1146112
possible better answer: http://stackoverflow.com/a/31026565
answer count: 3
score: 1
has answer: http://stackoverflow.com/a/24018738
favorite count: 0
has answer: http://stackoverflow.com/a/24018645
accepted answer: http://stackoverflow.com/a/24018738
tagged with: jetty
upvote count: 1
type: AnsweredQuestion
has title: Set Jetty session cookie name programmatically

http://stackoverflow.com/a/24079550
has body: By default the Content-type is "text/plain" So change the Content-type to "application/x-www-form-urlencoded" xmlhttp.open("POST", "SaveXML", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); console.log(xmlhttp);
type: Answer
has comment: http://stackoverflow.com/comment/37140198
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24072578
answers question: http://stackoverflow.com/q/24072578
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37141166
comment on: http://stackoverflow.com/a/24082574
has text: Just came to the same conclusion when I found this article: http://java-performance.info/updating-final-and-static-final-fields/ Still, even when I use reflection again to view the set value at in-lining RunTime, I still get the same result. :S
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37094248
comment on: http://stackoverflow.com/a/24048255
score: 0
type: AnswerComment
type: Comment
has text: Yeah, turns out that all of the tutorials are silly. A colleague of mine eventually managed to point this out to me

http://stackoverflow.com/a/23983342
downvote count: 0
has comment: http://stackoverflow.com/comment/36985655
has comment: http://stackoverflow.com/comment/37030736
has comment: http://stackoverflow.com/comment/36959604
type: Answer
has comment: http://stackoverflow.com/comment/37029626
has comment: http://stackoverflow.com/comment/36986964
has comment: http://stackoverflow.com/comment/36956152
has comment: http://stackoverflow.com/comment/37033145
has comment: http://stackoverflow.com/comment/36984861
upvote count: 1
has comment: http://stackoverflow.com/comment/36956324
accepted answer of: http://stackoverflow.com/q/23983165
has body: There are more films than those that satisfy your original query, and your query doesn't necessarily count each movie just once. There's big difference between select distinct (count(?var) as ?nVar) … and select (count(distinct ?var) as ?nVar) …. The first only shows you distinct counts, whereas the second shows you the number of distinct bindings. You can get more than one result row for each movie. In this part of your query: ?movie rdf:type dbpedia-owl:Film. ?movie dcterms:subject ?cat . ?cat rdfs:label ?movie_year . FILTER regex(?movie_year, "^[0-9]{4} ", "i") you'll get a result row for a each matching label of each category to which the movie belongs. E.g, if some film is in categories 1984's Worst Movies and 2010 Film Remakes, you'll get two result rows. There are also legitimate films that you won't be counting, because some films might not have an English movie title or a category that begins with a year. I'm not sure whether you'll be able to get entirely satisfactory results, since it appears that DBpedia just doesn't reliably have the data that you want. That said, try a query like this to get started. It will get all films, and and will (hopefully) pull out enough information to get dates in many cases. Some the dbpprop:released values are very strange though, and I don't know how useful they'll be to you. select * where { ?film a dbpedia-owl:Film optional { ?film dbpprop:released ?released } optional { ?film dbpedia-owl:releaseDate ?releaseDate } optional { ?film dcterms:subject [ rdfs:label ?catLabel ] filter( regex( ?catLabel, "^[0-9]{4}.*films", "i" ) ) } } order by ?film limit 100 <a href="http://dbpedia.org/sparql?default-graph-uri=http://dbpedia.org&amp;query=select%20%2a%20where%20%7B%20%0D%0A%20%20?film%20a%20dbpedia-owl%3aFilm%20%0D%0A%20%20optional%20%7B%20?film%20dbpprop%3areleased%20%20%20%20%20%20%20%20?released%20%20%20%20%7D%0D%0A%20%20optional%20%7B%20?film%20dbpedia-owl%3areleaseDate%20?releaseDate%20%7D%0D%0A%20%20optional%20%7B%20?fi…
score: 1
answers question: http://stackoverflow.com/q/23983165
has comment: http://stackoverflow.com/comment/36985260
has comment: http://stackoverflow.com/comment/36959216
has comment: http://stackoverflow.com/comment/36959486
has comment: http://stackoverflow.com/comment/36955986
has comment: http://stackoverflow.com/comment/36955996
has comment: http://stackoverflow.com/comment/37033639
has comment: http://stackoverflow.com/comment/36959397
type: AcceptedAnswer

http://stackoverflow.com/comment/37033501
has text: did your queue deployed in tomcat ? JMS listener and startup servlet would work .
comment on: http://stackoverflow.com/q/24024599
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36988395
score: 1
comment on: http://stackoverflow.com/q/24000709
type: QuestionComment
has text: because you didnt properly override onPostExecute so it does not call what you have
type: Comment

http://stackoverflow.com/comment/36914407
type: Comment
type: QuestionComment
has text: Who cares? Let it sleep however long you want it to sleep.
score: 1
comment on: http://stackoverflow.com/q/23961173

http://stackoverflow.com/comment/37022969
has text: Yes it is. I mean you keep iterating and setting Text for ever.
type: QuestionComment
comment on: http://stackoverflow.com/q/24019444
score: 0
type: Comment

http://stackoverflow.com/comment/101985219
type: Comment
comment on: http://stackoverflow.com/a/24081792
score: 7
type: AnswerComment
has text: Java is a rich set of hacks*

http://stackoverflow.com/comment/36924751
type: AnswerComment
comment on: http://stackoverflow.com/a/23966639
has text: Oh wow fail I forgot to change all the "r"s to "b"s when i copy-pasted. Thanks so much. User error :P
type: Comment
score: 0

http://stackoverflow.com/q/24045737
upvote count: 3
has comment: http://stackoverflow.com/comment/37074942
downvote count: 1
has title: Java game framerate drops
has answer: http://stackoverflow.com/a/24385321
score: 2
type: AnsweredQuestion
tagged with: frame-rate
tagged with: java
has comment: http://stackoverflow.com/comment/37073904
has comment: http://stackoverflow.com/comment/37073257
has comment: http://stackoverflow.com/comment/37073157
has body: I am developing a platform game that loads level's from images. It loops trough all the pixels of the image and checks if the RGB value matches a certain object, for example yellow for coins, white for walls. Once the player dies the level gets reloaded, however when there is also a turret in the scene the game drops in frame rate. The method that loops trough all the pixels. // Loads the requested level based on a image public void loadLevel(BufferedImage Image) { clearLevel(); int imageWidth = Image.getWidth(); int imageHeight = Image.getHeight(); currentLevel = Image; for(int Par1 = 0; Par1 &lt; imageHeight; Par1++) { for(int Par2 = 0; Par2 &lt; imageWidth; Par2++) { int currentPixel = Image.getRGB(Par1, Par2); int redValue = (currentPixel &gt;&gt; 16) &amp; 0xff; int greenValue = (currentPixel &gt;&gt; 8) &amp; 0xff; int blueValue = (currentPixel) &amp; 0xff; if(redValue == 255 &amp;&amp; greenValue == 255 &amp;&amp; blueValue == 255) { addObject(new Block((Par1 * 32), (Par2 * 32), 0, 0, 0, Identifier.Block)); } if(redValue == 255 &amp;&amp; greenValue == 0 &amp;&amp; blueValue == 0) { addObject(new Block((Par1 * 32), (Par2 * 32), 1, 0, 0, Identifier.Lava)); } if(redValue == 255 &amp;&amp; greenValue == 0 &amp;&amp; blueValue == 255) { addObject(new Block((Par1 * 32), (Par2 * 32), 5, 0, 8, Identifier.Platform)); } if(redValue == 0 &amp;&amp; greenValue == 255 &amp;&amp; blueValue == 255) { addObject(new Block((Par1 * 32), (Par2 * 32), 4, 1, 8, Identifier.Platform)); } if(redValue == 255 &amp;&amp; greenValue == 255 &amp;&amp; blueValue == 0) { addObject(new Block((Par1 * 32), (Par2 * 32), 2, 0, 0, Identifier.Coin)); } if(redValue == 0 &amp;&amp; greenValue == 255 &amp;&amp; blueValue == 0) { addObject(new Block((Par1 * 32), (Par2 * 32), 3, 0, 0, Identifier.Flag)); } if(redValue == 0 &amp;&amp; greenValue == 0 &amp;&amp; blueValue == 255) { addObject(new Player((Par1 * 32), (Par2 * 32), this, Identifier.Player)); } if(redValue == 255 &amp;&amp; greenValue == 175 …
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/37072984
favorite count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24385321
linked to: http://stackoverflow.com/q/322715
linked to: http://stackoverflow.com/q/27831498
has comment: http://stackoverflow.com/comment/37072533

http://stackoverflow.com/comment/37109802
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24048725
has text: Okay, so now your code does exactly the same thing regardless of whether or not `radius == previous`. The `if` and `else` blocks are identical, and the values get added to the `data` collection regardless.
type: AnswerComment

http://stackoverflow.com/comment/37133772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24078814
score: 0
has text: I am using mysql and field is defined as TIMESTAMP. Now I see that there is a default value which is auto generated by mysql "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP". I am trying to remove this but mysql seem to ignore my change.

http://stackoverflow.com/q/23965124
favorite count: 0
type: UnansweredQuestion
tagged with: php
has answer: http://stackoverflow.com/a/24006735
has answer: http://stackoverflow.com/a/23965169
answer count: 4
has body: I have an applet that communicates with php through http post requests and then my php script inserts data in a mysql database. So the problem is that i guess anyone can make a http post requests and add data to my mysql database if they now the "post" names and of course i dont want that. So i would like to have som solution where my php can be sure that the http requests are really from my applet and no one else. I would be grateful for ideas on how to solve this. The data being sent contains no secrets so it dont need to be encrypted if it can be solved with no encryption that is. Thanks in advance.
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
has answer: http://stackoverflow.com/a/24000204
type: Question
has title: Make sure http post comes from my applet and no one else?
has answer: http://stackoverflow.com/a/23965813
downvote count: 0
tagged with: applet

http://stackoverflow.com/a/24003084
has body: You should create your object for example array[a] = new objeto(); and after that you can use it. other wise array[a] is null
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36993146
type: Answer
accepted answer of: http://stackoverflow.com/q/24002987
answers question: http://stackoverflow.com/q/24002987

http://stackoverflow.com/a/24079384
answers question: http://stackoverflow.com/q/24078508
upvote count: 1
has body: It checks the entity id. If the id is set then we have an update, otherwise we have an insert. To check if the entity is attached or not it simply check the first level cache. If it's in the cache, then the entity is already attached.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/37083967
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24051748
has text: Changing to 'login.htm' in `@RequestMapping` will work too.
score: 0

http://stackoverflow.com/comment/36914513
has text: Logcat? Looks like trying to update the UI on a background thread
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23961197
score: 0

http://stackoverflow.com/comment/36927687
type: Comment
has text: @greg-449 Ah. Never knew that.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23963234

http://stackoverflow.com/comment/37077576
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24037536
has text: I ended up not changing anything and everything works great. no worries.

http://stackoverflow.com/comment/37130227
type: Comment
has text: Are the clients also on Solaris or are the using a browser on a different machine?
comment on: http://stackoverflow.com/q/24075170
score: 0
type: QuestionComment

http://stackoverflow.com/a/24031569
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24031262
upvote count: 2
has body: while ((size = channel.read(buffer)) &gt; -1) { buffer.rewind(); buffer.limit(size); socketChannel.write(buffer); buffer.clear(); } That's not correct at all. It can lose data any time. The correct way to write this loop is as follows: while (channel.read(buffer) &gt;= 0 || buffer.position() &gt; 0) { buffer.flip(); socketChannel.write(buffer); buffer.compact(); }
score: 2

http://stackoverflow.com/q/23954218
has comment: http://stackoverflow.com/comment/36901378
favorite count: 0
possible better answer: http://stackoverflow.com/a/23954283
tagged with: regex
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
downvote count: 1
has body: I am trying to check the entered String is alphanumeric or not.I tried some regular expressions i.e., ^[a-zA-Z0-9]+$ ^[A-Za-z0-9]*$ ^[\pL\pN]+$ But all these will work if the String contains only numeric or contains only alphabets or alphanumeric. But I need to check the String should be AlphaNumeric and Starts with a digit only. Please help me out.
type: Question
has comment: http://stackoverflow.com/comment/36901316
has title: How to Check that String is alphanumeric in Java
has comment: http://stackoverflow.com/comment/36901097
has answer: http://stackoverflow.com/a/23954289
has comment: http://stackoverflow.com/comment/36900668
answer count: 2
has comment: http://stackoverflow.com/comment/36901340
accepted answer: http://stackoverflow.com/a/23954289
has comment: http://stackoverflow.com/comment/36900929
has answer: http://stackoverflow.com/a/23954283
has comment: http://stackoverflow.com/comment/36900667

http://stackoverflow.com/a/23968861
answers question: http://stackoverflow.com/q/23967997
has body: I'm only posting this because other answers are all longer than needed. Try this: \\d+(-\\d+)?
score: 0
type: Answer

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/23970310
tags question: http://stackoverflow.com/q/24022400
tags question: http://stackoverflow.com/q/23979791
type: Tag
tags question: http://stackoverflow.com/q/23969552

http://stackoverflow.com/comment/37015124
score: 0
type: AnswerComment
has text: the popup is as in the screenshot above
comment on: http://stackoverflow.com/a/24014656
type: Comment

http://stackoverflow.com/a/24051018
has comment: http://stackoverflow.com/comment/37082351
accepted answer of: http://stackoverflow.com/q/24050897
type: Answer
answers question: http://stackoverflow.com/q/24050897
score: 2
downvote count: 0
upvote count: 2
has body: R.id.list_terbaru and R.id.list_terkirim are the ids of the ListViews. However v is not the ListView, but the View of the item. Switch on the id of the AdapterView (which is one of your ListViews in this case) instead: switch (arg0.getId()) { If there is no other error in the code (could not find one), this should solve the problem. But have you considered creating different listeners for the lists? That way you wouldn't have to switch at all.
type: AcceptedAnswer

http://stackoverflow.com/a/24030066
type: Answer
answers question: http://stackoverflow.com/q/24030010
has body: It looks like the number of days since 1 Jan 1900, possibly with a leap year screwup or two. Take a look at http://www.timeanddate.com/countdown/to?p0=198&amp;year=1900&amp;month=1&amp;day=1&amp;hour=0&amp;min=0&amp;sec=0 Microsoft Excel uses a system like this. Google "Excel serial date".
score: 6
has comment: http://stackoverflow.com/comment/37043075
has comment: http://stackoverflow.com/comment/37044933
has comment: http://stackoverflow.com/comment/37043083
type: AcceptedAnswer
downvote count: 0
upvote count: 6
has comment: http://stackoverflow.com/comment/37043044
accepted answer of: http://stackoverflow.com/q/24030010
has comment: http://stackoverflow.com/comment/37043081

http://stackoverflow.com/q/23990589
has comment: http://stackoverflow.com/comment/36969531
has answer: http://stackoverflow.com/a/23992425
type: UnansweredQuestion
has body: sample.txt FLTR TID: 0000007899 RPC ID: 0000137687 Queue: List Client-RPC: 390620 USER: taranveer.vij@unisys.com Overlay-Group: 1 I need something like this tempFile.log FLTR TID: 0000007899 RPC ID: 0000137687 Queue: List Client-RPC: 390620 USER: 3@#$@fghfkjCNBMFS!@fg Overlay-Group: 1 i tried this but i am not able to make it private static void CreateTempFile() throws IOException { BufferedReader buff=new BufferedReader(new FileReader("D:\\AdhocTask_ClientLog005.log")); PrintStream out=new PrintStream("D:\\tempFile.log"); String readline=null; while((readline=buff.readLine())!=null) { if(readline.contains("FLTR")) { String how=(String) ((String) readline.subSequence(97,142)); //this gives taranveer.vij@in.unisys.com String word=how.replace(how,"3@#$@fghfkjCNBMFS!@fg"); out.println(word); }else{ out.println(readline); } } out3.close(); buff.close(); } but in this program only "3@#$@fghfkjCNBMFS!@fg" printing in place whole line.I want full line but replace only USER filed.. something like this FLTR TID: 0000007899 RPC ID: 0000137687 Queue: List Client-RPC: 390620 USER: 3@#$@fghfkjCNBMFS!@fg Overlay-Group: 1
type: Question
tagged with: java
has title: i want to copy contents of one file to another file and wherever i encounter word "USER" replace it with "Hello"
score: -1
has comment: http://stackoverflow.com/comment/36969143
downvote count: 2
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/37039509
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24027959
has text: It's a null pointer on line 41, what line is that?

http://stackoverflow.com/comment/37126700
comment on: http://stackoverflow.com/a/24075119
score: 0
type: AnswerComment
type: Comment
has text: Mysql is running locally

http://stackoverflow.com/a/23997127
upvote count: 2
type: Answer
has body: I'd rather do the following: public class SetLightsActivity extends Activity implements View.OnClickListener { private ToggleButton toggleButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_set_lights); this.toggleButton = (ToggleButton)findViewById(R.id.toggleButton1); this.toggleButton.setOnClickListener(this); } .... @Override public void onClick(View view) { if(view == toggleButton) { boolean on = toggleButton.isChecked(); if (on) { Uri uri = Uri.parse("http://192.168.0.100/cgi-bin/cgiRelayOn.cgi"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } else { Uri uri = Uri.parse("http://192.168.0.100/cgi-bin/cgiRelayOff.cgi"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } } } } Unless it is explicitly specified that you MUST use the XML to specify the onClick listener. EDIT: By the way, you should start your second activity using an Intent, rather than just setting the content of your initial MainActivity to look like the second Activity. Your onLightClicked function should be the following: Intent intent = new Intent(this, SetLightsActivity.class); startActivity(intent);
score: 2
accepted answer of: http://stackoverflow.com/q/23996958
has comment: http://stackoverflow.com/comment/36982368
answers question: http://stackoverflow.com/q/23996958
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36982471
downvote count: 0

http://stackoverflow.com/comment/37344566
comment on: http://stackoverflow.com/q/24016964
score: 0
type: Comment
type: QuestionComment
has text: yes, but its the radius of the sphere xD It's just against the effect, if i see this code in 10 years and ask, "shit, what was im doing here..", like this i know i divide through the circles radius,

design-patterns
tags question: http://stackoverflow.com/q/24083055
tags question: http://stackoverflow.com/q/24047747
tags question: http://stackoverflow.com/q/23968494
tag name: design-patterns
tags question: http://stackoverflow.com/q/24063286
tags question: http://stackoverflow.com/q/23978289
type: Tag
tags question: http://stackoverflow.com/q/23951057
tags question: http://stackoverflow.com/q/24032453
tags question: http://stackoverflow.com/q/23973673
tags question: http://stackoverflow.com/q/23979518

mocking
tags question: http://stackoverflow.com/q/23949897
tags question: http://stackoverflow.com/q/23970619
tags question: http://stackoverflow.com/q/24083872
tags question: http://stackoverflow.com/q/24099056
tags question: http://stackoverflow.com/q/23993645
tag name: mocking
tags question: http://stackoverflow.com/q/24092879
type: Tag

http://stackoverflow.com/comment/36921634
comment on: http://stackoverflow.com/a/23963454
score: 0
type: AnswerComment
type: Comment
has text: Should I do that with all of my packages or just the jackson ones?

while-loop
tags question: http://stackoverflow.com/q/24000905
type: Tag
tags question: http://stackoverflow.com/q/24055319
tags question: http://stackoverflow.com/q/23954388
tags question: http://stackoverflow.com/q/24019203
tags question: http://stackoverflow.com/q/24071194
tags question: http://stackoverflow.com/q/24041747
tag name: while-loop
tags question: http://stackoverflow.com/q/24078587

http://stackoverflow.com/q/23987613
tagged with: php
tagged with: java
has comment: http://stackoverflow.com/comment/36963560
has body: Everyone of us is familiar with try it yourself online editor of w3schools.com. We can execute html,css,php,javascript etc. programs in 'try it'. I have implemented same feature in my project for java. Program executes using php-javabridge. When my code is class generate { public static void main(String args[]) { System.out.println("Hello World"); System.out.println("Hi World"); } } In output,it displays only: Hi World Instead,it should display: Hello World Hi World When my code is class generate { public static void main(String args[]) { System.out.print("Hello World"); System.out.print("Hi World"); } } In output,it displays everything: Hello WorldHi World What could be the possible problem behind this?Any guess?
type: Question
has comment: http://stackoverflow.com/comment/36963666
has answer: http://stackoverflow.com/a/23996584
has title: Implement tryit feature of w3schools.com for java program
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/a/41816489
type: Answer
answers question: http://stackoverflow.com/q/23975966
score: 0
has body: The solution found by the original poster was to move his enhanced JPA entity classes in a separate folder. While making sure that they were outside of the Spring scanned directories upon search for components.

http://stackoverflow.com/a/24032580
has comment: http://stackoverflow.com/comment/37047531
has body: You can use add method on your Calendar: public static String endTime = ""; DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, 10) endTime = timeFormat.format(cal.getTime());` Found in Javadoc, it takes me 30 seconds.
score: 7
answers question: http://stackoverflow.com/q/24032524
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24032524
has comment: http://stackoverflow.com/comment/37047591
upvote count: 7
type: Answer
downvote count: 0

http://stackoverflow.com/a/24056195
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24055158
has body: You can try two things: 1. Allow null in the database table design for the relative field and do something like (if the desired variable is last name) String lastName=null; public String getLastName() { return lastName; } 2. check the value of last name in the getLastName method and pass some any specific string if the value is not set. public String getLastName() { if(lastName==null) { return "null"; // or " " } return lastName; } but you need to check these value again when reading from database.
answers question: http://stackoverflow.com/q/24055158
type: AcceptedAnswer

http://stackoverflow.com/a/23989433
accepted answer of: http://stackoverflow.com/q/23989299
has comment: http://stackoverflow.com/comment/36967347
answers question: http://stackoverflow.com/q/23989299
has comment: http://stackoverflow.com/comment/36966947
type: AcceptedAnswer
has body: Simply put a check on the value of sum in JSP page and based on its value add new row. pseudo code: if sum is not null then add a new row in JSP When page is loaded first time the value of the sum will be null and when redirected by servlet the value is populated and the sum will not be null and a new row is automatically created in the JSP page. It should be like this and keep in mind the integer overflow problem. int sum=0; for (int i = 0; i < values.length; i++) { sum = sum + Integer.valueOf(values[i]); } hello.setValues(values); hello.setSum(sum); It should look like in JSP: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <c:forEach items="${helloBean.values}" var="item"> </c:forEach> <c:if test="${helloBean.sum != null}"> </c:if> Some points: ID must be unique in the whole page. Multiple input components are created with the same id val in the loop. Use double quotes around the attribute values of the each tag. Is it typo? property sum is not readable on type user.HelloBean because there is no getSum() method in class.
has comment: http://stackoverflow.com/comment/36966910
has comment: http://stackoverflow.com/comment/36966911
has comment: http://stackoverflow.com/comment/36968718
downvote count: 0
has comment: http://stackoverflow.com/comment/36968915
has comment: http://stackoverflow.com/comment/36966979
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36966823
has comment: http://stackoverflow.com/comment/36966784
score: 1
has comment: http://stackoverflow.com/comment/37004013
has comment: http://stackoverflow.com/comment/36967531

http://stackoverflow.com/q/23969221
has title: Exception java.lang.IllegalArgumentException when try access a mapped json file
has comment: http://stackoverflow.com/comment/36929874
score: 0
possible better answer: http://stackoverflow.com/a/23969451
has body: In my spring application, I am using json-taglibs to dinamically generate json files based on Lists of entities I retrieve from database and add to request in my controller. I am facing this error with one of this files: Grave: Servlet.service() for servlet [json_dispatcher] in context with path [/loja] threw exception [Request processing failed; nested exception is org.springframework.orm.hibernate4.HibernateSystemException: could not get a field value by reflection getter of com.spring.webapp.lojavirtual.common.persistence.model.Categoria.id; nested exception is org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.spring.webapp.lojavirtual.common.persistence.model.Categoria.id] with root cause java.lang.IllegalArgumentException: Can not set java.lang.Integer field com.spring.webapp.lojavirtual.common.persistence.model.Categoria.id to java.lang.String at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) at java.lang.reflect.Field.get(Field.java:379) at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:57) at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:346) at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:4746) at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:4465) at org.hibernate.engine.internal.ForeignKeys.isTransient(ForeignKeys.java:243) at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:293) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:537) at org.h…
has comment: http://stackoverflow.com/comment/36939203
has comment: http://stackoverflow.com/comment/36929380
has comment: http://stackoverflow.com/comment/36938263
has comment: http://stackoverflow.com/comment/36929405
has comment: http://stackoverflow.com/comment/36929726
tagged with: spring
has comment: http://stackoverflow.com/comment/36929515
has comment: http://stackoverflow.com/comment/36929923
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23969451
has comment: http://stackoverflow.com/comment/36929483
accepted answer: http://stackoverflow.com/a/23970519
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36930146
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23970519

http://stackoverflow.com/comment/43718912
comment on: http://stackoverflow.com/a/24006040
has text: @MR1: as noted in my edit to answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37117051
type: Comment
comment on: http://stackoverflow.com/a/24069716
score: 0
type: AnswerComment
has text: thank you! consec is the index number in Pattern, right?

http://stackoverflow.com/q/24047401
tagged with: java
tagged with: duplicates
has answer: http://stackoverflow.com/a/24047523
accepted answer: http://stackoverflow.com/a/24047523
has title: Remove duplicates in a 2D array and add the corresponding values
type: Question
score: 0
answer count: 1
has body: I know theres a lot about removing duplicates but I can't seem to get it right, I was wondering if anyone could tell me what I am doing wrong. So the code below contains a nested for loop where it traverses through a image (that is a made of a matrix of size 256x256) then it is passed to ImagePlus to calculate the radius, theta and value. The problem is that in radius there are duplicates and I want to for every duplicate to sum up the value like this: ...... r=1.44 mm/c (167), value=63 r=1.43 mm/c (167), value=77 r=1.43 mm/c (168), value=70 r=1.42 mm/c (169), value=63 r=1.42 mm/c (169), value=64 r=1.41 mm/c (170), value=70 r=1.41 mm/c (171), value=67 r=1.40 mm/c (171), value=71 ........... so It should be like: r= 1.43, value=147 (70+77) r= 1.42, value= 127 (63+64) r= 1.41, value= 137 (70+67) .... This is what I have been trying but I haven't had any luck! I have also tried using Sets but I need this to be in a specific order and it can't mess that up. final XYSeries data = new XYSeries("Third"); double rMax = -1; double [][] radiusArray = new double[256][256]; double [][] valueArray = new double[256][256]; for(int i =0; i&lt; 256; i++){ for(int y =0; y&lt; 256; y++){ //image.getPixel(i, y); //This is taking the pixel position and calculating the r and value at that pixel String x = image.getLocationAsString(i, y); String n = image.getValueAsString(i, y); String delim = ", value="; String [] tokens = n.split(delim); double num = Double.parseDouble(tokens[1]); //if(image.getR() &lt; 1.43){ String [] t = x.split("r="); String[] b = t[1].split(" mm/c"); //System.out.print("Meet b: "+b[0]); double radius = Double.parseDouble(b[0]); String [] theta = x.split("theta= "); String [] token2 = theta[1].split(Character.toString(IJ.degreeSymbol)); float thetaNum = Float.parseFloat(token2[0]); //System.out.print(" This is the theta value: "+thetaNum+" "); if(radius &gt; rMax){ rMax = radius; } radiusArray[i][y] = radius; valueArray[i][y] = num; //if(thetaNum &lt;= 180.00){ Syst…
type: AnsweredQuestion

http://stackoverflow.com/comment/37116249
has text: Don't ignore the warnings *MyInterface is a raw type. References to generic type MyInterface<T> should be parameterized* It's not generic inside `T extends MyInterface`
comment on: http://stackoverflow.com/a/24069286
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/37030753
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24023299
type: Comment
has text: @user1282637 that error is that you are initializing bitmap2 variable twice.

http://stackoverflow.com/comment/41482309
comment on: http://stackoverflow.com/a/26408397
score: 0
type: Comment
type: AnswerComment
has text: Thanks for the answer, although I had figured it out the `SleepWaitStrategy` was the root cause. When I change to `BlockingWaitStrategy`, everything is fine. BTW, how to you know Thread.yield() consumes about 70-80% of cpu by profiling?

serialization
tags question: http://stackoverflow.com/q/24077413
tags question: http://stackoverflow.com/q/23944422
tags question: http://stackoverflow.com/q/24103232
tags question: http://stackoverflow.com/q/24005223
tags question: http://stackoverflow.com/q/24096059
tags question: http://stackoverflow.com/q/23945738
tags question: http://stackoverflow.com/q/23966837
tag name: serialization
tags question: http://stackoverflow.com/q/23995088
tags question: http://stackoverflow.com/q/23988718
tags question: http://stackoverflow.com/q/24038723
tags question: http://stackoverflow.com/q/24042787
tags question: http://stackoverflow.com/q/24073871
type: Tag
tags question: http://stackoverflow.com/q/24035311
tags question: http://stackoverflow.com/q/24090651
tags question: http://stackoverflow.com/q/24038170
tags question: http://stackoverflow.com/q/24046744
tags question: http://stackoverflow.com/q/24004891
tags question: http://stackoverflow.com/q/23945586
tags question: http://stackoverflow.com/q/24070531
tags question: http://stackoverflow.com/q/24082422
tags question: http://stackoverflow.com/q/23968371

http://stackoverflow.com/comment/37164460
type: AnswerComment
comment on: http://stackoverflow.com/a/24093249
type: Comment
has text: Is that in place of txtUserName = new JTextField();?
score: 0

http://stackoverflow.com/a/46514763
answers question: http://stackoverflow.com/q/24034750
type: Answer
downvote count: 0
score: 1
has body: There are multiple options for the auto property: create - It creates new tables corresponding mapping or annotation. It drops existing tables and data. update - It keeps existing data and tables. It updates the schema. here we have to take care contracts. create-drop - It is same like create but once session gets closed it drops everything. validate - it validates or matches schema with map or annotation. It's valid for a Production environment. Propery hbm2ddl.auto = update in configuration xml. If you want to delete cascade you should add to your collection in XML the following: cascade="delete-orphan" cascade="save-update, delete"
upvote count: 1

http://stackoverflow.com/comment/36952023
has text: Thanks. I'm wondering... considering that `FULL_FLUSH` is very similar to concatenating several zlib streams... is it easy/trivial to concatenate two ZLIB streams? I think it amounts to parse the blocks to change one final to nonfinal flag, plus recomputing the Adler [your] checksum... I'm right?
comment on: http://stackoverflow.com/a/23978138
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/24047533
has comment: http://stackoverflow.com/comment/37089915
has comment: http://stackoverflow.com/comment/37079312
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38755606
score: 1
tagged with: java
tagged with: rsa
linked to: http://stackoverflow.com/q/24117040
upvote count: 1
has body: I'm quite newbie in SSL certificates and cipher suites that's why I ask for help. I have a GF4 server and standalone client. Client connects to server via iiop ssl. Client shows no exceptions but it hangs. With javax.net.debug I see that there endlessly appears the following information at client: Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_RC4_128_SHA Ignoring unavailable cipher suite: TLS_ECDH_ECDSA_WITH_RC4_128_SHA Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_RC4_128_SHA Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_RC4_128_SHA Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA Ignoring unavailable cipher suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 Ignorin…
type: Question
tagged with: jakarta-ee
has title: Javaee 7 SSL cipher suite
tagged with: ssl
tagged with: glassfish
has answer: http://stackoverflow.com/a/27022033
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37083036
favorite count: 0
accepted answer: http://stackoverflow.com/a/27022033

http://stackoverflow.com/q/24031736
has answer: http://stackoverflow.com/a/24031792
duplicate of: http://stackoverflow.com/q/9090077
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37045942
tagged with: null
has body: if (cached != null) return cached.doubleValue(); When i am using these is java, first line is saying "The operator != is undefined for the argument type(s) double, null". And 2nd line is saying "Cannot invoke doubleValue() on the primitive type double". How can i solve those two problems?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37046029
has comment: http://stackoverflow.com/comment/37046005
has answer: http://stackoverflow.com/a/24031765
has title: Catching Null values in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37045955
linked to: http://stackoverflow.com/q/9090077
has comment: http://stackoverflow.com/comment/37045959
tagged with: java

http://stackoverflow.com/q/23967467
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36926716
has comment: http://stackoverflow.com/comment/36926632
downvote count: 0
tagged with: tomcat
has title: Socket TimeOutException-Connection timed out
favorite count: 0
tagged with: google-cloud-messaging
has body: I am trying to connect with Tomcat Server(IP address-192.168.1.120 which is stored in Config.java(static variable APP_SERVER_URL)) but it is giving me socket timeout exception . How to resolve it.Please help. But when I public class ShareExternalServer { public String shareRegIdWithAppServer(Map&lt;String, String&gt; paramsMap) { String result = ""; try { URL serverUrl = null; try { serverUrl = new URL(Config.APP_SERVER_URL); } catch (MalformedURLException e) { Log.e("AppUtil", "URL Connection Error: " + Config.APP_SERVER_URL, e); result = "Invalid URL: " + Config.APP_SERVER_URL; } StringBuilder postBody = new StringBuilder(); Iterator&lt;Entry&lt;String, String&gt;&gt; iterator = paramsMap.entrySet() .iterator(); while (iterator.hasNext()) { Entry&lt;String, String&gt; param = iterator.next(); postBody.append(param.getKey()).append('=') .append(param.getValue()); if (iterator.hasNext()) { postBody.append('&amp;'); } } String body = postBody.toString(); Log.d("&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;",body); byte[] bytes = body.getBytes(); HttpURLConnection httpCon = null; try { httpCon = (HttpURLConnection) serverUrl.openConnection(); httpCon.setDoOutput(true); httpCon.setUseCaches(false); httpCon.setFixedLengthStreamingMode(bytes.length); httpCon.setRequestMethod("POST"); httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); httpCon.setConnectTimeout(20000); OutputStream out = httpCon.getOutputStream(); out.write(bytes); out.close(); int status = httpCon.getResponseCode(); Log.d("$$$$$$$$$$$$$$$$$$",String.valueOf(status)); /* if (status == 200) { result = "RegId shared with Application Server. RegId: " + regId; } else { result = "Post Failure." + " Status: " + status+regId; }*/ } finally { if (httpCon != null) { ((HttpURLConnection) httpCon).disconnect(); } } } catc…
has comment: http://stackoverflow.com/comment/36926593
has comment: http://stackoverflow.com/comment/36926573
answer count: 0

http://stackoverflow.com/q/24010468
has title: Properties in Spring 4 with @Value in class extended from GenericFilterBean
tagged with: java
type: Question
has body: OK. So the problem is when I run the application in debug mode it does get in the setter for enabled and it is set to false, but when doFilter is called enabled is always true. I've removed some comments for clarity ;-). public class CorsFilter extends GenericFilterBean { private String allowedOrigins = "^(https?://([a-zA-Z][a-zA-Z0-9\\-]*\\.)?(local|localhost)(:[0-9]+)?$"; private boolean enabled = true; @Value("${cors.enabled}") public void setEnabled(String enabled) { if (enabled != null) { this.enabled = enabled.matches("^[ \\t]*(true|1|yes)[ \\t]*$"); } } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (isEnabled()) { HttpServletResponse res = (HttpServletResponse) response; HttpServletRequest req = (HttpServletRequest) request; String requestOrigin = req.getHeader("Origin"); // ignore when origin empty or not given or not matched if (requestOrigin != null && !requestOrigin.isEmpty() && requestOrigin.matches(getAllowedOrigins())) { res.addHeader("Access-Control-Allow-Origin", requestOrigin); res.addHeader("Access-Control-Allow-Credentials", "true"); res.addHeader("Access-Control-Allow-Headers", "Accept,Authorization,Origin,Content-type"); } } chain.doFilter(request, response); } public String getAllowedOrigins() { return allowedOrigins; } public boolean isEnabled() { return enabled; } } In beans.xml: <bean id="CorsFilter" class="saas.web.filter.CorsFilter" /> In properties file: cors.enabled=false In web.xml CorsFilter saas.web.filter.CorsFilter CorsFilter /*
upvote count: 3
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24010611
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/24010611
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/23977876
has comment: http://stackoverflow.com/comment/36947470
score: 19
has comment: http://stackoverflow.com/comment/36945547
has comment: http://stackoverflow.com/comment/36945351
type: AcceptedAnswer
downvote count: 1
upvote count: 20
type: Answer
accepted answer of: http://stackoverflow.com/q/23977856
has comment: http://stackoverflow.com/comment/36946058
answers question: http://stackoverflow.com/q/23977856
has body: A HashMap does use equals() to compare keys. It only uses hashCode() to find the bucket where the key is located, and thus drastically reduce the number of keys to compare with equals(). Obviously, hashCode() can't produce unique values, since int is limited to 2^32 distinct values, and there are an infinity of possible String values. In conclusion, the result of hashCode() is not a good fit for a key of a Map.

http://stackoverflow.com/a/24021868
upvote count: 1
has body: When Future.get returns, your first task has been finished but possibly scheduled another task using the same Runnable. Invoking cancel on the first Future has no effect then as it represents the first (finished) task but not the new scheduled task. Keep in mind that each invocation of schedule will return a new Future. In the end it’s not clear why you are making the task so complicated. It’s the big advantage of background threads that they can perform blocking operations without affecting the overall program execution. So if you want to recheck a condition every two seconds just create one single background task implementing the check-every-two-seconds logic. Waiting two seconds will block that thread but that’s ok, it’s a background thread. ExecutorService service=Executors.newFixedThreadPool(1); Future&lt;?&gt; f=service.submit(new Runnable() { public void run() { try { while(conditionFalse()) { System.out.println("it’s false, will wait"); Thread.sleep(TimeUnit.SECONDS.toMillis(2)); } System.out.println("true. exiting."); } catch(InterruptedException ex) { System.out.println("interrupted. exiting."); } } }); try { try { f.get(5, TimeUnit.SECONDS); System.out.println("conditions met even before trying to cancel"); } catch(TimeoutException ex) { System.out.println("canceling"); System.out.println(f.cancel(true)? "canceled before conditions met": "conditions met before canceled"); } } catch(InterruptedException | ExecutionException ex) { throw new AssertionError(ex); } Canceling the task will end the sleep immediately which is what your question was about. As long as the conditions are not met and the task not canceled there is no need to reschedule something; the loop will just continue to run. If you have more tasks, just raise the number of threads of the executor. It might feel like resource consumption but a sleeping thread does not consume much resources and the ScheduledExecutor would maintain a Thread sleeping between the executions of your task(s) as well…
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24005755
has comment: http://stackoverflow.com/comment/37029117
accepted answer of: http://stackoverflow.com/q/24005755
type: Answer
score: 1

http://stackoverflow.com/q/23966074
has comment: http://stackoverflow.com/comment/36927903
has comment: http://stackoverflow.com/comment/36924536
has comment: http://stackoverflow.com/comment/36924007
has comment: http://stackoverflow.com/comment/36924046
has comment: http://stackoverflow.com/comment/36924063
has comment: http://stackoverflow.com/comment/36924100
has answer: http://stackoverflow.com/a/23985303
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36924151
favorite count: 0
has title: Parse.com REST API in Java (NOT Android)
has comment: http://stackoverflow.com/comment/36923969
tagged with: parse-platform
type: Question
has comment: http://stackoverflow.com/comment/36924423
accepted answer: http://stackoverflow.com/a/23985303
has comment: http://stackoverflow.com/comment/36927810
has body: I am trying to use the Parse.com REST API in Java. I have gone through the 4 solutions given here https://parse.com/docs/api_libraries and have selected Parse4J. After importing the source into Netbeans, along with importing the following libraries (which Netbeans told me I needed): org.slf4j:slf4j-api:jar:1.6.1 org.apache.httpcomponents:httpclient:jar:4.3.2 org.apache.httpcomponents:httpcore:jar:4.3.1 org.json:json:jar:20131018 commons-codec:commons-codec:jar:1.9 junit:junit:jar:4.11 ch.qos.logback:logback-classic:jar:0.9.28 ch.qos.logback:logback-core:jar:0.9.28 I ran the example code from https://github.com/thiagolocatelli/parse4j Parse.initialize(APP_ID, APP_REST_API_ID); // I replaced these with mine ParseObject gameScore = new ParseObject("GameScore"); gameScore.put("score", 1337); gameScore.put("playerName", "Sean Plott"); gameScore.put("cheatMode", false); gameScore.save(); And I got that it was missing org.apache.commons.logging, so I downloaded that and imported it. Then I ran the code again and got Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:120) at org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:122) at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:131) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:193) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at org.apache.http.impl.client.Cl…
upvote count: 3
tagged with: java
answer count: 1

http://stackoverflow.com/a/24067642
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24067440
has comment: http://stackoverflow.com/comment/37114726
type: Answer
answers question: http://stackoverflow.com/q/24067440
has body: According to the docs exec:java has no exec.args? It does have exec.arguments which takes a String[] which would translate into: CMD="mvn exec:java -Dexec.mainClass=$MAINCLASS -Dexec.arguments=\"cfg.txt\",\"TRAIN\""
has comment: http://stackoverflow.com/comment/37114709
upvote count: 1

http://stackoverflow.com/comment/37123752
has text: Why do you have a `Unique` key on `request_id` when you are knowingly inserting the same value into it?
type: QuestionComment
comment on: http://stackoverflow.com/q/24073579
type: Comment
score: 0

http://stackoverflow.com/comment/39179901
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25164994
type: Comment
has text: The does not appear to be working. The file is not found in the classpath.

http://stackoverflow.com/comment/36887477
has text: that is correct since your child function for isCoveredUnderWarranty() only examines extended warranty. You might consider adding some logic that checks the base warranty and the extended warranty to satisfy the constraint
comment on: http://stackoverflow.com/a/23946452
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36926894
type: AnswerComment
type: Comment
has text: Yeah I guessed the same too. I hope someone more knowledgeable in Androidplot can confirm this.
comment on: http://stackoverflow.com/a/23967885
score: 0

http://stackoverflow.com/comment/37135147
type: Comment
type: QuestionComment
has text: Try to debug, what are you receive in `RecipeListViewParcer(Parcel in)` constructor method?
score: 0
comment on: http://stackoverflow.com/q/24078307

http://stackoverflow.com/a/54866022
type: Answer
has body: To use allure report in chrome, you have two options: Use mvn allure:serve target. It will generate the report and open a tab in Chrome (if default browser) Generate the report using mvn allure:report target and serve the site your self, using any http server. if you have node you can use http-server for example npm install http-server -g and then http-server target/site/allure-maven-plugin) DO NOT use --allow-file-access-from-files flag, is it DANDEGEROUS
score: 8
answers question: http://stackoverflow.com/q/23997449
downvote count: 0
has comment: http://stackoverflow.com/comment/120396009
upvote count: 8

http://stackoverflow.com/a/24076736
has comment: http://stackoverflow.com/comment/37129460
has body: You define If...else block at class level which is wrong.,so write this in onPreexecute method as String URL = ""; protected void onPreExecute() { super.onPreExecute(); if (lat!=null &amp;&amp; lng!=null) { URL = "http://xyz.in/api/stores/around_me.json?app_id=test&amp;lat=" + lat + "&amp;lng=" + lng; } else { URL = "http://xyz.in/api/stores/around_me.json? app_id=test&amp;lat=12.58&amp;lng=77.38"; } }
answers question: http://stackoverflow.com/q/24076625
score: 0
type: Answer

http://stackoverflow.com/comment/37144001
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24084201
type: Comment
has text: ServiceConnection is an Interface from the Android SDK. How do I follow something that is invisible for me?

http://stackoverflow.com/a/23974212
has body: Look at the Swig docs re typemaps (section 10.1.1 of SWIG 3, in particular), there is a typemap that automatically exposes a void f(T&amp;) as a T f(), you have to tell SWIG to use it for your type. You would use %apply of the OUTPUT typemap on your type, something along the lines of %apply MyEnum&amp; OUTPUT {MyEnum&amp; theValue};
downvote count: 0
has comment: http://stackoverflow.com/comment/36940705
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36995042
score: 1
answers question: http://stackoverflow.com/q/23964264

http://stackoverflow.com/comment/36938294
type: QuestionComment
has text: I tried to check so I had to end the process because it wouldn't let me close the window. Brought it back up and when I click on Project/Properties nothing happens.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23974381

http://stackoverflow.com/a/26211764
answers question: http://stackoverflow.com/q/24096834
downvote count: 0
upvote count: 8
type: Answer
has body: It's an old question, but since this could help someone else, I am answering it. Cause of this problem is that the class org.apache.hadoop.mapred.LocalClientProtocolProvider is not found in your class-path. I resolved this error in my setup by adding below maven dependency. org.apache.hadoop hadoop-mapreduce-client-common 2.4.1 As far as the functionality of this class is concerned, I do not have more information as of now, as I myself am learning hadoop and Pig.
score: 8

http://stackoverflow.com/comment/37183560
score: 0
type: Comment
has text: Can i use the grid layout just for the jpanel?
comment on: http://stackoverflow.com/a/24104843
type: AnswerComment

http://stackoverflow.com/comment/36892564
type: Comment
comment on: http://stackoverflow.com/q/23949440
score: 0
has text: where should I override it??
type: QuestionComment

http://stackoverflow.com/comment/37010957
type: Comment
comment on: http://stackoverflow.com/q/24012699
type: QuestionComment
score: 2
has text: Where are you primary keys ?

http://stackoverflow.com/q/24065436
has comment: http://stackoverflow.com/comment/37109488
accepted answer: http://stackoverflow.com/a/24065542
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37108867
has answer: http://stackoverflow.com/a/24065623
downvote count: 0
possible better answer: http://stackoverflow.com/a/24065666
has comment: http://stackoverflow.com/comment/37109032
has answer: http://stackoverflow.com/a/24065666
has body: How i can check if a class is of a determinated type for example: // PacketHandler.java public interface PacketHandler&lt;T&gt; { public void handlePacket(T packet); } // PacketReader.java public void read() { Packet packet = // Read some input for(PacketHandler packetHandler : packetHandlers) { if (packetHandler is the type of packet) { // here is the problem packetHandler.handlePacket(packet); } } } public void registerHandler(PacketHandler&lt;?&gt; packetHandler) { packetHandlers.add(packetHandler); } // Main packetReader.registerHandler(new PacketHandler&lt;RandomPacket&gt;() { public void handlePacket(RandomPacket packet) { // I handle the packet } }); I know that this question maybe seems stupid; but how to solve this problem? **Edit***** Jon Skeet, so the class should be: public class RandomClass implements PacketHandler { public boolean handlePacket(Packet packet) { if (packet instanceof PacketThatThisClassHandle) { //handle with casting return true; } else { return false; } } }
type: Question
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24065542
has comment: http://stackoverflow.com/comment/37108781
has comment: http://stackoverflow.com/comment/37109189
has title: Check class type
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37108953

http://stackoverflow.com/comment/36960039
type: QuestionComment
type: Comment
has text: You still haven't told us what line throws the exception. What line is `engine.java:51`, line 51 of your class?
comment on: http://stackoverflow.com/q/23985626
score: 0

http://stackoverflow.com/a/30038532
upvote count: 1
answers question: http://stackoverflow.com/q/23987332
downvote count: 0
type: Answer
score: 1
has body: If you know that your TimeZone will always be DateTimeZone.UTC, then you can inject the Z in the pattern just like the T character has been injected. Something like this: DateTimeFormatter patternFormat = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); If you want to have the same format but without the milliseconds, the pattern might look something like this: DateTimeFormatter patternFormat = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'"); I am sure you have found this page, but see the Joda Time Formatting reference page for details regarding these formats and other options.

http://stackoverflow.com/a/23946571
type: AcceptedAnswer
upvote count: 6
answers question: http://stackoverflow.com/q/23946349
accepted answer of: http://stackoverflow.com/q/23946349
type: Answer
downvote count: 0
has body: Pro #1: SHA-256 is a longer hash than SHA-1 (256 bits vs. 160 bits), so the chances of finding a collision using pure brute force are much lower. Even with the iteration counts adjusted so that the time to compute a single PBKDF2 hash is the same, you will have to hash 2^96 times as many random inputs to get a match with PBKDF2-SHA-256 than with PBKDF2-SHA-1 Con #1: No one attacks password hashes using pure brute force, they use dictionary attacks, hybrid dictionary attacks, and limited-character-set attacks. All of these use a limited input space small enough that neither PBKDF2-SHA-1 nor PBKDF2-SHA-256 are likely to have any natural collisions. The limited password search space makes the size of the hash irrelevant as long as it's "big enough", and so the only thing affecting the difficulty of an attack is the time to compute a single PBKDF2 hash. Besides, PBKDF2 has a way of stretching the output length to be longer than the underlying hash length, so you can actually make the two have an equivalent output space. Pro #2: SHA-1 is at least partially broken; cryptanalysis has resulted in attacks that can find collisions faster than brute force. Once an attack is found you can usually expect it to be improved upon — this means that the suitability of SHA-1 for anything that needs to be secure more than a few minutes into the future is in doubt. Con #2: SHA-1 is "broken" in theory, but the attacks that have been found are still extremely expensive, and as far as I know they're all birthday attacks (which don't help you break a password database) and not pre-image attacks (which do). Furthermore, because PBKDF2 uses many iterations of the hash, combining rounds of hash output with the password over and over, it's difficult to extend an attack on the hash into an attack on PBKDF2. It would take a very grave attack on SHA-1 to make PBKDF2-SHA-1 insecure. Overall, I think you should prefer PBKDF2-SHA-256 on general principle, but if it's not available, PBKDF2-SHA-1 is st…
score: 6

http://stackoverflow.com/a/24022534
answers question: http://stackoverflow.com/q/24022449
has comment: http://stackoverflow.com/comment/37029073
has body: That is the way C# works, but different syntax: using javax.swing; This gives you direct access to all the types in javax.swing (not that you'd be able to do that but you get the idea). Some documentation: On the Java side: "To import all the types contained in a particular package, use the import statement with the asterisk (*) wildcard character ... Now you can refer to any class or interface in the graphics package by its simple name": http://docs.oracle.com/javase/tutorial/java/package/usepkgs.html On the C# side: "To allow the use of types in a namespace so that you do not have to qualify the use of a type in that namespace ... Create a using directive to use the types in a namespace without having to specify the namespace": http://msdn.microsoft.com/en-us/library/sf0df423.aspx
has comment: http://stackoverflow.com/comment/37028966
upvote count: 0
has comment: http://stackoverflow.com/comment/37029236
has comment: http://stackoverflow.com/comment/37029604
has comment: http://stackoverflow.com/comment/37028929
score: -3
has comment: http://stackoverflow.com/comment/37029138
type: Answer
has comment: http://stackoverflow.com/comment/37029011
downvote count: 3

http://stackoverflow.com/q/23997975
possible better answer: http://stackoverflow.com/a/23998436
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23999301
accepted answer: http://stackoverflow.com/a/23999301
has title: How to modify .docx template in either Java or Python
tagged with: http://stackoverflow.com/tag/docx
linked to: http://stackoverflow.com/q/13507424
tagged with: python
has answer: http://stackoverflow.com/a/23998436
has body: I want to be able to generate .docx files through either Java or Python based off of a template .docx file. I need to be able to insert in simple text, some bullets and a table or two. I would like suggestions on specific libraries/modules for either Python or Java that would allow me to load a template, insert basic text and tables and then save it. I have been looking into JACOB for Java and docx for Python. Any alternatives? Or will one of these be able to do what I need? Thanks in advance
linked to: http://stackoverflow.com/q/8496494
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22811845
has comment: http://stackoverflow.com/comment/73778140
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23998103

http://stackoverflow.com/q/24103419
has title: What is the input error here? And how do I connect via IP
tagged with: java
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/37181022
has answer: http://stackoverflow.com/a/24104385
type: Question
type: AnsweredQuestion
score: -2
accepted answer: http://stackoverflow.com/a/24104385
has comment: http://stackoverflow.com/comment/37181191
has comment: http://stackoverflow.com/comment/37181228
answer count: 1
favorite count: 0
has body: I'm trying to make a simple echo server so that I can get the basics down but the code doesn't run properly. It prompts the port but then the scanner (Keyboard) wigs out. You can perpetually hit enter without any errors breaking the program. I've had this problem before but I forgot how I fixed it then. Additionally, I've been having trouble creating the client socket with an Inet4Address. I continually get a mismatch error saying that the numbers in the IP are too large. Any help is much appreciated public static void main(String[] args) { try { System.out.println("PORT: "); int port = Keyboard.nextInt(); Service = new ServerSocket(port); ClientSocket = Service.accept(); input = new BufferedReader(new InputStreamReader(ClientSocket.getInputStream())); output = new PrintStream(ClientSocket.getOutputStream()); System.out.println(Service.getInetAddress()); while(true) { line = input.readLine(); output.println(line); } } catch(IOException e) { System.out.println(e); } } in the client side: for(int i = 0; i &lt; 4; i++) //taking in the IP in byte parts { System.out.println("IP PART " + (i + 1) + " : "); ip[i] = Byte.valueOf(keyboard.nextLine()); } System.out.println("PORT: "); int port = keyboard.nextInt();
tagged with: sockets
has comment: http://stackoverflow.com/comment/37181050
has comment: http://stackoverflow.com/comment/37181399
has comment: http://stackoverflow.com/comment/37181150

http://stackoverflow.com/comment/36919597
type: Comment
comment on: http://stackoverflow.com/q/23963838
score: 0
type: QuestionComment
has text: It probably does, as ubuntu 10.04 isn't supposed to be installed anywhere. Please install a [later version of the ubuntu.](https://help.ubuntu.com/14.04/installation-guide/index.html)

http://stackoverflow.com/comment/37028273
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24021067
has text: I think you have taken it in wrong way. It was by mistake did by OP. OP was not trying to create a local variable without using it anywhere. And always try to leave a comment when you **down vote** next time. I have explained it in details already.
type: AnswerComment

http://stackoverflow.com/q/24085881
has answer: http://stackoverflow.com/a/24085926
has answer: http://stackoverflow.com/a/24085911
has comment: http://stackoverflow.com/comment/37146463
tagged with: reflection
upvote count: 3
tagged with: java
score: -4
has body: Is there an easy way of return an objects public method names as a string array? My limited Java knowledge can only come up with using a reader and scan through the .java file .
duplicate of: http://stackoverflow.com/q/3023354
downvote count: 7
type: Question
answer count: 2
has title: Returning a string array of an objects methods
has comment: http://stackoverflow.com/comment/37146564
linked to: http://stackoverflow.com/q/3023354
has comment: http://stackoverflow.com/comment/37146552
favorite count: 0
has comment: http://stackoverflow.com/comment/37146661
linked to: http://stackoverflow.com/q/2529974
type: UnansweredQuestion

http://stackoverflow.com/a/24083265
has comment: http://stackoverflow.com/comment/37200262
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/24082419
score: -1
has body: You are using PHP for web. So better option is to go with Javascript rather than applet. function IsCurrentUserMemberOfGroup(groupName, OnComplete) { var currentContext = new SP.ClientContext.get_current(); var currentWeb = currentContext.get_web(); var currentUser = currentContext.get_web().get_currentUser(); currentContext.load(currentUser); var allGroups = currentWeb.get_siteGroups(); currentContext.load(allGroups); var group = allGroups.getByName(groupName); currentContext.load(group); var groupUsers = group.get_users(); currentContext.load(groupUsers); currentContext.executeQueryAsync(OnSuccess,OnFailure); function OnSuccess(sender, args) { var userInGroup = false; var groupUserEnumerator = groupUsers.getEnumerator(); while (groupUserEnumerator.moveNext()) { var groupUser = groupUserEnumerator.get_current(); if (groupUser.get_id() == currentUser.get_id()) { userInGroup = true; break; } } OnComplete(userInGroup); } function OnFailure(sender, args) { OnComplete(false); } } The usage is as below: //Usage function IsCurrentUserWithContributePerms() { IsCurrentUserMemberOfGroup("Members", function (isCurrentUserInGroup) { if(isCurrentUserInGroup) { // The current user is in the [Members] group } }); } ExecuteOrDelayUntilScriptLoaded(IsCurrentUserWithContributePerms, 'SP.js'); Link for SP.js
has comment: http://stackoverflow.com/comment/37141370
has comment: http://stackoverflow.com/comment/37200280
upvote count: 0
has comment: http://stackoverflow.com/comment/37142972
has comment: http://stackoverflow.com/comment/37141325

http://stackoverflow.com/comment/37004808
type: QuestionComment
comment on: http://stackoverflow.com/q/24006357
score: 0
has text: So the SQL actually invoked is what ? and the when you invoke that SQL manually in your datastore?
type: Comment

http://stackoverflow.com/q/24065089
score: 0
has comment: http://stackoverflow.com/comment/37108392
answer count: 1
tagged with: java
tagged with: dnode
has answer: http://stackoverflow.com/a/24067464
has comment: http://stackoverflow.com/comment/37110295
has title: DNODE as a way to make Java call NodeJS functions?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24067464
tagged with: javascript
has body: On the dnode github page (https://github.com/substack/dnode) there is a subsection that says: dnode in other languages These libraries implement the dnode protocol too so you can make RPC calls between scripts written in different languages. And one of the libraies is dnode-java. Has anyone ever used this library? Is it possible to call code/functions in NodeJS from Java using Dnode? It seems I cannot find enough documentation, examples or tutorials on this, so any help is very much appreciated.
type: Question
tagged with: node.js

http://stackoverflow.com/comment/52094675
type: Comment
has text: FWIW... while it satisfies the functional requirement, it does not sound very semantic, Runnable is commonly associated with creating threads. A simple Worker funcional interface with a doWork method would have been nice. EDIT: Oops: http://stackoverflow.com/questions/27973294/function-with-no-args-and-no-return-type-void-in-java-8?lq=1#comment44339647_27973294
comment on: http://stackoverflow.com/a/23958916
type: AnswerComment
score: 38

http://stackoverflow.com/q/24062483
tagged with: java
has comment: http://stackoverflow.com/comment/37148307
has answer: http://stackoverflow.com/a/24095981
tagged with: xslt
type: Question
tagged with: docx4j
tagged with: http://stackoverflow.com/tag/xhtml
score: 0
answer count: 1
has title: How to enable support for m:oMathPara in docx4j
tagged with: omml
type: UnansweredQuestion
has body: I'm trying to convert a docx file, which contains an equation in it, to html, but when doing so, while it renders everything else correctly, for the equation it prints: NOT IMPLEMENTED: support for m:oMath - Is there any way to get docx4j to provide html that can display equations?

http://stackoverflow.com/q/23975221
has answer: http://stackoverflow.com/a/23975274
answer count: 3
has answer: http://stackoverflow.com/a/24097449
score: 2
tagged with: arrays
downvote count: 0
has body: I'm dynamically instantiating an object through reflection, by matching fields names to like-named keys in a Map. One of the fields is a character array (char[]): private char[] traceResponseStatus; In the plinko iterator I have code for the types on the target class, eg. Collection&lt;Field&gt; fields = EventUtil.getAllFields(MyClass.getClass()).values(); for (Field field : fields) { Object value = aMap.get(field.getName()); ... else if (Date.class.equals(fieldClass)) { where the fieldClass, for example, would be Date class MyClass { private Date foo; What's the expression to test if the fieldClass type is a char[]?
favorite count: 0
linked to: http://stackoverflow.com/q/1868333
has title: How to determine if a field is of type char[] (char array) in Java?
has answer: http://stackoverflow.com/a/23975257
accepted answer: http://stackoverflow.com/a/24097449
tagged with: reflection
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/23975257
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/36920947
has text: @etherous Sure. I am looking it up on oracle docs right now, but an example would be great. But, this is exactly what I was looking for. Thanks for pointing to the right direction!
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23964343

http://stackoverflow.com/comment/36969719
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23990805
has text: If you got all the same answers, then you didn't ask enough questions. In the last few years, I have worked for both a major bank, and a funds manager. Both multi-nationals. In both organisations, using a `double` would have been almost a sackable offense. So I strongly doubt your assertion that this is the data type used by "most trading systems and investment banks".
score: 1

http://stackoverflow.com/q/24028430
type: AnsweredQuestion
tagged with: java
has title: Selenium Webdriver, Javascript link, Unable to locale Element
tagged with: selenium
tagged with: webdriver
type: Question
has body: Hi I am facing this issue, Below is a code which i had generated using Selenium IDE, Basically i am trying to access a career portal of the particular website below and for the Jobposting QA specialist, I was experimenting to auto complete the application using Selenium. 1) I am not able to replicate the code working in webdriver despite adding the code under proper class and importing all the necessary packages. 2) On running it as a TestNG test, i have a failure showing Unable to find Element. 3) The link to the QA specialist is not being detected by the driver either if i give it as identify By.link text or By.xpath. 4) please guide me where i am making mistake. 5) I am a beginer to Selenium public class Application { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://www.saymedia.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testApplication() throws Exception { driver.get(baseUrl + "/jobs"); driver.findElement(By.linkText("QA Specialist")).click(); driver.findElement(By.linkText("Apply Now")).click(); driver.findElement(By.linkText("Send Application")).click(); }
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/24028526
answer count: 1
accepted answer: http://stackoverflow.com/a/24028526
tagged with: xpath

http://stackoverflow.com/q/24104273
tagged with: reflection
score: 0
tagged with: java
type: Question
has body: in a nutshell, i'm trying to build subclasses of an abstract class, all of which will be singletons. i'd like to just place the singleton "logic" in the super class. is this possible in Java? here is the code: public abstract class Table { //the static singleton instance. this will be inherited by subclasses of this class. protected static Table m_Instance; /** * @param tableName the database table name. */ protected Table(String tableName, List&lt;Column&gt; columns) { TABLE_NAME = tableName; if(columns != null) { if(!m_Columns.isEmpty()) m_Columns.clear(); m_Columns.addAll(columns); } else { throw new IllegalStateException("the columns list was null. this is a developer error. please report to support."); } } protected static Table getInstance() { if(m_Instance == null) m_Instance = &lt;? extends Table&gt;; } } and here is just a blurb for clarification of implementation: public class CallTable extends Table { //this class would inherit 'getInstance()' and the method would return a 'CallTable' object }
has answer: http://stackoverflow.com/a/24104386
tagged with: inheritance
answer count: 2
linked to: http://stackoverflow.com/q/70689
type: UnansweredQuestion
tagged with: singleton
has answer: http://stackoverflow.com/a/24104826
has title: building singletons from an abstract class

http://stackoverflow.com/comment/36943194
type: Comment
type: QuestionComment
has text: "is next to" means the 2 can be on either side. So the question is fine.
comment on: http://stackoverflow.com/q/23976804
score: 1

sl4a
type: Tag
tags question: http://stackoverflow.com/q/24065821
tag name: sl4a

http://stackoverflow.com/comment/37011904
has text: @chrylis they are package private, non-final, so there's plenty of opportunity to `null` them before a button is clicked.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24013351
type: AnswerComment

http://stackoverflow.com/comment/37158452
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [Should I mock local method invocation inside a tested method?](http://stackoverflow.com/questions/23653583/should-i-mock-local-method-invocation-inside-a-tested-method)
comment on: http://stackoverflow.com/q/24091965

http://stackoverflow.com/comment/36917000
has text: Other words, why didn't he do this instead: `private static UnaryFuntion<T> ID_FUNC = new UnaryFunction<T> { Object apply(T arg) { return arg; }};` ? Thanks.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23957610
score: 0

http://stackoverflow.com/q/24097806
has body: I don't think it has any effect on the program output, but what class should I put the public static void main(String[] args) { //... } method in my program? Is it better form to create a separate class, or put it in a class that does something else? If I should put it in a class that does something else, which one? Does it matter? This is really just a conventions thing. Normally I create a separate class or put it in the class that deals with the gui, but I would like to know the right way of doing it.
has answer: http://stackoverflow.com/a/24097880
score: 7
has comment: http://stackoverflow.com/comment/37169151
tagged with: java
has answer: http://stackoverflow.com/a/24097917
type: Question
has title: Where should I put the public static void main(String[] args) method?
has answer: http://stackoverflow.com/a/24098453
answer count: 3
upvote count: 7
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37169129
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37169334
tagged with: conventions

http://stackoverflow.com/a/24057804
upvote count: 1
has body: The exception clearly says the problem. For Struts tags to get resolved, you need to initiliazes the Struts Filter class via web.xml. struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* More information
answers question: http://stackoverflow.com/q/24057649
score: 1
has comment: http://stackoverflow.com/comment/37094565
downvote count: 0
has comment: http://stackoverflow.com/comment/37095246
type: Answer

http://stackoverflow.com/q/24022053
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37028038
has title: Error - Installing JDK 1.8 in ubuntu
tagged with: java
has answer: http://stackoverflow.com/a/24022181
type: Question
tagged with: ubuntu
score: 0
has body: I'v tried to install jdk 8, but it still works with jdk 7. Following are the outputs, sudo update-alternatives --config javac There is 1 choice for the alternative javac (providing /usr/bin/javac). Selection Path Priority Status ------------------------------------------------------------ 0 /opt/java-oracle/jdk1.8.0/bin/javac 1 auto mode * 1 /opt/java-oracle/jdk1.8.0/bin/javac 1 manual mode sudo update-alternatives --config java There is 1 choice for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /opt/java-oracle/jdk1.8.0/bin/java 1 auto mode * 1 /opt/java-oracle/jdk1.8.0/bin/java 1 manual mode javac -version Error: could not find libjava.so Error: Could not find Java SE Runtime Environment. java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) If you can please give me a help. Thanks :)
answer count: 1
accepted answer: http://stackoverflow.com/a/24022181
tagged with: java-8

http://stackoverflow.com/comment/37115882
comment on: http://stackoverflow.com/q/24068989
score: 0
type: QuestionComment
type: Comment
has text: Thanks @EngineerDollery (+1) - however the only question I can find that is relevant to single sign **out** (not sign *in*!) is [this one](http://stackoverflow.com/questions/21258113/cas-logout-not-working?rq=1), which was caused by the user using an IP address instead of a fully-qualified domain name for their CAS server.

http://stackoverflow.com/comment/37120040
comment on: http://stackoverflow.com/q/24070917
score: 0
type: Comment
type: QuestionComment
has text: @BoratSagdiyev that's the basic approach, and you should use something similar per input that needs validation in your ` `

http://stackoverflow.com/comment/37007869
type: Comment
comment on: http://stackoverflow.com/q/24011142
type: QuestionComment
has text: I tried your code as is and it worked just fine
score: 0

http://stackoverflow.com/comment/36891218
has text: Waht exactly is your problem? I cannot see any code communicating with the arduino.
comment on: http://stackoverflow.com/q/23948722
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37131917
has text: By not full do you mean the picture was cut?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24077306

http://stackoverflow.com/a/24071545
score: -1
answers question: http://stackoverflow.com/q/24071456
has comment: http://stackoverflow.com/comment/37120441
has comment: http://stackoverflow.com/comment/37120259
upvote count: 0
has comment: http://stackoverflow.com/comment/37120378
type: Answer
has body: Hmmm... Would something like this work? //Prints the tree in level order public void printTree(){ printTree(root); } public void printTree(TreeNode tmpRoot){ //If the first node isn't null....continue on if(tmpRoot != null){ Queue&lt;TreeNode&gt; currentLevel = new LinkedList&lt;TreeNode&gt;(); //Queue that holds the nodes on the current level Queue&lt;TreeNode&gt; nextLevel = new LinkedList&lt;TreeNode&gt;(); //Queue the stores the nodes for the next level int treeHeight = height(tmpRoot); //Stores the height of the current tree int levelTotal = 0; //keeps track of the total levels printed so we don't pass the height and print a billion "null"s //put the root on the currnt level's queue currentLevel.add(tmpRoot); //while there is still another level to print and we haven't gone past the tree's height while(!currentLevel.isEmpty()&amp;&amp; (levelTotal&lt; treeHeight)){ //Print the next node on the level, add its childen to the next level's queue, and dequeue the node...do this until the current level has been printed while(!currentLevel.isEmpty()){ //Print the current value System.out.print(currentLevel.peek().getValue()+" "); //If there is a left pointer, put the node on the nextLevel's stack. If there is no ponter, add a node with a null value to the next level's stack tmpRoot = currentLevel.peek().getLeft(); if(tmpRoot != null) nextLevel.add(tmpRoot); else nextLevel.add(new TreeNode(null)); //If there is a right pointer, put the node on the nextLevel's stack. If there is no ponter, add a node with a null value to the next level's stack tmpRoot = currentLevel.remove().getRight(); if(tmpRoot != null) nextLevel.add(tmpRoot); else nextLevel.add(new TreeNode(null)); }//end while(!currentLevel.isEmpty()) //populate the currentLevel queue with items from the next level while(!nextLevel.isEmpty()){ currentLevel.add(nextLevel.remove()); } //Print a blank line to show height System.out.println(""); //flag that we are working on the next level levelTotal++; }//end while(!c…
has comment: http://stackoverflow.com/comment/37120326
downvote count: 1

http://stackoverflow.com/comment/37005687
has text: It's [this.compareTo(that)](http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html#method_detail), but what I don't get is why you're comparing an instance that is the previous to the instance calling the comparison. Perhaps, call it - `comparePrevious(...)`? Please don't put code in comments :)
comment on: http://stackoverflow.com/q/24009798
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24509293
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23970825
upvote count: 2
type: Answer
has body: First get all the elements into a list - List&lt;WebElement&gt; we = driver.findElements(By.yourLocator); Now, you can iterate over the list either using foreach loop or using index of the list

http://stackoverflow.com/q/23962401
has comment: http://stackoverflow.com/comment/36917004
has comment: http://stackoverflow.com/comment/36916860
favorite count: 0
type: UnansweredQuestion
has body: i want to check which app is currently running if it match it show Message. Here is code of my service public class MyService extends Service{ Context context; ActivityManager am ; List&lt;ActivityManager.RunningAppProcessInfo&gt; runningAppProcessInfo; Dbheltool db; String packname; String key; HashMap&lt;String, String&gt; list; public MyService(Context context) { // TODO Auto-generated constructor stub4 this.context=context; db=new Dbheltool(context); } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); Toast.makeText(this, "The new Service was Created", Toast.LENGTH_LONG).show(); am = (ActivityManager) getSystemService(context.ACTIVITY_SERVICE); runningAppProcessInfo = am .getRunningAppProcesses(); try{ db.open(); list=(HashMap)db.getPackage(); db.close(); }catch (java.sql.SQLException e) { // TODO Auto-generated catch block Toast.makeText(context, "Exception", Toast.LENGTH_SHORT); } } @Override public void onStart(Intent intent, int startId) { // TODO Auto-generated method stub super.onStart(intent, startId); Toast.makeText(this, " Service Started", Toast.LENGTH_LONG).show(); if(isThisApplicationRunning(context)){ Toast.makeText(context, "Success", Toast.LENGTH_SHORT).show(); } } @Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); } public boolean isThisApplicationRunning(final Context context) { for (final RunningAppProcessInfo app : runningAppProcessInfo) { try{ if(list.get(app.processName.toString()).equals(app.processName.toString())) { return true } } catch(NullPointerException e){ } } return false; } } when i run this app it fail and give Nullpointer Exception and service stops... please help me how to do this. Goal of my Service is...."My service is running in background and checks which app run by user. when ever user click on any app. service check app package it match to the Hashm…
tagged with: android
has title: I want to check which activity is running using service
has comment: http://stackoverflow.com/comment/36918306
has comment: http://stackoverflow.com/comment/36917224
type: Question
has comment: http://stackoverflow.com/comment/36917428
has comment: http://stackoverflow.com/comment/36917317
tagged with: java
has answer: http://stackoverflow.com/a/23962478
score: 0
upvote count: 1
linked to: http://stackoverflow.com/q/5446565
answer count: 1
downvote count: 1

http://stackoverflow.com/a/24061574
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24034598
accepted answer of: http://stackoverflow.com/q/24034598
has body: Finally i got my solution, actually it recognize correctly, i'm handling them wrong way...
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24056149
tagged with: android-activity
tagged with: timer
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24076966
type: Question
linked to: http://stackoverflow.com/q/66280882
answer count: 1
has body: I am creating application which works with SMS service and FTP networking. If user does not establish connectivity, it will try to reconnect again in 30 seconds. I am using CountDownTimer with TextView to inform user about time left to reconnnect. Either it will be successful or it will start counting again. My problem is, that if counter restarts while activity is in background or the screen is locked, TextView keeps showing number "1" (it won't update) until the timer restarts again in foreground (but updating numbers without timer restart works fine in backround or lock, I am using wakelock in my foreground service). After counter restarts again (so it won't stop counting) while application is in foreground, everything comes back to normal, TextView updates from freezed "1" to "30" and starts counting down to "1". I think problem will be somewhere in communication between counter thread and background activity with UI, but I don't know nothing more about it. I tried several things like: creating setter and getter for miliseconds and update them in each tick, then try to update textview from onReume(), didn't work. create local variable for TextView inside timer, initialize it inside onTick() and try to update text from there, also didn't work. Thanks everyone for help, I will appriciate any advices. Part of code relative to question: private CountDownTimer cdt = null; private final TextView getTextView_ActivityMainMenu_Timer(){ return (TextView) findViewById(R.id.ActivityMainMenu_TextView_Timer); } private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if(intent.getBooleanExtra("KEY_FAILED", false)){ cdt = new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { getTextView_ActivityMainMenu_Timer().setText("" + millisUntilFinished / 1000); } public void onFinish() { ; } } .start(); } else { if(cdt != null) cdt.cancel(); } } };
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24076966
has title: Android Countdown Timer in Broadcast receiver doesn't update TextView

http://stackoverflow.com/comment/36926741
type: Comment
has text: This answer only makes sense refreshList uses a *different* connection (within the same connection/transaction, COMMIT means nothing)
comment on: http://stackoverflow.com/a/23967720
type: AnswerComment
score: 0

http://stackoverflow.com/q/24007892
type: UnansweredQuestion
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/37001653
upvote count: 1
has title: Error with running application in GWT development mode
type: Question
tagged with: gwt
tagged with: java
has body: There is a strange problem with my GWT development mode. Everything is fine with my project.The project also runs well while running using tomcat but when I run the project in GWT dev mode, the different kinds of error occurs in my console. The most strange thing is that the error displayed is not same all the time.It throws different exception every time I run the project.Also, sometimes magically my project works fine even in GWT dev mode.I am suffering from this problem since long period of time.Please! can anyone help me to sort the problem. The different kinds of error are: [ERROR] [projectName] - Exception initializing module [ERROR] [projectName] - Failed to load module 'projectName' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/33.0.1750.152 Chrome/33.0.1750.152 Safari/537.36' at localhost:46087 And sometimes # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fd895353fd5, pid=7445, tid=140568325068544 # # JRE version: 6.0_45-b06 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.45-b01 mixed mode linux-amd64 compressed oops) # Problematic frame: # J org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType([CLorg/eclipse/jdt/internal/compiler/lookup/ReferenceBinding;)Lorg/eclipse/jdt/internal/compiler/lookup/ReferenceBinding; # # An error report file with more information is saved as: # /home/pushpa/esewa-default/esewa-hg/esewa-server/hs_err_pid7445.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp Please! help me to sort out the problem
downvote count: 0
has comment: http://stackoverflow.com/comment/37004425
favorite count: 0

http://stackoverflow.com/comment/36959216
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23983342
type: Comment
has text: I've finally found the query that return exactly what I need but apache Jena doesn't grant to me to use the group by option on a single variable :/ Any ideas?

http://stackoverflow.com/q/24011597
tagged with: java
possible better answer: http://stackoverflow.com/a/24013344
has answer: http://stackoverflow.com/a/24012137
type: Question
has answer: http://stackoverflow.com/a/30836489
accepted answer: http://stackoverflow.com/a/26749800
downvote count: 0
has title: Java 8 Stream - How to return replace a strings contents with a list of items to find
has body: I wish to replace the code below using java8 .stream() or .foreach(). However I am having trouble doing this. Its probably very easy, but I'm finding the functional way of thinking a struggle :) I can iterate, no problem but the but returning the modified string is the issue due to mutability issues. Anyone have any ideas ? List&lt;String&gt; toRemove = Arrays.asList("1", "2", "3"); String text = "Hello 1 2 3"; for(String item : toRemove){ text = text.replaceAll(item,EMPTY); } Thanks !
has answer: http://stackoverflow.com/a/74166605
favorite count: 0
answer count: 5
score: 13
has answer: http://stackoverflow.com/a/26749800
has answer: http://stackoverflow.com/a/24013344
tagged with: java-8
upvote count: 13
tagged with: foreach
type: AnsweredQuestion
tagged with: java-stream

http://stackoverflow.com/comment/36954957
comment on: http://stackoverflow.com/q/23982939
has text: I use phpmyadmin as my UI to see the data stored in the database. I also have a java method that reads the data from the database, which presents a list on web page. The list of books output by java also show a string of question marks.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36987969
has text: Gracias Brother espero tener tu ayuda en el futuro!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23999905
type: Comment

inheritance
tags question: http://stackoverflow.com/q/24100604
tags question: http://stackoverflow.com/q/24049964
tag name: inheritance
tags question: http://stackoverflow.com/q/24024182
tags question: http://stackoverflow.com/q/24034224
tags question: http://stackoverflow.com/q/24058143
tags question: http://stackoverflow.com/q/23976797
tags question: http://stackoverflow.com/q/24079830
tags question: http://stackoverflow.com/q/23966998
type: Tag
tags question: http://stackoverflow.com/q/24084008
tags question: http://stackoverflow.com/q/24043150
tags question: http://stackoverflow.com/q/23957414
tags question: http://stackoverflow.com/q/24059770
tags question: http://stackoverflow.com/q/24067825
tags question: http://stackoverflow.com/q/24078008
tags question: http://stackoverflow.com/q/24103122
tags question: http://stackoverflow.com/q/23992299
tags question: http://stackoverflow.com/q/23964646
tags question: http://stackoverflow.com/q/23971808
tags question: http://stackoverflow.com/q/23948009
tags question: http://stackoverflow.com/q/24104273
tags question: http://stackoverflow.com/q/23961421
tags question: http://stackoverflow.com/q/24065524
tags question: http://stackoverflow.com/q/23946536
tags question: http://stackoverflow.com/q/23973107
tags question: http://stackoverflow.com/q/23953358
tags question: http://stackoverflow.com/q/23969615
tags question: http://stackoverflow.com/q/23984757
tags question: http://stackoverflow.com/q/24010955

http://stackoverflow.com/a/23971883
score: 1
has comment: http://stackoverflow.com/comment/36934412
has comment: http://stackoverflow.com/comment/36934506
answers question: http://stackoverflow.com/q/23971831
accepted answer of: http://stackoverflow.com/q/23971831
upvote count: 1
has body: You're not working with a base-2 number; you're still working with a base-10 int. From this, all numbers for your iteration, except for the last, will fail your if condition, since they are not equal to 1.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36934519
type: Answer
has comment: http://stackoverflow.com/comment/36934436
downvote count: 0

http://stackoverflow.com/a/23951254
answers question: http://stackoverflow.com/q/23950549
has body: Simply convert the JSON string into HashMap&lt;String, Object&gt; then populate any type of custom structure by simply iterating it or create a constructor in each custom object class as shown below to populate the fields. class CustomClassDescribingJSON { public CustomClassDescribingJSON(Map&lt;String, Object&gt; data) { // initialize the instance member } } Sample code: Reader reader = new BufferedReader(new FileReader(new File("resources/json12.txt"))); Type type = new TypeToken&lt;HashMap&lt;String, Object&gt;&gt;() {}.getType(); HashMap&lt;String, Object&gt; data = new Gson().fromJson(reader, type); System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(data)); output: { "price": 123.0, "location": { "latitude": 456987.0, "longitude": 963258.0 }, "description": "some_description", "name": "some_name" }
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/36969036
type: QuestionComment
comment on: http://stackoverflow.com/q/23989625
has text: I'd prefer to return the error message over the socket, instead of just cutting down the open connection.
score: 0
type: Comment

http://stackoverflow.com/a/24003591
has comment: http://stackoverflow.com/comment/36999147
type: Answer
score: 6
answers question: http://stackoverflow.com/q/24003532
has body: The timer works concurrently. So the timer is started, then the text is set to finished, and then the timer fires and the first number appears. To make the timer display finished after it is finished, put the tTest.setText("Finished"); in the else clause of if(i&lt;10).
has comment: http://stackoverflow.com/comment/36994098
has comment: http://stackoverflow.com/comment/36994182
upvote count: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/36994062

http://stackoverflow.com/q/24099036
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
tagged with: jasper-reports
accepted answer: http://stackoverflow.com/a/24104868
answer count: 1
downvote count: 0
has body: So I have a java application that displays a jasper report. There is an image I placed in the report using the iReport plugin for netbeans. Everything displays fine on my current machine but when I try to run the compiled jar on a different machine, the report won't load. From looking at the windows console, I think it's because the path to the image is absolute, i.e. referencing a specific folder on the hard drive of the development machine. I need to make it relative to the jar file. I've placed the image into the package and have confirmed it's inside the compiled jar. But when I change the "image expression" value in iReport to "/reports/Logo.jpg" (where /reports is the package) and run the app I get EXCEPTION: Byte data not found at : /reports/Logo.jpgnet.sf.jasperreports.engine.JRException: Byte data not found at : reports/Logo.jpg Any ideas what to do? I am very stuck and would appreciate any help! UPDATE: Got it. Had to create a parameter in the report and called the parameter from the image expression. Then I created a HashMap and InputStream in the Java code and placed the input stream into the hash map! So much code for so simple a thing! Java code: //to get images to display in report, pass their relative path as input stream and add to HashMap //there must be one stream and one HashMap per image InputStream imgInputStream = this.getClass().getResourceAsStream("/reports/omacLogo.jpg"); InputStream imgInputStream2 = this.getClass().getResourceAsStream("/reports/omacLogo.jpg"); parameters.put("omacLogo", imgInputStream); parameters2.put("omacLogo", imgInputStream2); InputStream jasper1 = this.getClass().getResourceAsStream("/reports/OmacYTDReportFinalpg1.jasper"); InputStream jasper2 = this.getClass().getResourceAsStream("/reports/OmacYTDReportFinalpg2.jasper"); JasperPrint jp1 = JasperFillManager.fillReport(jasper1, parameters,new JRBeanCollectionDataSource(ie.orderofmalta.BeanFactory.getCalcs())); JasperPrint jp2 = JasperFillManager.fillReport(jasper2, p…
favorite count: 0
has answer: http://stackoverflow.com/a/24104868
has title: How to set relative path of images in report?

http://stackoverflow.com/q/23995099
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
score: -1
tagged with: java-web-start
has answer: http://stackoverflow.com/a/24009672
upvote count: 0
tagged with: apache
answer count: 1
tagged with: jar
has body: I have developed a JAVA webstart application using JNLP,am planning access jar files related jnlp from the outside webapp folder how to access those jar files.
has title: how to access external files that are not in the web app folder using apache server
tagged with: jnlp
favorite count: 0

named-query
type: Tag
tag name: named-query
tags question: http://stackoverflow.com/q/24015079

http://stackoverflow.com/comment/140144410
has text: Yes, I had tested it. Your suggestion is very correct and simple.
type: AnswerComment
comment on: http://stackoverflow.com/a/73753039
score: 0
type: Comment

http://stackoverflow.com/a/24049717
answers question: http://stackoverflow.com/q/24047747
score: 0
type: Answer
has body: You probably want something similar to a chain of responsibility (c# sorry) interface Performer { bool CanHandle(/* criteria/lambda */); void DoWork(); } class Cond { void Do() { Performer strategy=strategies.Find(s=&gt;s.CanHandle(/* condition */)); if (strategy==null) throw new NoStrategyAvailable(); strategy.DoWork(); } } Maybe not the purest Strategy pattern applied, however it's quite maintainable: if you use reflection to get all the strategies from the project, you just add a new strategy implementation and it just works.

http://stackoverflow.com/comment/37101774
comment on: http://stackoverflow.com/a/24058282
has text: Please see edit above. I have tried to explain the problem. Basically when data arrives the processMessage() is processed concurrently.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24033128
has body: The autodetect option for autowire attribute has been deprecated as of Spring 3.0. Hence, this option is not available Spring 3.0 onwards. If you see 2.5.6 XSD, the value autodetect is there, but its not available in 3.0 XSD. Your options: Try using some other option for autowire attribute. Downgrade your spring version to 2.x.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37049832
accepted answer of: http://stackoverflow.com/q/24032865
answers question: http://stackoverflow.com/q/24032865
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23987776
has body: You just check your Image_url ends with .png or not by using .endsWith(....) method of String like if(image_url.endsWith(".png")){ //your image ends with .png }else if(image_url.endsWith(".jpg")){ //your image ends with .jpg }
score: 4
answers question: http://stackoverflow.com/q/23987743
downvote count: 1
upvote count: 5
type: Answer

http://stackoverflow.com/q/23989134
answer count: 1
has body: I am using the following program for converting from hashmap to hashtable I used two different methods for converting, one is giving ht1 and other is giving ht2 What is the difference between ht1 and ht2? import java.util.HashMap; import java.util.Hashtable; import java.util.Map; public class HashMapToHashTable { public static void main(String[] args) { // TODO Auto-generated method stub Map &lt;Integer,Integer&gt;hm = new HashMap&lt;Integer,Integer&gt;(); hm.put(1, 2); hm.put(3, 4); System.out.println(hm.keySet()); //First way of converting hashmap to hashtable Map &lt;Integer, Integer&gt;ht1 = new Hashtable&lt;Integer,Integer&gt;(hm); System.out.println(ht1.keySet()); //Second way of converting hashmap to hashtable Map &lt;Integer, Integer&gt;ht2 = new Hashtable&lt;Integer,Integer&gt;(); ht2.putAll(hm); System.out.println(ht2.keySet()); } } Will this Collections.synchronizedMap(hm) also be used to convert from hashmap to hashtable? Thanks in advance.
favorite count: 0
has answer: http://stackoverflow.com/a/23989237
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Conversion ways from hashmap to hashtable
score: -1
type: Question
accepted answer: http://stackoverflow.com/a/23989237
upvote count: 0

http://stackoverflow.com/comment/36970844
has text: I have `message` which I process but what is `key`? How I generate keys from (currentTime(), message) pair?
type: AnswerComment
comment on: http://stackoverflow.com/a/23991311
score: 0
type: Comment

http://stackoverflow.com/comment/36982692
comment on: http://stackoverflow.com/a/23990661
type: AnswerComment
has text: I don't understand the final comment. [Map's `put()`](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true#put%28K,%20V%29) does declare 4 exceptions, among them there is IllegalArgumentException.
type: Comment
score: 1

http://stackoverflow.com/q/24096386
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37166996
tagged with: jcomponent
has answer: http://stackoverflow.com/a/24098188
accepted answer: http://stackoverflow.com/a/24098188
has body: am back again!. i have a probrem here. am making uneditable jcombobox. i have a list of items in it("crus","davy","shawn") and i want if someone clicks on crus, a thread of images with a Thread.sleep of 2 seconds will appear at a jlabel called picturelabel. when i try to put method run() inside method actionperformed, i get "illegal start of expression". i also get an error "not a statement" when i try to create an array of imageicon. public class Myjcombobox extends JFrame implements ActionListener,Runnable { JComboBox job; String[] items={"crus","shawn","davy","others"}; JLabel picturelabel; public Myjcombobox(){ super("oh mymy"); setSize(1000,1000); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BorderLayout border=new BorderLayout(); setLayout(border); job=new JComboBox(items); job.addActionListener(this); } public void actionPerformed(ActionEvent event){ JComboBox combo=(JComboBox)event.getSource(); String name=(String)combo.getSelectedItem(); if(name=="crus"){ public void run(){//i get an error illegal start of expression// JImageIcon[] crusimages= new JImageIcon{"crus reading.jpg","crus playing.jpg","crus in class.jpg"}; //i get an error "not a statement","( or[ expected"// } } } public static void main(String[] args) { Myjcombobox jcomb=new Myjcombobox(); }
has answer: http://stackoverflow.com/a/24096641
tagged with: swing
has comment: http://stackoverflow.com/comment/37167591
type: Question
has comment: http://stackoverflow.com/comment/37166600
score: -1
tagged with: concurrency
answer count: 2
has title: performing a thread using jcomponets
has comment: http://stackoverflow.com/comment/37166544
downvote count: 1
possible better answer: http://stackoverflow.com/a/24096641
favorite count: 0
has comment: http://stackoverflow.com/comment/37167490
has comment: http://stackoverflow.com/comment/37166591

http://stackoverflow.com/q/23948532
has comment: http://stackoverflow.com/comment/36891110
answer count: 1
has comment: http://stackoverflow.com/comment/36890968
tagged with: variables
has comment: http://stackoverflow.com/comment/36892568
type: UnansweredQuestion
tagged with: lwjgl
has answer: http://stackoverflow.com/a/23950064
has body: I am testing out a Player object in a game I am trying to build, and I have begun testing my input using a white rectangle on the screen through OpenGL in LWJGL. The problem is that when I compile the code and try moving the rectangle using the arrow keys, the rectangle only responds to RIGHT and DOWN. When testing it out in the loop, it appears the dx and dy are changing in the move() method, but the change does not persist into the updateXY() method. -SNIP- (jump problem has been fixed) I am completely stumped as to why this could be and I would love to get some help Thanks in advance EDIT: Added the AbstractMoveableEntity class EDIT: Updated the code to reflect the current problem public class Player extends AbstractMoveableEntity implements MoveableEntity { MouseHandler m; private double tx, ty; private double SPEED; private enum DIR{ UP, DOWN, LEFT, RIGHT; } public Player(double x, double y, MouseHandler m) { super(x, y, 50, 50); this.m = m; this.tx = x; this.ty = y; this.ax = 0; this.ay = 0; this.SPEED = 5; } public void draw() { glRectd(x,y,x+width,y+height); } public void update(int delta) { updateXY(); draw(); } public void updateXY(){ input(); //Updating target, velocity and position values this.tx += this.dx; this.ty += this.dy; this.dx += this.ax; this.dy += this.ay; this.x += this.dx; this.y += this.dy; //Acceleration handling if(tx &gt; x){ this.ax += 1; } else if(tx &lt; x) { this.ax -= 1; } else { this.ax = 0; } if(ty &gt; y){ this.ay += 1; } else if(ty &lt; y) { this.ay -= 1; } else { this.ay = 0; } } public void input(){ //Event-Driven input while(Keyboard.next()){ if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)){ if(ay == 0){ jump(); } else { x = tx; y = ty; ay = 0; } } } //Polled input if(Keyboard.isKeyDown(Keyboard.KEY_UP)){ move(DIR.UP); } else { stop(DIR.UP); } if(Keyboard.isKeyDown(Keyboard.KEY_DOWN)){ move(DIR.DOWN); } else { stop(DIR.DOWN); } if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)){ move(DIR.LEFT); } else { stop(DIR.LEFT); } if(Keyboard.isKeyDo…
tagged with: java
has title: My x and y variables only sometimes change
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36892457
has comment: http://stackoverflow.com/comment/36890832

http://stackoverflow.com/a/23967797
has body: If you want to initiate your call from a JavaSE application then the VoIP is your way, you have to use an IPBX like Asterisk, and configure an axternal gateway to the gsm network. And the java app have to communicate with th IPBX .
has comment: http://stackoverflow.com/comment/36926667
score: 0
has comment: http://stackoverflow.com/comment/36926740
type: Answer
has comment: http://stackoverflow.com/comment/36926873
answers question: http://stackoverflow.com/q/23967724

http://stackoverflow.com/comment/37030173
comment on: http://stackoverflow.com/q/24022780
score: 0
type: Comment
type: QuestionComment
has text: have you run your instance long enough to have any segments merged?

http://stackoverflow.com/comment/36881413
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23943292
type: QuestionComment
has text: @DavidWallace see update into question.

http://stackoverflow.com/comment/36975932
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23994338
has text: @superbob doesn;t work for interfaces

http://stackoverflow.com/q/24021106
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24021488
has body: I've found other questions using Python and app.yaml, but I'm working in Java using Eclipse. I've tried every permutation I could possibly think of including forward slashes, backslashes, opening with dots. I've tried putting the image itself in the root directory of the project. I've found similar questions on here, but they usually referenced an app.yaml. I know this should be very simple, but nothing I've tried has worked. I'm sure that I'm missing something in a configuration file somewhere. This is the first App Engine app I've tried, so I'm still feeling my way around it. This tag: &lt;img src="images/CTT_placeholder.png" /&gt; Yields this warning: Jun 03, 2014 12:53:13 PM om.google.appengine.tools.development.LocalResourceFileServlet doGet WARNING: No file found for: /images/CTT_placeholder.png The images folder is in the root of the project.
score: 0
answer count: 1
has title: Why aren't images found in Google App Engine project (Java, not using GWT)
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24021488
type: AnsweredQuestion

http://stackoverflow.com/a/23986972
answers question: http://stackoverflow.com/q/23986771
downvote count: 0
has body: I think "returned" was a poor choice of wording in your question, and that what you're asking is "when is X removed from the heap?" - i.e. "when can the memory I allocated to X be reallocated to something else?" If that's the case, you're asking about something called Garbage Collection, which is an ongoing process by which Java finds things you can't use anymore - "garbage" - and removes them from memory. Simply put, something becomes "garbage" when it becomes unreachable - when there are no remaining references to it. To use an example I think you're alluding to: void foo() { int a = 1; //do stuff return; } Each time foo() executes, memory space is allocated for a new local variable a. Each time it finishes executing, there's no way you can ever refer to that variable again, therefore it becomes eligible for garbage collection.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/36942531
comment on: http://stackoverflow.com/a/23976403
score: 0
has text: @Yarh are you sure you are using `x` and `y` as the center and not the top-left corner for the circle?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37059355
type: QuestionComment
comment on: http://stackoverflow.com/q/24038805
has text: You're also using a pretty old version of Libgdx, why not use [1.1.0](http://www.badlogicgames.com/wordpress/?p=3451)?
score: 0
type: Comment

http://stackoverflow.com/q/24046244
answer count: 1
has answer: http://stackoverflow.com/a/24046289
type: UnansweredQuestion
has body: i want to transfer control from jsp to html in my Stuts2 product. and want to call the application level variable in html page; as example: index.jsp import abc.tld file &lt;prifix:name=path/something.html jsp ends here now i want my application level variable in this html page. could it be possible? pls suggest? as i am making some product of my own purpose.in which i want to give cusotmization by using html only.
tagged with: java
type: Question
tagged with: struts
has title: how to call html in jsp by custome tag
score: 0

http://stackoverflow.com/comment/36889288
score: 1
type: Comment
has text: Have you considered searching?
comment on: http://stackoverflow.com/q/23947701
type: QuestionComment

http://stackoverflow.com/comment/37084744
has text: @vckngs7: No, the convention violations aren't the problem here. Unfortunately SO isn't really designed to be an interactive debugging tool - I think we've reached the end of how I can help you here. As for naming conventions, for some reason the official Sun (now Oracle) guide is currently unavailable, but you might want to read the Google Java style guide instead: http://google-styleguide.googlecode.com/svn/trunk/javaguide.html
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24045165
type: AnswerComment

http://stackoverflow.com/a/23943588
accepted answer of: http://stackoverflow.com/q/23943546
type: Answer
downvote count: 0
score: 1
has body: Here is how you fix it. Random randomGenerator = new Random();
answers question: http://stackoverflow.com/q/23943546
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/36941374
comment on: http://stackoverflow.com/q/23975762
score: 0
type: Comment
type: QuestionComment
has text: What line of code gives the NPE?

http://stackoverflow.com/comment/37178295
comment on: http://stackoverflow.com/q/24102020
has text: Look up the concept of **inheritance** mentioned in your question. You will need individual classes for each of the products. Ask the user for the type of product first, then create the proper one based on the input.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/37170368
type: Comment
type: QuestionComment
has text: Essentially you do have the entire table in memory at once on the mysql server. Setfetchsize is a hint (may be ignored) to deliver it in chunks to the client. it affects how many network messages are required to deliver all the data. Have a peek at this http://stackoverflow.com/questions/1318354/what-does-statement-setfetchsizensize-method-really-do-in-sql-server-jdbc-driv
comment on: http://stackoverflow.com/q/24098247
score: 1

http://stackoverflow.com/comment/36960063
has text: To me, a `Card` is container or "super" class to the actually "playable" `Card`. It describes all the common attributes that all "playable" cards should have. Now if you wanted to, you could use an external configuration file to store the details of each card, making it easy to update/add/remove properties and cards. You could devise a factory style set up that could read these properties and generate the "Deck". At some point, you're going to need to decide which approach provides you with the most flexibility for the work involved in setting it up, there's no simple way to achieve this
comment on: http://stackoverflow.com/a/23975265
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37187628
score: 0
comment on: http://stackoverflow.com/q/24101781
type: Comment
type: QuestionComment
has text: when I ps aux | grep mysql i get the following:

http://stackoverflow.com/comment/37085625
type: QuestionComment
has text: @JonSkeet You can have some of mine. I have plenty of coffee because here in Germany daily work already has started. :-)
comment on: http://stackoverflow.com/q/24052746
score: 0
type: Comment

http://stackoverflow.com/comment/36890404
has text: Thanks for ur answer, i guess it would work but I want to ask a thing, the example shown involves the use of a single key as a shortcut while i want ctrl+k, can that be implemented using this library?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23948045

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/24009849
tags question: http://stackoverflow.com/q/23949999

http://stackoverflow.com/q/24088924
tagged with: java
has comment: http://stackoverflow.com/comment/37152780
has answer: http://stackoverflow.com/a/61673094
has answer: http://stackoverflow.com/a/24089438
type: Question
has comment: http://stackoverflow.com/comment/37152689
accepted answer: http://stackoverflow.com/a/41769632
tagged with: intellij-idea
downvote count: 0
possible better answer: http://stackoverflow.com/a/24089438
answer count: 6
has comment: http://stackoverflow.com/comment/37152903
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37152989
favorite count: 0
has body: I'm using Intellij, attempting to deploy a Tomcat application, but whenever I try to run it, I get the following error: Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1098; nested exception is: java.net.BindException: Address already in use Now I've manually looked for the process happening at that port via: lsof -i:1098 And I found the java process and killed it too: ps aux | grep java kill -9 20386 And that worked, but I have to do this EVERYTIME I open Intellij. If I want to rerun the server without exiting Intellij, I can't, because I'll get this error. Does anyone know of a permanent fix for this and not just manually killing it everytime?
has answer: http://stackoverflow.com/a/51296403
has comment: http://stackoverflow.com/comment/37153343
has answer: http://stackoverflow.com/a/41769632
score: 23
has title: Solution to "java.net.BindException: Address already in use" error?
upvote count: 23
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31419871
has answer: http://stackoverflow.com/a/71282641

http://stackoverflow.com/comment/36996943
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24005265
has text: @user2341013: you're returning the result **into the method parameter**. So same thing.
score: 0

http://stackoverflow.com/q/23989743
tagged with: java
has title: Javascript function for iteration and HTML implementation
accepted answer: http://stackoverflow.com/a/23990040
answer count: 1
tagged with: jsp
tagged with: javascript
score: 0
has body: I am making a online computer store and I am trying to make a login jsp for admin and other users. The thing I want to do but don't know how, because I am not so good with JavaScript is to go through my ArrayList of users and if the user has an attribute isLoggedIn == true, to display this chunk of code Izloguj se (<%=k.getIme() %>) Registracija Logovanje za administratore Logovanje za korisnike and if that is not true to display this Izloguj se (<%=k.getIme() %>) Registracija Logovanje za administratore Logovanje za korisnike I have done this in jsp like so <%for(Korisnik k : Baza.getUser()){%> <% if(k.loggedIn){%> Izloguj se (<%=k.getIme() %>) Registracija Logovanje za administratore Logovanje za korisnike <% } else{%> Izloguj se (<%=k.getIme() %>) Registracija Logovanje za administratore Logovanje za korisnike <% } %> <% } %> but the problem there is when I register new users I have double links,3 users triple and so on. When I log into a user I set his loggedIn attribute to true, now when the loggon attribute is true I would like to display those code at the top, but not in double triple and so on, you get the problem.
has answer: http://stackoverflow.com/a/23990040
type: Question
type: AnsweredQuestion

opengl
tags question: http://stackoverflow.com/q/24047172
tags question: http://stackoverflow.com/q/24049982
tags question: http://stackoverflow.com/q/23981237
tags question: http://stackoverflow.com/q/24023628
tags question: http://stackoverflow.com/q/24018980
tags question: http://stackoverflow.com/q/24003582
tags question: http://stackoverflow.com/q/24038805
type: Tag
tags question: http://stackoverflow.com/q/23943941
tags question: http://stackoverflow.com/q/23976774
tags question: http://stackoverflow.com/q/24015545
tags question: http://stackoverflow.com/q/23964998
tags question: http://stackoverflow.com/q/24016964
tags question: http://stackoverflow.com/q/24005282
tags question: http://stackoverflow.com/q/23985256
tags question: http://stackoverflow.com/q/24038033
tag name: opengl

http://stackoverflow.com/a/23956731
score: 1
has body: Override the compareTo method or implement the Comparable Interface. The documentation says that the return value for this is -1, 0, or 1 according to whether the value of expression is negative, zero or positive. So, you only need to do your own string comparisons and return the appropriate value.
answers question: http://stackoverflow.com/q/23956618
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/37151401
type: Comment
type: QuestionComment
score: 0
has text: [`String#trim()` docs](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#trim%28%29)
comment on: http://stackoverflow.com/q/24088323

http://stackoverflow.com/a/24094478
has comment: http://stackoverflow.com/comment/37163664
type: Answer
downvote count: 1
has body: Yes, you can get the value of _nonStaticInt in that same way: B instanceOfB = new B(); Field f = B.class.getDeclaredField("_nonStaticInt"); // Because the variable is private you need this: f.setAccessible(true); Object content = f.get(instanceOfB); System.out.println(content); The value will be 0, that is the default value for an int.
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/24094298

http://stackoverflow.com/q/23996648
tagged with: lwjgl
has answer: http://stackoverflow.com/a/23997399
accepted answer: http://stackoverflow.com/a/23997399
downvote count: 2
upvote count: 1
has title: using the jlwgl and slick libraries
has comment: http://stackoverflow.com/comment/36981770
type: AnsweredQuestion
tagged with: java
tagged with: slick2d
score: -1
type: Question
linked to: http://stackoverflow.com/q/957700
answer count: 1
has comment: http://stackoverflow.com/comment/36981747
has body: I got the following Error as I compiled my program using the jlwgl and the slick library: Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path There are really many posts on that ! But I really didn't get the solutions of any of them. I think, that for example the description on this site probably explained everything . But I don't know what they mean by: Specify the path to it using -Djava.library.path= It would be very kind if you could give me a step by step explanation for dummies. I am using ubuntu 12.04 and my IDE is eclipse
favorite count: 0

http://stackoverflow.com/comment/37037227
type: QuestionComment
has text: Probably when you are doing tempArray[middle] middle is -1 since you are doing: int high = tempArray.length-1. So, when tempArray is 0 you get -1. You could do: int high = (tempArray.length>0)?tempArray.length-1:0;
comment on: http://stackoverflow.com/q/24026859
score: 0
type: Comment

http://stackoverflow.com/q/24013774
has answer: http://stackoverflow.com/a/24013841
has answer: http://stackoverflow.com/a/24013853
type: AnsweredQuestion
tagged with: java
downvote count: 3
has title: Android (JAVA) - CursorIndexOutOfBoundsException
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24013867
accepted answer: http://stackoverflow.com/a/24013853
favorite count: 0
tagged with: exception
answer count: 3
tagged with: android
has body: Sometimes when I call cursorToCacheItem application crashes with the error: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 android.database.AbstractCursor.checkPosition(AbstractCursor.java:400) android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136) android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:74) com.itirsolutions.cache.BaseCache.cursorToCacheItem(BaseCache.java:131) com.itirsolutions.cache.BaseCache.get(BaseCache.java:101) com.itirsolutions.cache.BaseCache.put(BaseCache.java:47) com.itirsolutions.transactions.UsersInfoCache.put(UsersInfoCache.java:27) etc.. My cursorToCacheItem function: private CacheItem cursorToCacheItem(Cursor cursor) { if (cursor == null || cursor.getColumnCount() == 0) return null; // ... } What am I doing wrong? After checking there, why does not it work?
score: -3
possible better answer: http://stackoverflow.com/a/24013841

http://stackoverflow.com/comment/36997971
type: Comment
score: 0
has text: Just did that, same error message again `Error: Could not find or load main class ReadFile`. I will probably have to if this happens again and again, I'm just happy with a very simple layout of notepad++. Do you have any other ideas of what this could be?
type: AnswerComment
comment on: http://stackoverflow.com/a/24005500

http://stackoverflow.com/comment/37081922
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24010698
has text: Added the download code. I can download the PDF no probs, so I don't think it's the issue. The issue is whenever I click the link, the page jumps to the top.
score: 0

http://stackoverflow.com/comment/37110972
has text: That's a null pointer dereference in the native SSL library. It might be interesting to run it with adb logcate -v threadtime and see if you can figure out what the thread it is coming from is doing, then experiment and see if it has anything to do with the server being contacted or if it's purely local. Interestingly https://code.google.com/p/android/issues/detail?id=65633 seems to also be a null pointer in about the same call stack, even though that one is running a virtual x86. If you can reduce your problem to a minimal reproducible case you might post it there.
comment on: http://stackoverflow.com/q/24065443
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37097480
has text: When I executed "select dbtimezone from dual" it gave "+00:00"
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24058909

http://stackoverflow.com/a/24087060
has comment: http://stackoverflow.com/comment/133398388
type: Answer
upvote count: 1
has body: Try this Pattern p = Pattern.compile("[a-z]"); if (p.matcher(stringToMatch).find()) { //... }
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24086968

http://stackoverflow.com/comment/36914666
type: Comment
comment on: http://stackoverflow.com/q/23961041
score: 0
has text: @SleepDeprivedBulbasaur Make the fix that Marc Cline suggested; if you still have an issue then let's talk.
type: QuestionComment

http://stackoverflow.com/q/24001747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36993466
has answer: http://stackoverflow.com/a/24001862
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36993422
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24001862
tagged with: performance
has title: Performance of priority queue using an ArrayList
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36990691
has body: I'm currently working on a minimum priority queue that keeps itself sorted as items are added. The suggested implementation has new items added to the end of a sorted ArrayList, and then working back through the list to find the items correct location. So it swaps with each previous element in the list until the added item is in order. The implementation I used before this method was suggested involved comparing through the sorted list, marking the index where the item was to be inserted and then using Java's add(int index, Object O) method instead of just adding to the end. I'm trying to understand the performance difference between the 2. I understand that if I insert, all of the trailing indexes will have to be corrected (which is taken care of by the class method). But is this really less efficient than swapping back through the list? Thanks in advance for any explanations
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/23983397
tagged with: java
has body: try { } catch(Object o) { } why this is leads to a compile error ? since all the objects inherit from Object class.
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36955687
score: -1
has comment: http://stackoverflow.com/comment/36955674
upvote count: 0
answer count: 1
has title: Why does Catch(object o) cause a compile error?
favorite count: 0
accepted answer: http://stackoverflow.com/a/23983426
tagged with: exception
has answer: http://stackoverflow.com/a/23983426
type: AnsweredQuestion

http://stackoverflow.com/comment/37143424
type: QuestionComment
comment on: http://stackoverflow.com/q/24068989
score: 0
has text: And please note, this also happpens with CAS 3.5.2.1 (the latest/stable release) as well.
type: Comment

http://stackoverflow.com/a/24089943
downvote count: 0
has comment: http://stackoverflow.com/comment/37154784
has comment: http://stackoverflow.com/comment/37219850
has comment: http://stackoverflow.com/comment/37154832
answers question: http://stackoverflow.com/q/24089806
has comment: http://stackoverflow.com/comment/37155183
score: 9
accepted answer of: http://stackoverflow.com/q/24089806
type: AcceptedAnswer
has body: You can spawn a python process: Process p = Runtime.getRuntime().exec("python "+yourpythonprog+" "+yourargs); Then use the Process object to read the output of your python program.
has comment: http://stackoverflow.com/comment/37155001
upvote count: 9
has comment: http://stackoverflow.com/comment/37155547
type: Answer

http://stackoverflow.com/comment/37102810
type: Comment
has text: You perfectly solved the problem, therefore I will mark this thread as solved. However, I noticed, that I wasn't thinking far enough. I would need more than just adding sections of the graph, I also need to keep the offset for later sections. Here is an image to illustrate what I mean: http://s7.directupload.net/images/140605/fbzlm9vo.jpg - I'll try further on my own, maybe your solution can help me. Thanks a lot anyway! I really appreciate your efforts.
comment on: http://stackoverflow.com/a/24040300
score: 1
type: AnswerComment

http://stackoverflow.com/a/23961091
score: 0
has comment: http://stackoverflow.com/comment/36937890
has comment: http://stackoverflow.com/comment/36938562
has comment: http://stackoverflow.com/comment/36915061
answers question: http://stackoverflow.com/q/23960970
type: Answer
has comment: http://stackoverflow.com/comment/36938754
has body: If you really must use Thread, use AcyncTask. It's a thread + Android-specific thread lifecycle boilerplate: class ConnectionThread extends AsyncTask&lt;Argument, Integer, Result&gt; { protected Result doInBackground(Argument... args) { du stuff here return result; } protected void onProgressUpdate(Integer... progress) { // called in UI thread } protected void onPostExecute(Result result) { // called in UI thead } } But honestly, that's a bad design decision. You must keep in mind that the activity can be destroyed at any time and running task may report back to invalid Activity, forcing you to manaully do the housekeeping: registering/unregistering listeners, keeping valid/invalid flags, stuff like that. There are A LOT of libraries to do asynchronous tasks civilized way, such as: RoboSpice: https://github.com/stephanenicolas/robospice Official Loader API will save you tons of problems too. Volley DataDroid (obsolete, but still can be found in many projects) Alternatively you can move your long-running tasks to a Service and keep worker threads there. Activity can bind to a Service and unbind from it, keeping your application logic decoupled from the UI. Pushing all app logic into the `Activity is the major source of PITA in Android apps across the board. I have no idea why Google is promoting such bad practices. It looks nice and simple in tutorials (that's a PR move maybe?), but doing anything beyond hello-world ends up in endless Activity lifecycle debugging sessions. TL;DR Use RoboSpice, Loader or similar solution Use Services Forget about Thread, AsyncTask only in the simplest cases
has comment: http://stackoverflow.com/comment/36915193
has comment: http://stackoverflow.com/comment/36915440

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/24022694

http://stackoverflow.com/a/24055219
score: 2
downvote count: 0
has body: class Foo { int x; Foo() { new Runnable() { public void run() { Foo.this.x = 1; } } } }
upvote count: 2
answers question: http://stackoverflow.com/q/24055105
type: Answer

http://stackoverflow.com/a/69270027
answers question: http://stackoverflow.com/q/23977629
has body: In my case: @RequestParam(name = "status", required = false) Integer status required Param is false so the status need to available to set null in it
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/122444585

http://stackoverflow.com/q/24053542
has body: I am working on a huge application with a complex database schema. I am using Spring and Hibernate for the development. I wanted to know how to soft-delete an entity(where the active field is there in a superclass rather than having in all the entities). I implemented the suggestion provided here. Below is the structure of my entities and hibernate util classes Base Entity @MappedSuperclass public abstract class BaseEntity&lt;TId extends Serializable&gt; implements IEntity&lt;TId&gt; { @Basic @Column(name = "IsActive") protected boolean isActive; public Boolean getIsActive() { return isActive; } public void setIsActive(Boolean isActive) { isActive= isActive; } } Child Entity : @Entity(name="Role") @Table(schema = "dbo") public class Role extends BaseEntity { //remaining fields //1. foreign key reference to another entity //2. List&lt;Child&gt; entities //3. Self reference fields } Hibernate Util Class: public void remove(TEntity entity) { //Note: Enterprise data should be never removed. entity.setIsActive(false); sessionFactory.getCurrentSession().update(entity); } Now I have a few requirements with this which I am not able to solve now. When I delete 'Role' entity, all the children entities should also get deleted (soft delete only for all) :-> Do I need to fetch the parent entity, iterate through the children and delete one by one ? Role has a foreign-key reference with another entity 'Department'. If a department is deleted, the roles associated should get deleted conditionally(ie, only if the caller decides: in some cases, we dont want to delete the referred entities). There are some self-referencing column like 'ParentRoleId'. If a Role is deleted, all its referenced roles also should be deleted. -> Do I need to fetch the ID and then delete all the self-referenced children entities and then delete each? eg: Department can have a parent department(which is by using the field : parentdeptid). If I delete a parent department, all the sub-departments should get del…
type: UnansweredQuestion
has title: Cascade soft-delete with @MappedSuperclass in hibernate
answer count: 0
upvote count: 3
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/24038072
has comment: http://stackoverflow.com/comment/48869328
type: Question
tagged with: hibernate-cascade
has comment: http://stackoverflow.com/comment/37086769
has comment: http://stackoverflow.com/comment/37091226
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/48870594
favorite count: 0
tagged with: soft-delete

http://stackoverflow.com/comment/36922506
type: QuestionComment
comment on: http://stackoverflow.com/q/23948237
score: 0
has text: Can you provide the setAttribute code and the xhtml page?
type: Comment

http://stackoverflow.com/q/23950979
downvote count: 1
has title: Executing statement after 10 seconds
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23951037
tagged with: java
possible better answer: http://stackoverflow.com/a/23951030
has body: I am running my java listener codes. What happens is that my server will send some command to the client. Thereafter I want to wait and see in 10s if there is no reply, then keep retrying for 5 times. Below is what I do. //Select code from the db with the codeID, codeText. //send the code to the client. long t= System.currentTimeMillis(); long end = t+10000; while(System.currentTimeMillis() &lt; end) { } //Select from db to check if codeupdated. If updated dont do anything else I need to repeat the above pause ? I having issue to repeat it for 5 times?
has answer: http://stackoverflow.com/a/23951030
type: Question
has answer: http://stackoverflow.com/a/23951050
upvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23951037
favorite count: 0
score: -1
tagged with: timer

http://stackoverflow.com/comment/36960743
has text: How would the image not be there? It's in the same directory... should I do the link "/spells.png" instead of "spells.png"?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23985630
type: AnswerComment

modal-dialog
tag name: modal-dialog
tags question: http://stackoverflow.com/q/24013420
type: Tag
tags question: http://stackoverflow.com/q/23941763

android-cursoradapter
type: Tag
tags question: http://stackoverflow.com/q/24048887
tag name: android-cursoradapter

http://stackoverflow.com/comment/37173601
type: QuestionComment
comment on: http://stackoverflow.com/q/24100138
has text: e.g. lastChargeDate="2014-06-01" the result should be like Sun Jun 1 00:00:00 PKT 2014 but it's not like that I entered multiple dates manually even then same result on ever date i.e. Sun Dec 29 00:00:00 PKT 2013
score: 0
type: Comment

http://stackoverflow.com/q/24010838
downvote count: 0
tagged with: java
tagged with: web-services
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24011039
score: 4
answer count: 3
has body: I am used to the terms Client and Service (or Server) in web service. Could you confirm me please which one it is web service Producer and Consumer? And would you tell me why having 2 terms for the same meaning? I don't understand what my colleagues complain that the terms client/server causes confusion. Thank you.
has answer: http://stackoverflow.com/a/24011039
has title: What is the difference between web service producer and consumer?
has answer: http://stackoverflow.com/a/24010860
accepted answer: http://stackoverflow.com/a/24010860
favorite count: 0
upvote count: 4
has answer: http://stackoverflow.com/a/24010894

http://stackoverflow.com/a/24007795
has body: Got Solution For the Exception. If you are using a default pakage then don't write any pakage name before the class name. New working Code- <suite name="MyFirstSuit"> <class name="MonsterUpdate" /> <class name="MonsterUpdateNewProfile"/> <class name="shineUpdate"/> <class name="shineUpdateNewProfile"/>
type: Answer
accepted answer of: http://stackoverflow.com/q/24000424
answers question: http://stackoverflow.com/q/24000424
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/24097804
has answer: http://stackoverflow.com/a/24097876
favorite count: 0
has answer: http://stackoverflow.com/a/24097882
accepted answer: http://stackoverflow.com/a/24097876
tagged with: android
has body: This might be a very basic question but I hope someone of you can help a newbie... Im doing the Hello World app tutorial and are just about the to add the action bar. So I have declared the action in XML in men/res and as follows: &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" yourapp:showAsAction="ifRoom" /&gt; ... &lt;/menu&gt; Now I need to define the activities by calling methods in Java code: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return super.onCreateOptionsMenu(menu); } And my question is, where (in what file and what directory) should I write this? I can't do it in the XML-file, should I use a single Java-file for only this code? Thankful for any help! Marie
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24097882
has answer: http://stackoverflow.com/a/24097999
score: 1
upvote count: 3
tagged with: java
downvote count: 2
type: Question
has title: Where do I write JAVA code for an activity when programming in Eclipse?
tagged with: eclipse
answer count: 3
has comment: http://stackoverflow.com/comment/37169167

http://stackoverflow.com/q/24076819
has body: I am trying to store only unique elements fetched from Database inside a JSONArray HashSet&lt;String&gt; hs = new HashSet&lt;String&gt;(); JSONArray mainarray=new JSONArray(); PreparedStatement stmt = connection.prepareStatement("SELECT * from categories"); ResultSet rs=stmt.executeQuery(); while(rs.next()) { String T1 = rs.getString("T1"); hs.add(T1); if(!hs.contains(T1)) { mainarray.put(T1); } } System.out.println(mainarray); Starngely the output is an empty array [] By the way i am using org.json.JSONArray. Could anybody please help .
type: Question
type: AnsweredQuestion
has title: How to store unique elements inside a JSONArray
tagged with: java
has answer: http://stackoverflow.com/a/24076868
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/37129702
downvote count: 0
accepted answer: http://stackoverflow.com/a/24076868
favorite count: 0
has comment: http://stackoverflow.com/comment/37129880
possible better answer: http://stackoverflow.com/a/24077028
upvote count: 2
has answer: http://stackoverflow.com/a/24077028

http://stackoverflow.com/comment/37143694
score: 0
has text: I could answer your WAR-related question, but I'm going AWOL for the weekend as of.. now!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24081499

http://stackoverflow.com/comment/37161718
comment on: http://stackoverflow.com/q/24093738
has text: try this `i.putBooleanExtra("meteorStat", true);`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37105553
type: QuestionComment
has text: I try, and the 404 still persists.
comment on: http://stackoverflow.com/q/24063270
score: 0
type: Comment

http://stackoverflow.com/comment/36974218
type: QuestionComment
has text: @LeonBorko I tried it but it didn't work. I mean it works but is not satisfying the need
comment on: http://stackoverflow.com/q/23993369
score: 0
type: Comment

http://stackoverflow.com/q/24029121
has title: Android App taking up a lot of memory
score: 9
type: Question
has answer: http://stackoverflow.com/a/24029198
has body: While working on my Android application, I recently check a task manager to see how memory my application is racking up. Right now my application has two ad banners being executed by AdMob services and then an interface fragment for a Google Map. Aside from all that I then have a menu in which I utilize a container to which I add views to it in Java code. I prefer this over a list-view as it is more light weight and easier for me to structure what I want to do with the views (and I can use Androids native animation system when adding/removing the views). The views being added to the container are being added by a loop structure based on conditions. The views in their interface structure also have a small image-view utilizing a small local drawable. All of this is somehow adding up to my application 44.8 MB in memory which seems abnormally high from previous development numbers. This is also the first time I decided to use the container to add views through a loop rather then the adapter with list-view method. Can anyone tell right off hand why my application is taking up so much memory right off? This is my first time utilizing all these components: AdMob Banners, Google Maps, and Containers with added Views. My LogCat shows no warnings of doing anything inefficiently. Just curious to see if I am doing anything wrong. If anyone has any ideas I am open to provide any source code.
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24029271
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24029271
accepted answer: http://stackoverflow.com/a/24029198
tagged with: memory-management
type: AnsweredQuestion
upvote count: 9
tagged with: java

http://stackoverflow.com/q/24073693
possible better answer: http://stackoverflow.com/a/24073828
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24074009
tagged with: java
has body: i have this method in my class conexion public ArrayList&lt;Comuna&gt; getComunas() { ConexionBd(); try { comunas = new ArrayList&lt;Comuna&gt;(); resultado = consulta.executeQuery("select * from comuna"); while(resultado.next()) { comunas.add(new Comuna(resultado.getInt("com_id"),resultado.getInt("pro_id"),resultado.getString("com_nombre"))); } CerrarConexionBd(); } catch (Exception e) { e.printStackTrace(); // TODO: handle exception } return comunas; } I'm trying to put the value here &lt;c:set var="variable" value="${Conexion.getComunas}"&gt;&lt;/c:set&gt; and display the value with this &lt;select class="form-control" id="comuna" name="comuna"&gt; &lt;c:forEach var="comunas" items="${variable} " &gt; &lt;option value="${comunas.com_id}"&gt;${comunas.com_nombre}&lt;/option&gt; &lt;/c:forEach&gt; &lt;/select&gt; I get this error javax.el.PropertyNotFoundException : The class 'java.lang.String' does not have the property 'com_id' at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:229) at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:206) at javax.el.BeanELResolver.property(BeanELResolver.java:317) at javax.el.BeanELResolver.getValue(BeanELResolver.java:85) at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:104) at org.apache.el.parser.AstValue.getValue(AstValue.java:183) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185) at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:1026) at org.apache.jsp.formulario_005fempresa_jsp._jspx_meth_c_005fforEach_005f0(formulario_005fempresa_jsp.java:157) at org.apache.jsp.formulario_005fempresa_jsp.access$1(formulario_005fempresa_jsp.java:138) at org.apache.jsp.formulario_005fempresa_jsp$Helper.invoke1(formulario_005fempresa_jsp.java:230) at org.apache.jsp.formulario_005fempresa_jsp$Helper.invoke(formulario_005fempresa_jsp.java:307) at org.apache.jsp.tag.webplantillaformulario_tag.doTag(webplantillaformulario_tag.…
type: Question
answer count: 2
tagged with: jstl
has answer: http://stackoverflow.com/a/24074009
downvote count: 0
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/24073828
has title: jsp - error for not correctly use JSTL
upvote count: 2

http://stackoverflow.com/comment/37017096
type: QuestionComment
has text: I posted a few posts about JMenu(Xxx), link my post to your question and with description why, where, how
comment on: http://stackoverflow.com/q/24015458
score: 0
type: Comment

http://stackoverflow.com/comment/37093347
type: Comment
has text: Ok. I understand better now. I'll update my answer with a better solution!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24056004

http://stackoverflow.com/comment/36936060
score: 0
comment on: http://stackoverflow.com/a/23973276
type: Comment
has text: so how can i rectify this problem?
type: AnswerComment

http://stackoverflow.com/a/24013301
answers question: http://stackoverflow.com/q/24013133
score: 0
type: Answer
has body: You do not need to create a logger every time. As java.util.Logger is thread safe, it is feasible to declare it only once and use it every time. Below is an example: private static final Logger myLog = Logger.getLogger("loggerName"); myLog .warn("Text"); Best practice is to use one logger per class. And if it does not involve more efforts then, I would advise to use log4j framework.

http://stackoverflow.com/a/60241204
score: 0
answers question: http://stackoverflow.com/q/24093694
type: Answer
has body: public String starOut(String str) { String ret = ""; int i; if (str.length() == 0 || str.equals("*")) return ""; for (i = 0; str.charAt(i) == '*'; ++i) ; if (i &gt; 0 &amp;&amp; str.charAt(i-1) == '*') ++i; while (i &lt; str.length()) { if (i == str.length()-1 || i &lt; str.length()-1 &amp;&amp; str.charAt(i+1) != '*') ret += str.charAt(i++); else { ++i; while (i &lt; str.length() &amp;&amp; str.charAt(i) == '*') ++i; ++i; } } return ret; }

http://stackoverflow.com/a/24141870
answers question: http://stackoverflow.com/q/23998507
type: Answer
has body: If you want to clear Hibernate's second level cache, regardless of the caching provider, you should call up directly to Hibernate. Calling SessionFactory.getCache().evictAllRegions should do it, without having to get your hands dirty with Infinispan.
downvote count: 0
score: 2
upvote count: 2

http://stackoverflow.com/comment/37220240
score: 0
comment on: http://stackoverflow.com/q/24005108
type: QuestionComment
type: Comment
has text: i had try that, it didnt helped :/

http://stackoverflow.com/comment/37005832
comment on: http://stackoverflow.com/a/24008976
type: AnswerComment
score: 0
has text: k,but when I write text like(abc.)ie end of statement.That is also replaced with space.This is the problem with above code.
type: Comment

http://stackoverflow.com/a/24047718
has comment: http://stackoverflow.com/comment/37076299
accepted answer of: http://stackoverflow.com/q/24047684
type: AcceptedAnswer
has body: Your while loop at the end is trying to iterate through iter &amp; not iter2 (iterator for set2). it should be while(iter2.hasNext()) { .... }
answers question: http://stackoverflow.com/q/24047684
score: 0
type: Answer

http://stackoverflow.com/q/24028690
has comment: http://stackoverflow.com/comment/37041008
type: Question
has answer: http://stackoverflow.com/a/24029849
has comment: http://stackoverflow.com/comment/37040680
has comment: http://stackoverflow.com/comment/37040672
tagged with: java
has title: "Exception in thread "main" java.util.InputMismatchException" error in Java (read data from files to array)
has body: I completed this project, but there seems to be a problem with the "readLines" method and the integer array that I was using: package careers; import java.util.*; /** * * @author hna */ public class Careers { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { String[] career = new String[20]; int[] salary = new int[20]; int count; count = readLines(career, salary); sortInfo(career, salary, count); printTable(career, salary, count); } /*****************************************************************************/ public static int readLines(String[] career, int[] salary) throws Exception { int i = 0; int count = 0; java.io.File careers = new java.io.File("Careers.txt"); Scanner infile = new Scanner(careers); while(infile.hasNextLine()) { career[i] = infile.nextLine(); infile.nextLine(); salary[i] = infile.nextInt(); i++; count++; } infile.close(); return count; } // end readLines /*****************************************************************************/ public static void sortInfo(String[] career, int[] salary, int count) { boolean swapped; int i; String tempCareer; int tempSalary; do { swapped = false; for(i = 0; (i &lt; count - 1); i++) { if(salary[i] &lt; salary[i + 1]) { tempSalary = salary[i]; salary[i] = salary[i + 1]; salary[i + 1] = tempSalary; tempCareer = career[i]; career[i] = career[i + 1]; career[i + 1] = tempCareer; swapped = true; } // end if } // end for } while(swapped); } // end sortInfo /*****************************************************************************/ public static void printTable(String[] career, int[] salary, int count) { int i; System.out.printf("%-10s%56s%n", "Job Titles", "Salary"); for(i = 0; i &lt; count; i++) System.out.printf("%-60s%-,30d%n", career[i], salary[i]); } // end printTable } Somehow, changing from "career[i] = infile.nextLine()" to "career[i] = infile.next()" makes it accept the integer inputs and works, but it only read the first string of my input. i.e:…
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/24029849
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/37040790
type: AnsweredQuestion
tagged with: java.util.scanner
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/23957281
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23958190
tagged with: java
tagged with: http
downvote count: 1
type: Question
tagged with: gwt
score: -1
tagged with: post
has body: I have a problem.. I use "GWT"; I have a string in client side. I would send this string to server with a HTTP POST request but I have no idea how to do this.. What is the code that I have to write on client side and server side??? please help
has title: how to do HTTP POST request in GWT

http://stackoverflow.com/a/23959640
upvote count: 11
has comment: http://stackoverflow.com/comment/36911887
has comment: http://stackoverflow.com/comment/36911698
has comment: http://stackoverflow.com/comment/36911888
has comment: http://stackoverflow.com/comment/36911559
has comment: http://stackoverflow.com/comment/36911332
answers question: http://stackoverflow.com/q/23959615
has comment: http://stackoverflow.com/comment/36911238
has body: sudo apt-get remove default-jre removes the package "default-jre". all tho you should ask in askUbuntu
accepted answer of: http://stackoverflow.com/q/23959615
has comment: http://stackoverflow.com/comment/36912313
has comment: http://stackoverflow.com/comment/36912357
has comment: http://stackoverflow.com/comment/36911811
has comment: http://stackoverflow.com/comment/36911525
has comment: http://stackoverflow.com/comment/36911413
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36911601
has comment: http://stackoverflow.com/comment/36911947
type: Answer
score: 11

http://stackoverflow.com/comment/37098716
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24058909
type: Comment
has text: I am selecting from DB based to date input given by user. Above code snippet code shows how I am trying to convert input date to calendar object and set timezone to GMT 0:00. But it's not converting.

http://stackoverflow.com/comment/37071614
has text: You got me wrong. I am trying to go to "foo.class" that is called "next". I dont need putString or something else
type: Comment
comment on: http://stackoverflow.com/a/24045152
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36941334
comment on: http://stackoverflow.com/a/23975822
score: 0
type: AnswerComment
type: Comment
has text: So Pollen is an inner class of the MainActivity?

http://stackoverflow.com/comment/36991773
type: Comment
has text: Thanks! I was not sure what the id keyword was for. Now I know.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24002079

http://stackoverflow.com/q/24101781
possible better answer: http://stackoverflow.com/a/24103331
has comment: http://stackoverflow.com/comment/37187628
type: Question
has answer: http://stackoverflow.com/a/24103331
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24346245
tagged with: mysql
answer count: 2
tagged with: tomcat
has body: I am building an application in Tomcat 7, using Spring Data and hibernate. I have it working on my mac, but when I ported the application over to my linux server, and changed the configuration to match that MySQL login, I get a Connection Exception on Tomcat startup. A couple differences between my development environment (where it works) and my production environment(where it doesn't work): -Development is mac, production is linux -Development MySQL version: Ver 14.14 Distrib 5.6.16, for osx10.9 (x86_64) using EditLine wrapper, Production MySQL version: Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.2 hibernate.properties looks like this: hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.connection.url=jdbc:mysql://localhost:3306/&lt;dbname&gt; hibernate.connection.username=root hibernate.connection.password=&lt;root password&gt; One weird thing is that on my linux box, mysql doesn't show up when typing the netstat command, but I can log in from the command line no problem. When in mysql, I typed "show variables;" and port came back as 0. Tomcat still couldn't connect when I put this port into the hibernate properties though.
score: 0
tagged with: linux
accepted answer: http://stackoverflow.com/a/24346245
has comment: http://stackoverflow.com/comment/37187648
type: AnsweredQuestion
has title: Cannot connect to Mysql using java jdbc Driver

http://stackoverflow.com/comment/36939494
type: Comment
score: 1
type: AnswerComment
has text: Check `getSelectedRow()` _before_ proceeding to `getValueAt()`.
comment on: http://stackoverflow.com/a/23973276

tabs
type: Tag
tags question: http://stackoverflow.com/q/24041293
tags question: http://stackoverflow.com/q/24091215
tag name: tabs
tags question: http://stackoverflow.com/q/24091654

http://stackoverflow.com/comment/37010824
type: QuestionComment
comment on: http://stackoverflow.com/q/24012825
has text: I looks like the *object itself* should be the ""key"". Give it a proper hashCode+equals implementation, then your issues should be solved.
score: 0
type: Comment

http://stackoverflow.com/comment/36895001
comment on: http://stackoverflow.com/a/23949742
type: AnswerComment
has text: It was the Type problem. I couldn't use toString method on Editable somehow, but I could on CharSequence. So I decided to use onTextChanged() method instead of afterTextChanged(). Thank you so much for helping.
score: 0
type: Comment

http://stackoverflow.com/q/23985902
answer count: 2
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/23985959
has answer: http://stackoverflow.com/a/23985972
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
has body: Here are connection methods: private static Connection connection = null; /** * Gets the database connection. */ public static Connection getConnection() { return Storage.connection; } /** * Connects to the database. */ public static void connectToDatabase() { try { String userName = "root"; String password = "mysql"; String url = "jdbc:mysql://localhost/secondsemesterprojectdanishcrowncaos"; Class.forName("com.mysql.jdbc.Driver").newInstance(); Storage.connection = DriverManager.getConnection(url, userName, password); Storage.connection .setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); Storage.connection.setAutoCommit(false); } catch (Exception e) { System.err.println("Cannot connect to database server." + e); } } /** * Terminates the database connection. */ public static void disconnectDatabase() { if (Storage.connection != null) { try { Storage.connection.close(); } catch (Exception e) { } } } And here is my connection and query: All of my database connections are almost the same as this one: public void addLoadingDock(LoadingDock loadingDock) { loadingDocks.add(loadingDock); Storage.connectToDatabase(); PreparedStatement s; try { String query = "INSERT INTO LoadingDocks(dock_no, active, product_type_id) VALUES (?, ?, ?);"; s = Storage.connection.prepareStatement(query, Statement.RETURN_GENERATED_KEYS); s.setInt(1, loadingDock.getDockNo()); s.setBoolean(2, loadingDock.getActive()); s.setInt(3, loadingDock.getProductType().getId()); int rows = s.executeUpdate(); Storage.connection.commit(); System.out.println(rows + " row(s) created in database"); ResultSet generatedKeys; generatedKeys = s.getGeneratedKeys(); if (generatedKeys.next()) { loadingDock.setId(generatedKeys.getInt(1)); } else { throw new SQLException( "Creating LoadingDock failed, no generated key obtained."); } generatedKeys.close(); s.close(); } catch (Exception e) { System.err.println("Error adding LoadingDock. Details: " + e); try { Storage.connection.rollback(); } catch (SQLException e…
has title: JDBC too many connections
type: Question
tagged with: database

http://stackoverflow.com/comment/37116686
type: Comment
has text: @BheshGurung What's missing?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24069480

http://stackoverflow.com/a/24081655
has comment: http://stackoverflow.com/comment/37243839
has comment: http://stackoverflow.com/comment/37139653
upvote count: 2
has body: The description of CustomTaskChange says: Interface to implement when creating a custom change that does not actually generate SQL. If you are updating a database through SQL, implementing CustomSqlChange is preferred because the SQL can either be executed directly or saved to a text file for later use depending on the migration mode used. So use a CustomSqlChange instead. In the generateStatements() method you can also print out your sql before you return your SqlStatement[] array. The println will run every time. But the statements you created will not be applied to the database but instead just be printed to std out when you choose to run it with updateSQL.
has comment: http://stackoverflow.com/comment/37281567
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37140004
answers question: http://stackoverflow.com/q/24080892

http://stackoverflow.com/q/24053684
has comment: http://stackoverflow.com/comment/65326867
has title: Hibernate Session Could not open for transaction
has comment: http://stackoverflow.com/comment/79246978
has answer: http://stackoverflow.com/a/24053853
favorite count: 0
has answer: http://stackoverflow.com/a/31009788
type: UnansweredQuestion
tagged with: spring
answer count: 4
tagged with: spring-mvc
score: 2
has answer: http://stackoverflow.com/a/24055646
downvote count: 0
has body: Can some one tell about the following exception.I am getting this exception every day once i try to login for few times.but after some attempts it gone and next day it comes again. Following is the Exception: exception &gt; org.springframework.web.util.NestedServletException: Request &gt; processing failed; nested exception is &gt; org.springframework.transaction.CannotCreateTransactionException: &gt; Could not open Hibernate Session for transaction; nested exception is &gt; org.hibernate.TransactionException: JDBC begin failed: &gt; org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656) &gt; org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) &gt; javax.servlet.http.HttpServlet.service(HttpServlet.java:637) &gt; javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root &gt; cause &gt; &gt; org.springframework.transaction.CannotCreateTransactionException: &gt; Could not open Hibernate Session for transaction; nested exception is &gt; org.hibernate.TransactionException: JDBC begin failed: &gt; org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:596) &gt; org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) &gt; org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335) &gt; org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105) &gt; org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) &gt; org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) &gt; $Proxy48.loginUser(Unknown Source) &gt; com.sapat.competition_tracker.controller.AdminController.userLogin(AdminController.java:59) sun.reflect.GeneratedMethodAccessor510.invoke(Unknown Source) &gt; sun.refle…
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/36525998
tagged with: mysql
type: Question
upvote count: 2

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/23957425
tags question: http://stackoverflow.com/q/24037845
tags question: http://stackoverflow.com/q/24080541
tag name: nosuchmethoderror

http://stackoverflow.com/a/24013358
type: Answer
accepted answer of: http://stackoverflow.com/q/24013318
answers question: http://stackoverflow.com/q/24013318
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37011794
type: AcceptedAnswer
downvote count: 0
has body: What would it mean to add two TextField Objects? The + operator in Java can only be used with operands that are numbers or strings. (Well, that's simplifying it a bit you can look up the exact rules in the Java language specification.) If you want to calculate the sum of two numeric strings stored in the TextFields (I assume integers) you can use something like this: Integer.parseInt(n1.getText()) + Integer.parseInt(n2.getText()) Of course, you should add some error handling.

http://stackoverflow.com/q/23967236
has comment: http://stackoverflow.com/comment/36925669
tagged with: serversocket
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36925943
score: 0
has body: When I used InetAddress addr = InetAddress.getByName("192.168.1.104"); listen_socket = new ServerSocket(port,5,addr); then it works fine But when use dynamic ip InetAddress addr = InetAddress.getByName("114.143.95.69"); listen_socket = new ServerSocket(port,5,addr); the following error will be thrown Error: Cannot assign requested address: JVM_Bind What should I do to resolve the problem?
has comment: http://stackoverflow.com/comment/36957916
has answer: http://stackoverflow.com/a/23967626
answer count: 1
has title: Error: Cannot assign requested address: JVM_Bind
type: UnansweredQuestion

http://stackoverflow.com/a/24057900
score: 0
answers question: http://stackoverflow.com/q/24057521
has body: First Thing you haven't declared static methods here. probably if you want know order of execution 1) constructors Invoked when you create an instance, totally independent of when #2 happens, or even if it ever happens at all 2)static methods Invoked when you invoke them, totally independent of when #1 happens, or even if it ever happens at all 3)static blocks Invoked when the class is initialized, which happens before #1 or #2 can happen.
type: Answer

http://stackoverflow.com/comment/36955484
score: 0
type: Comment
type: QuestionComment
has text: Thank you Joshua. You're perfectly right. How can I do in order to solve this problem? I'm just thinking about a simple query that makes the union of the films which matches the query that I've created or the one that has only the rdf:type equal to dbpedia-owl:Film as a constraint. Can you suggest to me a good method in order to complete my task?
comment on: http://stackoverflow.com/q/23983165

http://stackoverflow.com/comment/36937916
has text: Hi, Thanks. i tried your technique, but the crash behaviour is minimized. But still i do get that crash. Is there any other technique we can use to query the database and display suggestions?. Also i noticed while typing text in edittext, i feel lag in my keyboard, may be because of repeated db calls, how to prevent?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23973069
score: 0

http://stackoverflow.com/a/24089110
has comment: http://stackoverflow.com/comment/37155046
has comment: http://stackoverflow.com/comment/37222744
has comment: http://stackoverflow.com/comment/37179616
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37157687
upvote count: 2
has body: The concerned task has an action tied to it ( logic inside the closure ) which is represented with the use of leftShift operator. Here is the actual semantic: task pullInDeps &lt;&lt; { task action } The task itself is passed into the closure as a parameter to be used in order to define an action. This is synonymous to doFirst { } and doLast { } which takes the task itself as parameter. In case when you define the task as: task pullInDeps { } the task itself will be configured instead of defining any action, hence the task itself as parameter is not available in the closure. Refer the second paragraph in Task Actions.
type: Answer
answers question: http://stackoverflow.com/q/24088880

http://stackoverflow.com/a/23962524
type: Answer
has body: You could use reflection. Here's an example. package b; public class B { private void m() { System.out.println("Called m()"); } } and package a; import b.B; import java.lang.reflect.Method; public class A { public static void main(String[] args) throws Exception { B b = new B(); Method m = B.class.getDeclaredMethod("m"); m.setAccessible(true); m.invoke(b); } } Which outputs Called m()
score: 0
has comment: http://stackoverflow.com/comment/36918926
has comment: http://stackoverflow.com/comment/36918567
answers question: http://stackoverflow.com/q/23962143

http://stackoverflow.com/comment/36995171
score: 3
type: Comment
has text: I have voted to close this question for a few reasons. First, it is too broad; cryptography and its uses are extremely varied, even if you narrow it down to how do you encrypt "data" on a mobile device. Persistent data and transmission data, regulated data, etc all have different techniques and practices and recommendations. Further, your question is a "proper way" question, which means it is subjective and is requesting an opinion rather than clear facts. Finally, you are asking for samples from the Internet or a favorite off-site resource, which has been deemed off-topic on StackOverflow.
type: QuestionComment
comment on: http://stackoverflow.com/q/24004143

http://stackoverflow.com/comment/37155699
type: Comment
type: QuestionComment
has text: I have edited the question with a link to the original problem and not a screenshot.
comment on: http://stackoverflow.com/q/24090447
score: 0

http://stackoverflow.com/q/23948959
has comment: http://stackoverflow.com/comment/36891549
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/23949050
has answer: http://stackoverflow.com/a/23965801
downvote count: 1
type: AnsweredQuestion
has title: Show error message instead of exception
tagged with: java
has comment: http://stackoverflow.com/comment/36891545
tagged with: error-handling
type: Question
has body: I'm trying to make a program that gets a number from the user and checks the number is a prime number or not. I was thinking about the error handling. When the user enters a string the program should give an error message instead of an exception. I tried many methods but couldn't be successful. Could you guys help me with that? import java.util.Scanner; public class PrimeNumber { public static void main(String[] args) { Scanner input = new Scanner(System.in); int inputNum; int remainingNum; System.out.println("Enter a number: "); inputNum = input.nextInt(); if(inputNum &lt; 0){ System.out.println("Please enter a possitive number."); } for(int i = 2; i&lt;=inputNum; i++) { remainingNum = inputNum % i; if(remainingNum == 0){ System.out.println("This number is not a prime number."); break; } if(remainingNum == 1){ System.out.println("This is a prime number!"); break; } } } }
has answer: http://stackoverflow.com/a/23949050
upvote count: 0
score: -1
possible better answer: http://stackoverflow.com/a/23948998
has answer: http://stackoverflow.com/a/23948998
has comment: http://stackoverflow.com/comment/36891468
has answer: http://stackoverflow.com/a/23949499

http://stackoverflow.com/comment/37163188
has text: So it's just that way because it is:)
comment on: http://stackoverflow.com/a/24094587
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23990634
answer count: 5
type: UnansweredQuestion
has title: How to remove the elements of an array which are equal in value?
has answer: http://stackoverflow.com/a/23990852
has comment: http://stackoverflow.com/comment/36968992
has comment: http://stackoverflow.com/comment/36969243
upvote count: 4
has comment: http://stackoverflow.com/comment/36974066
has comment: http://stackoverflow.com/comment/36968835
has comment: http://stackoverflow.com/comment/36969089
downvote count: 0
has comment: http://stackoverflow.com/comment/75855940
tagged with: java
has answer: http://stackoverflow.com/a/23990816
has comment: http://stackoverflow.com/comment/36969011
type: Question
has comment: http://stackoverflow.com/comment/36974641
has answer: http://stackoverflow.com/a/23990995
has comment: http://stackoverflow.com/comment/36969079
tagged with: arrays
has comment: http://stackoverflow.com/comment/36970497
score: 4
has comment: http://stackoverflow.com/comment/36969271
has answer: http://stackoverflow.com/a/23990986
has body: Using ArrayUtills in java code it is possible to remove an element from an java array. Below is the code which removes an element at a particlular index (in the code it is '2', which removes element value equalto '10'. import java.util.Arrays; import org.apache.commons.lang3.ArrayUtils; public class RemoveObjectFromArray{ public static void main(String args[]) { int[] test = new int[] { 10, 13, 10, 10, 105}; System.out.println("Original Array : size : " + test.length ); System.out.println("Contents : " + Arrays.toString(test)); //let's remove or delete an element from Array using Apache Commons ArrayUtils test = ArrayUtils.remove(test, 2); //removing element at index 2 //Size of array must be 1 less than original array after deleting an element System.out.println("Size of array after removing an element : " + test.length); System.out.println("Content of Array after removing an object : " + Arrays.toString(test)); } } It gives the output as: run: Original Array : size : 5 Contents : [10, 13, 10, 10, 105] Size of array after removing an element : 4 Content of Array after removing an object : [10, 13, 10, 105] How the code can be amended to get the following output: run: Original Array : size : 5 Contents : [10, 13, 10, 10, 105] Size of array after removing an element : 2 Content of Array after removing an object : [ 13, 105]
favorite count: 0
has answer: http://stackoverflow.com/a/23991391

http://stackoverflow.com/comment/37158438
comment on: http://stackoverflow.com/q/24066512
score: 0
has text: @chrylis I forgot to say it's using RESTEasy since it's deployed on JBoss AS7. How do I make it visible to Spring? Wasn't the `@Component` directive required? Should I declare it as a bean?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38765574
comment on: http://stackoverflow.com/q/24047982
type: QuestionComment
has text: I think this isn't possible. You have to set the Cell Factory over your Code.
score: 0
type: Comment

http://stackoverflow.com/comment/37177852
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24101775
score: 2
has text: It's quite impressive that the compiler identifies this situation if you ask me.

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/23954830
tags question: http://stackoverflow.com/q/23960114
type: Tag

http://stackoverflow.com/a/23978890
has comment: http://stackoverflow.com/comment/37873582
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23978863
upvote count: 1
has comment: http://stackoverflow.com/comment/36946982
has body: it's orbotix.robot.widgets.joystick.JoystickView;
type: Answer

http://stackoverflow.com/a/24029888
downvote count: 0
answers question: http://stackoverflow.com/q/24028755
has comment: http://stackoverflow.com/comment/44988478
has comment: http://stackoverflow.com/comment/44987972
has comment: http://stackoverflow.com/comment/44944127
has comment: http://stackoverflow.com/comment/44939821
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/44988380
score: 1
has body: High CPU utilization is ok if there is actually some work in progress. i.e. if there are many live threads performing, the net CPU usage for java application will always be at its peak. It is usually instantaneous, i.e. should get normal again when there are no tasks. I would suggest to: Take multiple thread dumps (3-4) after a fix interval (1-2 seconds) (can use kill command on linux, jstack , jvisualvm, jconsole on all systems with jdk) execute ps -mo pid,lwp,stime,time,%cpu,%mem -C java | less . This will list the lightweight processes under the java application's process id. Get the process ids of the processes LWP with highest cpu/memory % (as targeted) convert the lwp ids in to hexadecimal values, can use echo "obase=16; 255" | bc Map these hex ids as nid='some_hex_vlaue' in the thread dump to find the details of thread corresponding to high cpu usage. e.g: "main" prio=10 tid=0x00007f54a4006800 nid=0x79ab runnable [0x00007f54a8340000] Now we know the thread/s within the java process with highest resource(can be used for both memory/cpu%) usage. I would also recommend to attach your jvm process to jvisualvm or jconsole and reproduce the problem, this way you can monitor your application’s state at all the time (from normal to issue reproduction) and take snapshots for reference. Both are good enough to perform any java threads or memory related profiling. http://docs.oracle.com/javase/7/docs/technotes/guides/visualvm/ http://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html Analyzing thread dumps can only point to the problem areas. At times its tricky, usually with high impact, but the cause and fix will be small. Actual cause would usually be either the way application is coded. i.e. How concurrency is managed. If a process is listening infinitely instead of waiting for notification, deadlocks due to synchronization issues etc or the system environment/external interfaces. i.e. file r/w on disk or remote locations, transfer using a ftp A…

http://stackoverflow.com/comment/37084292
has text: you need to use the `track` method
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24051618

constructor
tags question: http://stackoverflow.com/q/24093711
tags question: http://stackoverflow.com/q/24086682
tags question: http://stackoverflow.com/q/24058143
tags question: http://stackoverflow.com/q/24000900
tags question: http://stackoverflow.com/q/24094572
tags question: http://stackoverflow.com/q/23981982
tags question: http://stackoverflow.com/q/23982618
tag name: constructor
tags question: http://stackoverflow.com/q/23966364
tags question: http://stackoverflow.com/q/24005132
tags question: http://stackoverflow.com/q/24058954
tags question: http://stackoverflow.com/q/23965585
type: Tag
tags question: http://stackoverflow.com/q/24020171
tags question: http://stackoverflow.com/q/24096545
tags question: http://stackoverflow.com/q/24102713
tags question: http://stackoverflow.com/q/23945252

http://stackoverflow.com/a/24067568
score: 2
has comment: http://stackoverflow.com/comment/37134996
answers question: http://stackoverflow.com/q/24053040
has comment: http://stackoverflow.com/comment/37137031
has comment: http://stackoverflow.com/comment/37137861
has comment: http://stackoverflow.com/comment/37160714
type: AcceptedAnswer
has body: As Antimony has pointed out, it doesn’t matter to the stack size whether you have code of the form x.y = foo or x.y.z.a.b.c = foo. For each node of the chain the getfield instruction will pop the field owner instance from the stack and push the field value onto the stack (which will become the owner for the next node). So the only interesting part is the putfield. It will pop two values from the stack, the field owner and the new value. Since you are using an expression of the form method(x.y=foo) you need the value a second time, for passing it to the method. So a kind of dup is required, but since the follow-up putfield will consume two items, the copy of the value must be pushed down below the field owner: dup_x1: …, owner, value] → …, value, owner, value] putfield: …, value, owner, value] → …, value] invokestatic: …, value] → …]
accepted answer of: http://stackoverflow.com/q/24053040
downvote count: 0
has comment: http://stackoverflow.com/comment/37139807
upvote count: 2
type: Answer

http://stackoverflow.com/comment/36895324
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23948223
has text: What is the question? How to do the spatial query, how to send the data back?
type: QuestionComment

http://stackoverflow.com/q/24005282
has title: GlRotatef turning object at one point
tagged with: lwjgl
downvote count: 1
has body: I want to make a door which opens like a normal door. I thought about using glRotatef but I don't know how to rotate it so it looks like it's swinging. Current door.class: public static void draw(Texture door) { door.bind(); glBegin(GL_QUADS); glColor3f(1f, 1f, 1f);glTexCoord2f(0,0);glVertex3f(-2,3, -15); glColor3f(1f, 1f, 1f);glTexCoord2f(0,1);glVertex3f(-2,-3, -15); glColor3f(1f, 1f, 1f);glTexCoord2f(1,1);glVertex3f(2,-3, -15); glColor3f(1f, 1f, 1f);glTexCoord2f(1,0);glVertex3f(2,3, -15); glEnd(); } }
type: Question
tagged with: opengl
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/23442499
has answer: http://stackoverflow.com/a/24005953
has comment: http://stackoverflow.com/comment/36998721
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/24080914
has body: I'm playing a bit with Java class files and bytecode. But I stuck at the conditions in the class file. In theory, I understand the concept, but I don't understand how the branching in the classfile is done. Here is a small example: public static void main(String[] args) { int a = 78; int b = 52; boolean c; if(a==b){ c = true; } else { c = false; } } Using javap -c -verbose Equal.class the following listing came up: flags: ACC_PUBLIC, ACC_STATIC Code: stack=2, locals=4, args_size=1 0: bipush 78 2: istore_1 3: bipush 52 5: istore_2 6: iload_1 7: iload_2 8: if_icmpne 16 11: iconst_1 12: istore_3 13: goto 18 16: iconst_0 17: istore_3 18: return LineNumberTable: line 4: 0 line 5: 3 line 7: 6 line 8: 11 line 10: 16 line 11: 18 StackMapTable: number_of_entries = 2 frame_type = 253 /* append */ offset_delta = 16 locals = [ int, int ] frame_type = 252 /* append */ offset_delta = 1 locals = [ int ] Now I was looking in the class file, to find the branch. The hex presentation for the opcode if_icmpne is 0xA0. I assumed the branch marker would follow the 0xA0. In my case there are 2 bytes: 0x0008. My question: What does the two bytes (0x0008) represent? I tried a lot. For example I followed the pathes through the LineNumberTable and the Constant Pool but could'n find anything that would make sense. (Of course the same for goto) In addition, here is the full sequence for the postet listing above: 10 4E // bipush 78 3C // istore_1 10 34 // bipush 52 3D // istore_2 1B // iload_1 1C // iload_2 A0 // if_icmpne 00 08 // ??? 04 // iconst_1 3E // istore_3 A7 // goto 00 05 // ??? 03 // iconst_0 3E // istore_3 B1 // return Thank you in advance!
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/24081105
tagged with: conditional-statements
tagged with: bytecode
tagged with: java
tagged with: .class-file
type: AnsweredQuestion
downvote count: 0
tagged with: branch
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24081105
type: Question
has title: Java conditionals in class-file (on bytecode level)

http://stackoverflow.com/comment/37182824
comment on: http://stackoverflow.com/q/24104443
score: 0
type: Comment
type: QuestionComment
has text: you can see c# sample here http://sergeytihon.wordpress.com/2013/07/11/stanford-parser-is-available-on-nuget/

http://stackoverflow.com/a/24065048
has comment: http://stackoverflow.com/comment/37116785
score: 11
has body: You are thinking too twisted Random random = new Random(); String randomString=random.ints(16, 0, 26*2).map(i-&gt;(i&gt;=26? 'a'-26: 'A')+i) .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) .toString(); Since you already have a source of random values there is no point in calling for a shuffle function (which would not work very well with streams). Note that you also could define the allowed chars in a String explicitly and select them using: random.ints(16, 0, allowed.length()).map(allowed::charAt) Similar pattern applies to selecting from a random access List. Update: If you want to have code clearly showing the two ranges nature of the allowed characters you can combine your Stream.concat approach with the char selection solution described above: StringBuilder allowed= IntStream.concat(IntStream.rangeClosed('a', 'z'), IntStream.rangeClosed('A', 'Z')) .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append); String randomString=random.ints(16, 0, allowed.length()).map(allowed::charAt) .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) .toString(); (Note: I replaced range with rangeClosed which I suspect to match your original intentions while it does not do what Random.ints(…, 'a', 'z') would do).
accepted answer of: http://stackoverflow.com/q/24055943
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24055943
has comment: http://stackoverflow.com/comment/48222695
type: Answer
has comment: http://stackoverflow.com/comment/48223673
upvote count: 11

http://stackoverflow.com/comment/37126008
type: Comment
comment on: http://stackoverflow.com/a/24074009
type: AnswerComment
has text: Have you did something like `request.setAttribute("Conexion",conexionObject);` where `conexionObject` is of type `Conexion` and having getter method such as `getComusas()`. You can check the size using `<c:if test="${Conexion.getComunas().size()>0}">...</c:if>"` or `<c:if test="${Conexion.comunas.size()>0}">...</c:if>"`
score: 0

http://stackoverflow.com/comment/36983017
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23997586
has text: Ah ha, and what about `javaw -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6006 -jar myapp.jar`?
score: 1

dictionary
tags question: http://stackoverflow.com/q/24059080
tags question: http://stackoverflow.com/q/24018880
tags question: http://stackoverflow.com/q/24034253
tags question: http://stackoverflow.com/q/24037083
tags question: http://stackoverflow.com/q/23952796
tags question: http://stackoverflow.com/q/23962881
tags question: http://stackoverflow.com/q/23954422
tags question: http://stackoverflow.com/q/24030747
tags question: http://stackoverflow.com/q/23949625
tag name: dictionary
tags question: http://stackoverflow.com/q/23990510
tags question: http://stackoverflow.com/q/24074358
tags question: http://stackoverflow.com/q/24065595
tags question: http://stackoverflow.com/q/24039021
tags question: http://stackoverflow.com/q/24017856
tags question: http://stackoverflow.com/q/24095662
type: Tag
tags question: http://stackoverflow.com/q/23996735
tags question: http://stackoverflow.com/q/23943024
tags question: http://stackoverflow.com/q/24083495

http://stackoverflow.com/comment/37032015
comment on: http://stackoverflow.com/a/24023042
type: AnswerComment
score: 0
type: Comment
has text: thanks but it doesn't count up to the problem because it seems right to me... can you see whats wrong

http://stackoverflow.com/a/23942742
answers question: http://stackoverflow.com/q/23942624
type: Answer
has body: Maybe have a look at this: Java getDate date-x days They are subtracting days but I think it can be turned into adding days too.
score: 0

http://stackoverflow.com/comment/36994344
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24002896
type: AnswerComment
has text: Not really much my help, but I'm glad you solved it. Also, have you tried to use `/` instead of "\" and put it on both linux and win versions?

http://stackoverflow.com/comment/36888935
score: 1
has text: 4500 iterations...nested for loops...let me assure you, those two red flags are *far* more profitable spots for optimization than tweaking the maximum size of the heap.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23947460

http://stackoverflow.com/a/24029994
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24029944
score: 0
type: Answer
has body: "No error" is indeed correct. The dollar sign is permissible in -- including at the start of -- Java identifiers (although the JLS recommends that it's only used in mechanically-generated code or to access pre-existing names on legacy systems).
answers question: http://stackoverflow.com/q/24029944

http://stackoverflow.com/a/23965886
has comment: http://stackoverflow.com/comment/40023087
has body: As @etherous mentioned: You use mutable state in the Java-version, whereas your Scala-version is completely immutable and also written more inefficiently. They are just different. You can try to avoid maxBy and also try to save already computed results in one iteration. This one should be closer to your Java-version. val content = Source.fromFile("file/text").filter(_.isDigit).map(_.toLong - '0').toList val result = (0 to content.size - 13).foldLeft((List.empty[Long], -1l)){case (current @(_, curMax), next) =&gt; { val temp = content.drop(next).take(13) val tempVal = temp.reduce(_*_) if(tempVal &gt; curMax) (temp, tempVal) else current } } result is a tuple here, containing the list of the thirteen numbers as _1 and it's product as _2, as it seems you wanted both. Bonus Now that I think about it. There is a method called sliding that exactly deals with this problem. But I guess it runs as slow as your scala-code. At least this would be short :). content.sliding(13).maxBy(_.reduce(_*_))
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/40022331
has comment: http://stackoverflow.com/comment/36923531
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23965737
accepted answer of: http://stackoverflow.com/q/23965737
type: Answer

http://stackoverflow.com/comment/36945243
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23977848
type: Comment
has text: There is no exception just don't return result(no match found)

http://stackoverflow.com/q/23947390
has comment: http://stackoverflow.com/comment/36888638
has body: I'm making a game using java3D. It involves the view translating with the "wasd" keys and rotating with the mouse. However when I rotate and translate at the same time, the 3D shapes on the screen flicker back and forth. I tried researching the problem and most people say I need to double-buffer but Java3D automatically double buffers. How can I make my program run smooth and flicker free? Here's a portion of my code including some setup and the rotation and translation methods: import java.applet.Applet; import java.awt.AWTException; import java.awt.BorderLayout; import java.awt.GraphicsConfiguration; import java.awt.Point; import java.awt.Robot; import java.awt.event.*; import javax.media.j3d.*; import javax.vecmath.*; import com.sun.j3d.utils.geometry.ColorCube; import com.sun.j3d.utils.universe.SimpleUniverse; import com.sun.j3d.utils.universe.ViewingPlatform; public class PlayerMechanics extends Applet implements KeyListener, MouseListener, MouseMotionListener { Runner runner; SimpleUniverse universe; Canvas3D c; BranchGroup mainGroup = new BranchGroup(); TransformGroup charViewGroup = new TransformGroup(); ViewingPlatform CharVP; TransformGroup groundGroup; final static int SCREENWIDTH = 900; final static int SCREENHEIGHT = 540; final float CHARACTERHEIGHT = 2.0f; float MouseX = 0.0f; float MouseY = 0.0f; float Speed = 0.0f; float Iteration = 0.0f; float xinterval = 0.0f; float zinterval = 0.0f; float xloc = 0.0f; float yloc = 0.0f; float zloc = 0.0f; float CVrotX = 0.0f; float CVrotY = 0.0f; float CVrotZ = 0.0f; Vector3f loc = new Vector3f(xloc, yloc, zloc); boolean moveForward = false; boolean moveLeft = false; boolean moveBackward = false; boolean moveRight = false; boolean rotUp = false; boolean rotLeft = false; boolean rotDown = false; boolean rotRight = false; public PlayerMechanics() { setLayout(new BorderLayout()); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); c = new Canvas3D(config); add("Center", c); c.addKeyListener(thi…
score: 0
tagged with: applet
type: UnansweredQuestion
has title: Java3D JApplet Flickering with Rotation and Translation
tagged with: java-3d
has comment: http://stackoverflow.com/comment/36919547
answer count: 0
tagged with: flicker
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/comment/37102288
type: Comment
comment on: http://stackoverflow.com/q/24061891
type: QuestionComment
has text: @cy3er yes they have diferent scope (exis without scopes too)
score: 0

http://stackoverflow.com/q/24033804
tagged with: jar
tagged with: bundle
has comment: http://stackoverflow.com/comment/37050220
has comment: http://stackoverflow.com/comment/37049969
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37051599
has comment: http://stackoverflow.com/comment/37076855
answer count: 0
has comment: http://stackoverflow.com/comment/37051457
tagged with: maven
has title: Reduce the jar file size
type: Question
tagged with: jakarta-ee
tagged with: java
linked to: http://stackoverflow.com/q/7810896
has comment: http://stackoverflow.com/comment/37057017
score: 0
has body: I have a jar file (created with maven) clocks at more than 800Mb. This is due to duplication amongst the bundles. The idea is to remove or at the very least reduce the amount of duplication amongst the bundles by making delta zip bundles instead of union zip bundles. Can any one help me to reduce the jar file size? Thanks

http://stackoverflow.com/a/24044806
upvote count: 1
has comment: http://stackoverflow.com/comment/37085596
has comment: http://stackoverflow.com/comment/37099936
has body: This is not the factory pattern, abstract factory pattern or the builder pattern.There are specific intents of them and non of them matches with the code. But as some have suggested, interface PaymentGateway and concrete classes implement the strategy pattern. The intent of the strategy pattern matches perfectly: "Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it." Strategy pattern need not necessarily possess on-the-fly behavior change. It depends on the client code (the code that uses the strategy pattern abstraction). PaymentGatewayFacotry doesn't match with any GoF pattern. It doesn't match with the intent of the factory pattern, abstract factory pattern or the builder pattern. As Lorenzo has suggested, may be you can call it a parameterized factory or a parameterized selector. It is a badly coded class though. It violates the open-close principle.
has comment: http://stackoverflow.com/comment/37082650
downvote count: 0
answers question: http://stackoverflow.com/q/24032453
type: Answer
has comment: http://stackoverflow.com/comment/37086028
score: 1

http://stackoverflow.com/comment/37054639
type: QuestionComment
comment on: http://stackoverflow.com/q/24036326
has text: i want to include the Navigation Drawer when i clicked the listview item but the next activity is not opening in Navigation Drawer but When i extends it to MainActivity Its open inside in Navigation Drawer
score: 0
type: Comment

http://stackoverflow.com/q/23964628
has comment: http://stackoverflow.com/comment/36992591
accepted answer: http://stackoverflow.com/a/24005165
has title: Could not invoke method getObjectInstance on object of type com.ibm.ws.naming.urlns.genericURLContextFactory error on JNDI lookup
possible better answer: http://stackoverflow.com/a/24002979
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24002979
tagged with: java
has comment: http://stackoverflow.com/comment/36922697
type: Question
tagged with: jakarta-ee
tagged with: websphere
answer count: 2
tagged with: jndi
linked to: http://stackoverflow.com/q/23963988
has answer: http://stackoverflow.com/a/24005165
has body: Do you know why I'm getting this exception ? String url = "corbaloc:iiop:localhost:2809"; String initial = "com.ibm.websphere.naming.WsnInitialContextFactory"; String jndi = "ejblocal:my/ejb/PeriodoBO"; Hashtable&lt;String, String&gt; pdEnv = new Hashtable&lt;String, String&gt;(); pdEnv.put("java.naming.provider.url", url); pdEnv.put("java.naming.factory.initial", initial); Context initialContext = new InitialContext(pdEnv); try{ Object ejbHome = initialContext.lookup(jndi); // &lt;-- here Object obj = PortableRemoteObject.narrow(ejbHome, PeriodoBO.class); }catch(NamingException e){ System.err.println(e.toString()); } I'm sure that the JNDI is ok, I was struggling to get it (What&#39;s the default JNDI name of an EJB in Websphere Application Server 7 (WAS)?). Could you help me please? This is my run configuration : UPDATE, I have just got the stack trace, I'm analyzing it : WSCL0910I: Initializing component: com.ibm.ws.websvcs.component.WASAxis2ClientImpl WSCL0911I: Component initialized successfully. WSCL0910I: Initializing component: com.ibm.ejs.jms.JMSClientRegistration WSCL0911I: Component initialized successfully. WSCL0901I: Component initialization completed successfully. WSCL0035I: Initialization of the Java EE Application Client Environment has completed. WSCL0014I: Invoking the Application Client class xxxxx.tests.AllTests .[02/06/14 17:21:45:963 COT] 00000000 W UOW=1-46884688-4040963:dmflores source=com.ibm.websphere.naming.genericURLInitialContextFactory org=IBM prod=WebSphere component=Application Server thread=[P=704708:O=0:CT] NMSV0907E: Could not invoke method "getObjectInstance" on object of type "com.ibm.ws.naming.urlns.genericURLContextFactory". E. Time: 0,011 There was 1 error: 1) testCursosLlevados(xxxxx.CursosTest)javax.naming.ConfigurationException: Could not invoke method getObjectInstance on object of type com.ibm.ws.naming.urlns.genericURLContextFactory. [Root exception is java.lang.reflect.InvocationTargetException] at com.ibm.websphere.nam…
score: 0
tagged with: websphere-7

http://stackoverflow.com/comment/37023297
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23965203
has text: Option 4 will be the route we most likely go. Thanks for your validation, and maybe mostly the fact that you don't know of any other solutions either. Other than 5, but that's what we're moving away from :)

http://stackoverflow.com/q/24001478
has body: I've tried to import the following code in MatLab and it works: encoder = org.apache.commons.codec.binary.Base64(); While this code does not work: encoder = org.apache.commons.codec.binary.Base32(); Anyone know why? Thanks in advance
tagged with: java
has comment: http://stackoverflow.com/comment/36990267
type: Question
tagged with: apache
has comment: http://stackoverflow.com/comment/36990282
score: 0
has comment: http://stackoverflow.com/comment/36990632
has title: Cannot found org.apache.commons.codec.binary.Base32() from matlab
answer count: 1
has answer: http://stackoverflow.com/a/24004445
has comment: http://stackoverflow.com/comment/36990087
has comment: http://stackoverflow.com/comment/36990170
type: UnansweredQuestion
tagged with: matlab

http://stackoverflow.com/comment/37012636
score: 0
comment on: http://stackoverflow.com/q/24013661
type: Comment
type: QuestionComment
has text: @OlegS. how will den i solve my purpose for the queries which returns data as 2-d array n i am using mvc so i need to return it to the controller

http://stackoverflow.com/comment/37067765
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24027479
has text: @prototypetolyfe You will need Maven; see link in my edited answer.

http://stackoverflow.com/q/24010978
tagged with: sparql
accepted answer: http://stackoverflow.com/a/24013508
type: AnsweredQuestion
has body: I'm testing Neo4J to compare it to the EA platform my company have used in this years. This platform relays on a MySQL database that we're querying with SPARQL/SPARUL. Except for the SPARUL support (that is not mandatory at this moment) the idea was to replace this MySQL database with Neo4J and test if it's advantageous to query it with directly with SPARQL or if it's better to translate SPARQL query in cypher and tests like that. Since i was having some problem with the SPARQL plugin of Neo4J2 i switched back to 1.9.7. I have populated a testdb with some data imported from an .nt file, but when i use my advanced rest client for chrome to query them i don't get the result i hope. A simple query like this { "query" : "SELECT ?x ?y WHERE { ?x &lt;http://neo4j.org#RUN_ON&gt; ?y . }" } doesn't return nothing. When i insert data through SPARQL plugin via the insert_quad, for example with a query like "s" : "http://neo4j.org#Application_process_1", "p" : "http://neo4j.org#RUN_ON", "o" : "http://neo4j.org#Database_3", "c" : "http://neo4j.org" instead it works. I've noticed that in this case the composition of the nodes and the relationships is different from what i get when i create a node via Java API (the relationship for example has 3 properties: cp,c,p that mine don't have) Do I have to insert all the data via plugin in a database to query it via SPARQL ? Can i do this via Java API so that i can for example use a parser on a file and create a query for every line I read? (something like inserting some mandatory properties for each kind of resource). Otherwise there's a way to load multiple data via SPARQL plugin in neo4j without write them all ? (something like a for on file entries to be clear) Thx for the help. EDIT: I'm not interested in using another tecnology that perform better with SPARQL. I just wanna now if the SPARQL plugin for Neo4j allows me to do something like multiple insert in a programmatic way, or if i'm force to use it to insert data into a graph tha…
tagged with: java
has answer: http://stackoverflow.com/a/24013508
has title: Sparql Plugin usage
type: Question
answer count: 1
tagged with: neo4j
score: 0

number-formatting
tags question: http://stackoverflow.com/q/24021475
tags question: http://stackoverflow.com/q/24040542
tags question: http://stackoverflow.com/q/24012272
type: Tag
tag name: number-formatting

http://stackoverflow.com/comment/93746964
has text: regarding the example `Strategy a = (Strategy) this::a; // lets say this is ot type X` I would like to be able to do something like this: `Object o = MethodReferences.extractTargetObject(a); // == this` and `java.lang.reflect.Method m = MethodReferences.extractTargetMethod(a); // == X.a` (or instead a MethodHandle bound to the target object + a way to get it from it)?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24098805

http://stackoverflow.com/comment/36902677
type: Comment
has text: that's not it...I actually use that name for my class, I just wrote post in my question here in stackoverflow. for reasons of simplicity
type: AnswerComment
comment on: http://stackoverflow.com/a/23954901
score: 0

http://stackoverflow.com/comment/37030585
comment on: http://stackoverflow.com/a/24023333
has text: documentation says `This is not normally relevant to applications with a UI.`
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/37109446
has text: I tried to run code with classpath but I still get the same error
comment on: http://stackoverflow.com/a/24065731
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/24085366
has answer: http://stackoverflow.com/a/31422603
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/37151908
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
has body: I have a file, "template.docx" that I would like to have placeholders (ie. [serial number]) that can be replaced with a string or maybe a table. I am using Apache POI and no i cannot use docx4j. Is there a way to have the program iterate over all occurrences of "[serial number]" and replace them with a string? Many of these tags will be inside a large table so is there some equivalent command with the Apache POI to just pressing ctrl+f in word and using replace all? Any suggestions would be appreciated, thanks
linked to: http://stackoverflow.com/q/19137818
type: Question
has comment: http://stackoverflow.com/comment/37148062
has title: How do you find/replace a placeholder in a .docx file with Apache POI?
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/32557555

http://stackoverflow.com/a/24101796
answers question: http://stackoverflow.com/q/24101775
has comment: http://stackoverflow.com/comment/37177869
type: Answer
has comment: http://stackoverflow.com/comment/37177891
score: 2
upvote count: 2
has body: This loop here: while(GAMES &lt;= 9999) { ... } resolves to while (true) because the value of GAMES is never modified. So any code that comes after (in your case, double probabilityOfWin = wins / (wins + loses);) is deemed unreachable.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24101775
downvote count: 0

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

http://stackoverflow.com/q/24045213
has answer: http://stackoverflow.com/a/24048945
downvote count: 0
has body: We are going to develop large scale application by using J2EE. The application has contains many number of modules. For the purpose we have planned to split the application into module application and run it on different servers. If i use OSGI, then is it possible to communicate between the two module component which is running on different server? I am not familiar in OSGI. Please help me to find the solution for the large scale application Thanks
answer count: 3
tagged with: osgi
has answer: http://stackoverflow.com/a/24054360
favorite count: 0
accepted answer: http://stackoverflow.com/a/24048682
possible better answer: http://stackoverflow.com/a/24054360
upvote count: 1
tagged with: spring
tagged with: jakarta-ee
type: AnsweredQuestion
score: 1
tagged with: java
has title: Is possible to communicate the components which is running on different server by OSGI
type: Question
has answer: http://stackoverflow.com/a/24048682

http://stackoverflow.com/comment/37088646
score: 0
type: AnswerComment
has text: "my code simply keeps running for 1 or 2 minutes outputting a lot of information (I noticed some kind of trace) before it stops executing." - I thought is asks about why it runs, stops and doesn't print the result?
type: Comment
comment on: http://stackoverflow.com/a/24054538

http://stackoverflow.com/comment/37122588
has text: @GabrielSotero see this answer http://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24072578
score: 1

http://stackoverflow.com/comment/37082938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24029341
has text: I know it's never called because I put breakpoints in there when running in my IDE and I never hit them. I also know because the LOGGER.info("Running after!") line in my @After annotated method shows in my logs while the expected log line for the beforeScenario is not written to the logs.
score: 0

http://stackoverflow.com/comment/36890232
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23948257
has text: Yes. You'll need to create/use a `TableModel` that only has `n` number of rows per "batch" and update the model each time you want to change pages. You can use the [key bindings API](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) to provide support of things like [pgup] and [pgdown] for example, which would move between "pages"

http://stackoverflow.com/comment/37119950
comment on: http://stackoverflow.com/a/24071196
type: Comment
has text: We don't know for sure that it isn't called somewhere else, also. In addition, looking at the Android activity lifecycle, it looks as though `onCreate()` could be called more than once on the same object.
score: 0
type: AnswerComment

http://stackoverflow.com/a/56625916
has body: You can remove Java 12 using this command-- sudo apt-get remove oracle-java12-installer you can change the version by changing the 12 to the version present on your computer then recheck by finding version - java -version
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23959615
upvote count: 1
type: Answer

http://stackoverflow.com/comment/36982084
has text: Try passing each argument of your command as a separate argument in the ProcessBuilder, like this: `new ProcessBuilder("wmic", "-U", "[username]%[password]", "//[password]", "Select * from Win32_NTLogEvent where LogFile = 'System' and SourceName = 'Microsoft-Windows-DHCPv6-Client' or SourceName = 'Microsoft-Windows-Dhcp-Client'")`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23995266

http://stackoverflow.com/comment/37116583
has text: @nosid, I don't know the JVM, but the implementation of System.currentTimeMillis() may be very cheap. However, look at when the example starts the timers: It starts them _before the threads are created_. In fact, the first timer is started before all of the SeparateExecution objects have been created. So, the threaded case
score: 0
comment on: http://stackoverflow.com/q/24069210
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23983697
has answer: http://stackoverflow.com/a/23983749
tagged with: user-interface
answer count: 1
downvote count: 0
tagged with: frame
has comment: http://stackoverflow.com/comment/36956367
has title: Is it a good practice to create a Java Frame like this?
favorite count: 0
has comment: http://stackoverflow.com/comment/36956560
accepted answer: http://stackoverflow.com/a/23983749
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36956341
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/36956492
has body: I am asking this because when I started learning GUI, I didn't like the method that the other guy was using very much so I made this method myself. The code below is the class which is creating the frame. class Frame{ private JFrame frm; private JLabel desc; private JTextField username; private JPasswordField password; Frame(){ //Creating and setting the frame frm = new JFrame(); frm.setLayout(new FlowLayout()); frm.setDefaultCloseOperation(frm.EXIT_ON_CLOSE); frm.setResizable(true); frm.setSize(300, 300); frm.setLocationRelativeTo(null); frm.setTitle("Default title"); //Initializing variables desc = new JLabel("This is the description"); username = new JTextField("Username"); password = new JPasswordField("Password"); EventHandler handler = new EventHandler(); //Adding components to the frame frm.add(desc); frm.add(username); frm.add(password); //Handling the components username.addActionListener(handler); password.addActionListener(handler); //Showing the frame frm.setVisible(true); } class EventHandler implements ActionListener{ public void actionPerformed(ActionEvent event){ if(event.getSource() == username){ JOptionPane.showMessageDialog(null, "You typed \"" + username.getText() + "\" inside the username box."); } else if(event.getSource() == password){ JOptionPane.showMessageDialog(null, "You typed \"" + password.getText() + "\" inside the password box."); } } } } And in the main class simply put something like Frame frm = new Frame(); to create it.
tagged with: class

http://stackoverflow.com/comment/37178187
type: QuestionComment
type: Comment
has text: @user1390616 I don't think it is relevant to this problem, but in general when benchmarking make sure each alternative is receiving data supplied in exactly the same way, and the results are definitely used, and used in the same way. That limits the compiler's ability to drop code related to [dead variables](http://en.wikipedia.org/wiki/Dead_code_elimination).
score: 0
comment on: http://stackoverflow.com/q/24098833

http://stackoverflow.com/q/23971808
has body: I am a bit confused about Inheritance. We extend a class so that its fields and methods are inherited by the sub class with the ultimate goal of being able to use those fields and methods in the sub class. But for a public class, we can access the fields and methods from a non sub class from wihin and outside the package also. Then what is the need to extend a class? We can also access private fields with the help of public getters and setters from non sub class (both from within and outside package).
answer count: 1
has comment: http://stackoverflow.com/comment/36934191
has comment: http://stackoverflow.com/comment/36934427
favorite count: 0
has comment: http://stackoverflow.com/comment/36934409
has title: Java: why we need to extend a class when we can access the fields and methods from non sub class
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23971973
score: 0
tagged with: java
downvote count: 1
type: Question
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/23971973

http://stackoverflow.com/q/23958282
tagged with: static
has comment: http://stackoverflow.com/comment/36908847
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36908875
tagged with: parameters
tagged with: reference
downvote count: 0
has body: I'm aware that in static methods you can't use the keyword "this". Now, I also know that if I want to call a method from that class that I'm currently in, I can use the class name, Example: Main.someStaticMethod(); Now, if I want to use that class (the same as in the example above) in a parameter, how would I do that? Main.someStaticMethodWithParam(Main); That Doesn't work since the IDE thinks main is a parameter and thus just comes up with the error: Undefined variable.
score: 1
tagged with: java
has title: How Do I Use A Class As A Parameter In A Static Method
has comment: http://stackoverflow.com/comment/36908861
type: Question
has answer: http://stackoverflow.com/a/23958393
has comment: http://stackoverflow.com/comment/36908800
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23966862
answer count: 2
has answer: http://stackoverflow.com/a/23966949
tagged with: null
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/23966945
tagged with: nullpointerexception
possible better answer: http://stackoverflow.com/a/23966945
accepted answer: http://stackoverflow.com/a/23966949
favorite count: 0
has body: So what I'm trying to do here is to check if an object exists or not through if(x.next==null) and I'm getting an error for that which won't let me access a null object. I also get the same error when trying to modify an object for e.g. x.next=y The code is simple, it's just to implement a linked list. Thanks! //import SingleLinkedList1.Node; public class SingleLinkedList2 implements ISimpleList2 { private class Node { int value; Node next; } private Node first; private Node last; public void insertFront(int item) { // TODO Auto-generated method stub Node oldfirst = first; // Create the new node Node newfirst = new Node(); newfirst.value = item; newfirst.next = oldfirst; // Set the new node as the first node first = newfirst; if(oldfirst.next==null){ last=first; } } public int removeFront() { // TODO Auto-generated method stub // Save the previous first Node oldfirst = first; if(oldfirst.next==null){ last=null; } // Follow the first's node (possibly empty) // and set the first to that pointer first = oldfirst.next; // Return the value of old first return oldfirst.value; } public void insertEnd(int item) { // TODO Auto-generated method stub Node newLast=new Node(); newLast.value=item; last.next=newLast; last=newLast; } public int removeEnd() { // TODO Auto-generated method stub Node oldLast=last; Node check=new Node(); check=first; while(check.next!=last ){ check=check.next; } last=check; return oldLast.value; } public boolean isEmpty() { if(first.next==null){ return true; } else{ return false; } } }
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has comment: http://stackoverflow.com/comment/36925153
has title: Java.lang.NullPointerException error. Checking for a null object
downvote count: 1
type: Question

http://stackoverflow.com/q/23977013
has comment: http://stackoverflow.com/comment/36944079
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36943681
tagged with: jsf
has comment: http://stackoverflow.com/comment/36943989
tagged with: java
has answer: http://stackoverflow.com/a/23977252
type: Question
tagged with: canvas
linked to: http://stackoverflow.com/q/4532721
has title: JSF+Facebook Integration One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL
has comment: http://stackoverflow.com/comment/36944085
has comment: http://stackoverflow.com/comment/36943995
has comment: http://stackoverflow.com/comment/36943694
has comment: http://stackoverflow.com/comment/36943565
has comment: http://stackoverflow.com/comment/36943581
has comment: http://stackoverflow.com/comment/36943589
answer count: 1
has comment: http://stackoverflow.com/comment/36943633
downvote count: 0
accepted answer: http://stackoverflow.com/a/23977252
has comment: http://stackoverflow.com/comment/36943669
has comment: http://stackoverflow.com/comment/36943655
has comment: http://stackoverflow.com/comment/36944109
favorite count: 0
has body: I have created a Facebook Application and details are given screen shot ! But when i am clicking on JSF Button Login with Facebook I am getting below exception Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. Here are code i am using for redirect private void redirect(String url, HttpServletResponse response) throws IOException { String urlSessionID = response.encodeRedirectURL(url); response.sendRedirect(urlSessionID); } I tried other solution provided in other question which i found in Stackoverflow but its not worked for me . if (requestUrl.indexOf("Login.xhtml") &gt; 0) { callback = requestUrl.replaceAll("Login.xhtml", "fblogin.xhtml"); } else if (requestUrl.indexOf("UserRegistration.xhtml") &gt; 0) { callback = requestUrl.replaceAll("UserRegistration.xhtml", "fblogin.xhtml"); } service = new ServiceBuilder().provider(FacebookApi.class) .apiKey(apiKey).apiSecret(apiSecret).callback(callback) .scope("email,offline_access").build();
has comment: http://stackoverflow.com/comment/36944970
upvote count: 2
has comment: http://stackoverflow.com/comment/36943642
has comment: http://stackoverflow.com/comment/36943710
tagged with: facebook
has comment: http://stackoverflow.com/comment/36943703
has comment: http://stackoverflow.com/comment/36943686
has comment: http://stackoverflow.com/comment/36943716

http://stackoverflow.com/q/23988718
has comment: http://stackoverflow.com/comment/36966617
type: Question
has comment: http://stackoverflow.com/comment/36966046
tagged with: jackson
has title: Mapping annotations with Jackson
score: 0
has body: I am trying to map some annotation to rest responses using the Jackson lib @Retention( RetentionPolicy.RUNTIME ) @Target( ElementType.TYPE ) public @interface LogicModule { String id(); int numberOfInputs(); } My code for transforming these objects into JSON is ... final List&lt;LogicModule&gt; result = new LinkedList&lt;&gt;(); for (final Class&lt;?&gt; annotatedClass : annotated) { final LogicModule moduleInfo = annotatedClass.getAnnotation( LogicModule.class ); result.add(moduleInfo); } return Response.ok( result ).build(); Unfortunately this returns an empty list. How do I need to alter the code to make things work as expected?
answer count: 1
tagged with: serialization
has answer: http://stackoverflow.com/a/24003162
accepted answer: http://stackoverflow.com/a/24003162
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/36917095
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23960790
has text: Ordous, thats what I was thinking about: there is a HB between volatile write and volatile read, but we dont know when the reader thread will see the reference to the object. It may see a reference to the uninitialized object.

http://stackoverflow.com/comment/36965878
comment on: http://stackoverflow.com/q/23988977
type: Comment
type: QuestionComment
has text: What is the value of max?. You get random numbers upto "max"
score: 0

http://stackoverflow.com/q/24051433
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: ResponseHandler&lt;RedditRequestResponse&gt; rh = new ResponseHandler&lt;RedditRequestResponse&gt;() { @Override public RedditRequestResponse handleResponse( final HttpResponse response) throws IOException, RedditException { int statusCode = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); if (entity == null) { throw new ClientProtocolException("Response contains no content"); } String responseBody = EntityUtils.toString(entity); if (statusCode != HttpStatus.SC_OK) { throw new RedditException(generateErrorString(statusCode, input, responseBody)); } return new RedditRequestResponse(statusCode, responseBody); } }; I'd like to throw my own RedditException from handleResponse() that includes the response body. However, when I try that (like in the above code) I get a RedditException not compatible with throws clause error. I suspect this has something to do with the @Override. What exactly is being overridden? The class that contains this method does not inherit from any other class and does not implement any interfaces that I can tell.
upvote count: 2
tagged with: exception
has answer: http://stackoverflow.com/a/24051491
type: AnsweredQuestion
tagged with: java
tagged with: http
type: Question
has title: Apache HttpClient ResponseHandler Exceptions
tagged with: apache
accepted answer: http://stackoverflow.com/a/24051491

http://stackoverflow.com/comment/36943046
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23976735
has text: Or in general, copy/paste the output of the program.

http://stackoverflow.com/comment/37083551
score: 0
comment on: http://stackoverflow.com/q/24036719
type: Comment
type: QuestionComment
has text: @unwichtich please see the question I have updated. Thanks in advance.

http://stackoverflow.com/comment/37012028
type: Comment
has text: Thanks!! I made mistake and use find and not matches
comment on: http://stackoverflow.com/a/24013023
type: AnswerComment
score: 0

http://stackoverflow.com/a/24075384
score: 0
answers question: http://stackoverflow.com/q/24075267
has body: You should initialize and add JComboBox outside of try block. Because, if any database exception have occur than JComboBox will not be added or be visible. And better to create the JComboBox at start-up and populate it when the DB query is resolved. // Write these line, outside of try block. bx = new JComboBox(v); bx.setBounds(240, 20, 200, 20); add(bx);
type: Answer
has comment: http://stackoverflow.com/comment/37126902
has comment: http://stackoverflow.com/comment/37127085
has comment: http://stackoverflow.com/comment/37127295
has comment: http://stackoverflow.com/comment/37126960

http://stackoverflow.com/a/24063849
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/37106428
has comment: http://stackoverflow.com/comment/37105784
has comment: http://stackoverflow.com/comment/37105851
score: 1
answers question: http://stackoverflow.com/q/24063452
type: Answer
has body: You are permitted to code either cast. The first case does not even need to have the cast in order to be accepted by the compiler. At execution time, though, the variable p in the second case must actually reference an instance of Child (or some subclass of Child) or a cast check exception will be raised. Remember, cast does not actually change the type of the object, it merely asserts/verifies that the object is permitted to be treated as the specified type.

http://stackoverflow.com/q/23954936
tagged with: android
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23954998
answer count: 1
tagged with: android-fragments
has title: ListView with two columns within a fragment
tagged with: listview
type: AnsweredQuestion
has body: I'm trying to display a ListView with columns in a fragment (using a custom ListViewAdapter). This is the exception i'm getting: 05-30 14:21:32.913: E/AndroidRuntime(3662): FATAL EXCEPTION: main 05-30 14:21:32.913: E/AndroidRuntime(3662): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.view.ViewGroup.addViewInner(ViewGroup.java:3509) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.view.ViewGroup.addView(ViewGroup.java:3380) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.view.ViewGroup.addView(ViewGroup.java:3325) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.view.ViewGroup.addView(ViewGroup.java:3301) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:931) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.os.Handler.handleCallback(Handler.java:730) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.os.Handler.dispatchMessage(Handler.java:92) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.os.Looper.loop(Looper.java:137) 05-30 14:21:32.913: E/AndroidRuntime(3662): at android.app.ActivityThread.main(ActivityThread.java:5103) MyFragment.java: public class MyFragment extends ListFragment { private ArrayL…
has answer: http://stackoverflow.com/a/23954998
type: Question

http://stackoverflow.com/q/23976995
answer count: 5
has comment: http://stackoverflow.com/comment/36943533
tagged with: shapes
has body: I have searched through to find a simple solution to this problem. I have a method called printCross(int size,char display) It accepts a size and prints an X with the char variable it receives of height and width of size. The calling method printShape(int maxSize, char display) accepts the maximum size of the shape and goes in a loop, sending multiples of 2 to the printCross method until it gets to the maximum. Here is my code but it is not giving me the desired outcome. public static void drawShape(char display, int maxSize) { int currentSize = 2; //start at 2 and increase in multiples of 2 till maxSize while(currentSize&lt;=maxSize) { printCross(currentSize,display); currentSize = currentSize + 2;//increment by multiples of 2 } } public static void printCross(int size, char display) { for (int row = 0; row&lt;size; row++) { for (int col=0; col&lt;size; col++) { if (row == col) System.out.print(display); if (row == 1 &amp;&amp; col == 5) System.out.print(display); if (row == 2 &amp;&amp; col == 4) System.out.print(display); if ( row == 4 &amp;&amp; col == 2) System.out.print(display); if (row == 5 &amp;&amp; col == 1) System.out.print(display); else System.out.print(" "); } System.out.println(); } } Is it because I hardcoded the figures into the loop? I did a lot of math but unfortunately it's only this way that I have been slightly close to achieving my desired output. If the printCross() method received a size of 5 for instance, the output should be like this: x x x x x x x x x Please I have spent weeks on this and seem to be going nowhere. Thanks
type: AnsweredQuestion
tagged with: nested-loops
tagged with: java
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/36943689
has answer: http://stackoverflow.com/a/29688759
accepted answer: http://stackoverflow.com/a/23977037
score: 0
has answer: http://stackoverflow.com/a/23977125
tagged with: char
has answer: http://stackoverflow.com/a/40748908
has comment: http://stackoverflow.com/comment/36988987
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/23977035
favorite count: 0
has answer: http://stackoverflow.com/a/23977037
has answer: http://stackoverflow.com/a/23977035
has title: How to print out an X using nested loops

http://stackoverflow.com/comment/36918040
score: 0
type: Comment
type: QuestionComment
has text: Current release right now is actually **4.0.5**. http://mvnrepository.com/artifact/org.springframework/spring-context/4.0.5.RELEASE
comment on: http://stackoverflow.com/q/23962993

http://stackoverflow.com/q/23995206
tagged with: java
type: Question
score: -2
tagged with: database
downvote count: 5
favorite count: 0
accepted answer: http://stackoverflow.com/a/23995505
has comment: http://stackoverflow.com/comment/36978147
tagged with: android
answer count: 1
has title: Android Beginner Insights
has comment: http://stackoverflow.com/comment/36979091
has answer: http://stackoverflow.com/a/23995505
has comment: http://stackoverflow.com/comment/36977686
upvote count: 3
has comment: http://stackoverflow.com/comment/36977703
has body: So I'm starting an android project, very new to it and to java. But I have a knowledge in programming, especially VB. I'm planning to create and app for certain users to see the data from a database. Is it possible without an internet connection? If not, will be a difficult task?
type: AnsweredQuestion

http://stackoverflow.com/comment/36943908
has text: Then make it a class implementing Comparable<Severity>, with a name and a rank property (the rank being the way to compare a severity to another one).
comment on: http://stackoverflow.com/a/23971357
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24056419
has body: How i can close a iframe that is automatically generated in Java. I am trying to first find it through the XPath is it good or there is another way for this?? WebElement ifr = driver.findElement(By.xpath("//iframe[@id='loginIframe']")); driver.switchTo().frame(ifr); //Switch to iFrame System.out.println(driver.switchTo().frame(ifr).getTitle()); System.out.println(ifr.getAttribute("name")); Now I am getting "Element belongs to a different frame than the current one - switch to its containing frame to use it " error. Please tell a way to do so.
tagged with: selenium-webdriver
score: 0
tagged with: java
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/24056775
answer count: 1
has title: How to close a auto generated iframe in Selenium Java
type: UnansweredQuestion

http://stackoverflow.com/q/24095875
tagged with: java
linked to: http://stackoverflow.com/q/39078841
has comment: http://stackoverflow.com/comment/37165566
type: Question
has comment: http://stackoverflow.com/comment/37171098
has comment: http://stackoverflow.com/comment/37177964
accepted answer: http://stackoverflow.com/a/24098805
linked to: http://stackoverflow.com/q/24016962
has answer: http://stackoverflow.com/a/24095978
has comment: http://stackoverflow.com/comment/37165552
answer count: 3
downvote count: 0
has title: Is there a way to compare lambdas?
has answer: http://stackoverflow.com/a/36794336
favorite count: 0
score: 95
linked to: http://stackoverflow.com/q/25443655
upvote count: 95
possible better answer: http://stackoverflow.com/a/36794336
has answer: http://stackoverflow.com/a/24098805
tagged with: lambda
tagged with: java-8
has body: Say I have a List of object which were defined using lambda expressions (closures). Is there a way to inspect them so they can be compared? The code I am most interested in is List&lt;Strategy&gt; strategies = getStrategies(); Strategy a = (Strategy) this::a; if (strategies.contains(a)) { // ... The full code is import java.util.Arrays; import java.util.List; public class ClosureEqualsMain { interface Strategy { void invoke(/*args*/); default boolean equals(Object o) { // doesn't compile return Closures.equals(this, o); } } public void a() { } public void b() { } public void c() { } public List&lt;Strategy&gt; getStrategies() { return Arrays.asList(this::a, this::b, this::c); } private void testStrategies() { List&lt;Strategy&gt; strategies = getStrategies(); System.out.println(strategies); Strategy a = (Strategy) this::a; // prints false System.out.println("strategies.contains(this::a) is " + strategies.contains(a)); } public static void main(String... ignored) { new ClosureEqualsMain().testStrategies(); } enum Closures {; public static &lt;Closure&gt; boolean equals(Closure c1, Closure c2) { // This doesn't compare the contents // like others immutables e.g. String return c1.equals(c2); } public static &lt;Closure&gt; int hashCode(Closure c) { return // a hashCode which can detect duplicates for a Set&lt;Strategy&gt; } public static &lt;Closure&gt; String asString(Closure c) { return // something better than Object.toString(); } } public String toString() { return "my-ClosureEqualsMain"; } } It would appear the only solution is to define each lambda as a field and only use those fields. If you want to print out the method called, you are better off using Method. Is there a better way with lambda expressions? Also, is it possible to print a lambda and get something human readable? If you print this::a instead of ClosureEqualsMain$$Lambda$1/821270929@3f99bd52 get something like ClosureEqualsMain.a() or even use this.toString and the method. my-ClosureEqualsMain.a();
type: AnsweredQuestion

http://stackoverflow.com/q/24069246
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/37116318
has title: generic in an interface in java
has answer: http://stackoverflow.com/a/24069286
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/24069374
favorite count: 0
has body: Say I have this interface (which is NOT parameterised) public interface MyInterface { MyInterface copy(); } How do I make sure any implementation of copy would return the actual subtype (and not MyInterface). Eg., public Impl implements MyInterface { @Override public Impl copy() &lt;&lt;&lt;&lt;&lt; The returns type of this needs to be 'Impl' { return new Impl(); } } But I can't prevent any implementation to do this: public Foo implements MyInterface { @Override public MyInterface copy() &lt;&lt;&lt;&lt;&lt; The returns type of this needs to be 'Foo' { return new Impl(); } }
tagged with: generics
type: UnansweredQuestion
tagged with: interface
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37116186

buildpath
type: Tag
tags question: http://stackoverflow.com/q/24058212
tag name: buildpath

http://stackoverflow.com/comment/37127602
type: AnswerComment
has text: These links might be helpful: [Link1](http://www.onjava.com/pub/a/onjava/2006/04/19/database-connection-pooling-with-tomcat.html) and [link2](http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html)
type: Comment
comment on: http://stackoverflow.com/a/24075122
score: 0

jdialog
type: Tag
tag name: jdialog
tags question: http://stackoverflow.com/q/24013420
tags question: http://stackoverflow.com/q/24049187

http://stackoverflow.com/comment/37111107
comment on: http://stackoverflow.com/a/24060905
type: Comment
has text: some other JPA implementations will cope with that situation without any need to change such things...
score: 1
type: AnswerComment

http://stackoverflow.com/q/23983734
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/36957361
has title: Using a Managed Bean to transfer values between two Java EE files?
score: 0
has body: I have a Java EE class that gets information from a form and prints it out: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Response extends HttpServlet { String date = "0"; public void init() throws ServletException { //Get Election Date from xml String initial = getInitParameter("electionDate"); date = initial; } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { //Get values from form PrintWriter out = response.getWriter(); String firstName=request.getParameter("firstname"); String lastName=request.getParameter("lastname"); String address=request.getParameter("address"); String city=request.getParameter("city"); String state=request.getParameter("state"); String zip=request.getParameter("zip"); String phone = request.getParameter("phone"); String affil=request.getParameter("affil"); //Print Summary of Voter Registration out.println(" "); out.println(" Registration Summary "); out.println(" "); out.println(" Registration Summmary "); out.println(" First Name: " + firstName + " "); out.println(" Last Name: " + lastName + " "); out.println(" Address : " + address + " "); out.println(" City : " + city + " "); out.println(" State : " + state + " "); out.println(" Zip: " + zip + " "); out.println(" Phone Number: " + phone + " "); out.println(" Affiliation: " + affil + " "); out.println(" Next Election Date: " + date + " "); out.println(" Is the above information correct? "); out.println(" Yes "); out.println(" No "); out.println(" "); out.close(); } } When you click the "No" button I want to send the values that's printed/stored (firstName, lastName, etc.) in the above Java EE file into the below one: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Confirmation extends HttpServlet { String date = "0"; void editForm() { //Print Summary of Voter Registration out.println(" "); out.println(" < "); out.println(" Voter Registration Page "); out.println(" Ple…
has comment: http://stackoverflow.com/comment/36956511
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
answer count: 0
tagged with: java

sslengine
type: Tag
tag name: sslengine
tags question: http://stackoverflow.com/q/23957942

http://stackoverflow.com/comment/37055177
type: AnswerComment
has text: the KeyEventDispatcher will essentially act as a global keylistener. So it will always get triggered, regardless of what has the focus. Then, if you have a keylistener on a JFrame, that keylistener will be triggered when that JFrame has focus. If you have another JFrame with a KeyListener of its own, then that one will get triggered, but only when that JFrame is focused. The same principle applies to all components in those JFrame.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24035935

http://stackoverflow.com/comment/37048036
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24032839
score: 0
has text: call `flush` and `close` at the end.

http://stackoverflow.com/a/24044757
type: Answer
accepted answer of: http://stackoverflow.com/q/24043256
has comment: http://stackoverflow.com/comment/37075458
answers question: http://stackoverflow.com/q/24043256
has comment: http://stackoverflow.com/comment/37076469
score: 3
type: AcceptedAnswer
downvote count: 0
has body: First of all, your question got nothing to do with Netbeans as it mentioned in its original version. Netbeans is just an IDE like Eclipse. Your question is only related to Java. And to break your question down further, you do not need to put this "into" Netbeans or whatever. The API you mentioned is a web API which returns JSON. So the only thing you need to do is to request URLs (just like in the browser), parse the JSON string to an object and work with this object. Here is an example how to request the URL/JSON and how to parse it to a JSON object: public static void main(String[] args) throws Exception { String url = "http://openexchangerates.org/api/latest.json?app_id=db98850be67e4d3d9a3ac0cf26ea2e40"; String json = new Scanner(new URL(url).openStream(), "UTF-8").useDelimiter("\\A").next(); JsonParser jsonParser = new JsonParser(); System.out.println(jsonParser.parse(json)); } The example uses Googles GSON librare which you find at https://code.google.com/p/google-gson.
upvote count: 3
has comment: http://stackoverflow.com/comment/37074680

http://stackoverflow.com/q/23952142
has answer: http://stackoverflow.com/a/23952230
has answer: http://stackoverflow.com/a/23952182
tagged with: collections
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23952182
score: 0
answer count: 2
has title: Merge and order Lists
has body: For any two ascending sorted ArrayList&lt;Integer&gt; such as List&lt;Integer&gt; l1 = new ArrayList&lt;Integer&gt;(); l1.add(1); l1.add(2); l1.add(5); l1.add(10); and List&lt;Integer&gt; l2 = new ArrayList&lt;Integer&gt;(); l2.add(1); l2.add(3); l2.add(5); l2.add(11); how to merge them into an ArrayList&lt;Integer&gt; whose values are 1,1,2,3,5,5,10,11 Update Realised that Integer oversimplifies the problem; in fact these are lists of class public class Tuple { public boolean isComment; public int location; public String text; public Tuple(boolean isAComment, int aLocation, String aText) { isComment = isAComment; location = aLocation; text = aText; } } As suggested, a valid solution requires a sorting, where location is first criterion, whether it is a comment is the second criterion.
accepted answer: http://stackoverflow.com/a/23952230
tagged with: arraylist

http://stackoverflow.com/q/24099147
has comment: http://stackoverflow.com/comment/37174575
answer count: 2
has comment: http://stackoverflow.com/comment/37171664
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27944837
has body: I want to generate a QR-code image, convert it to PNG and return it as a HTTP response to my client. To generate the QR-code I use ZXing. I already tested the conversion part by writing using a FileOutputStream with MatrixToImageWriter.writeToStream(...). That works like a charm. The web framework I am currently using is Spark (Version 1.1.1). The return of the handle(...)-method is set as the response body. What am I doing wrong here? With the current solution I get The image "http://localhost:4567/qrcode" cannot be displayed because it contains errors when performing the GET-request with Firefox. import java.io.ByteArrayOutputStream; import java.io.OutputStream; import static spark.Spark.get; import spark.Request; import spark.Response; import spark.Route; import com.google.gson.Gson; import com.google.common.io.BaseEncoding; import com.google.zxing.BarcodeFormat; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.QRCodeWriter; public class App { public static void main(String[] args) { get(new Route("/qrcode") { @Override public Object handle(Request request, Response response) { // Test data QrData data = new QrData("test"); // Data is wrapped in JSON String json = new Gson().toJson(data); // Transform JSON to QR-code PNG byte string String qrString = ""; try { qrString = generatePngQrCode(json); } catch (Exception e) { e.printStackTrace(); } // Set response parameters response.type("image/png"); response.status(200); // Return response body return qrString; } }); } public String generatePngQrCode(String content) throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // ZXing QR-code encoding BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, 400, 400); // Convert to PNG image and write to stream MatrixToImageWriter.writeToStream(bitMatrix, "png", outputStream); // Encode to Base 64 return BaseEncoding.base64().encode(outputSt…
upvote count: 8
has answer: http://stackoverflow.com/a/27944837
has comment: http://stackoverflow.com/comment/37171995
tagged with: http://stackoverflow.com/tag/png
has answer: http://stackoverflow.com/a/24100924
type: AnsweredQuestion
has title: How can I send a PNG of a QR-code in a HTTP response body (with Spark)?
has comment: http://stackoverflow.com/comment/37172879
tagged with: java
accepted answer: http://stackoverflow.com/a/24100924
tagged with: zxing
tagged with: http
type: Question
score: 8

http://stackoverflow.com/q/24079365
favorite count: 0
type: Question
tagged with: spring
has title: Incremental mapreduce for spring data
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37134420
has body: I am working on spring data's support for mongoDB using Java. I have to perform tasks that require mapreduce. I tried map reduce and it worked fine. Later I came to know incremental mapreduce is better. But I'm not able to find any support for incremental mapreduce in the spring data documentation. Can someone help me on this??? I have used Query query = new Query(where("x").ne(new String[] { "a", "b" })); MapReduceResults&lt;ValueObject&gt; results = mongoOperations.mapReduce( query, "jmr1", "classpath:map.js", "classpath:reduce.js", options().outputCollection("jmr1_out"), ValueObject.class); for mapreduce. Thanks in advance.
type: UnansweredQuestion
tagged with: mapreduce
tagged with: mongodb
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24100001

http://stackoverflow.com/q/24061261
has answer: http://stackoverflow.com/a/24061908
tagged with: java
tagged with: wicket-6
has answer: http://stackoverflow.com/a/24062007
has body: In my current Wicket Application I currently make a fullpage reload after the user clicks on one menu item. I want to change this to only reload the necessary Panel. What I currently do: I have a BasePage.html which contains the menu items and some static content: Home User <!-- and so on -> <wicket:child /> and my (abstract) BasePage.java: add(new AjaxSubmitLink("home") { protected void onSubmit(AjaxRequestTarget target, Form<?> form) { setResponsePage(new HomePage()); } }); //etc my HomePage.html: <wicket:extend> </wicket:extend> my HomePage.java (and all other Pages) then adds the Panel: add(new HomePanel("homePanel")); Instead of setResponsePage() I want to open the Panel in the without rerendering the whole page. Can anyone give me a hint?
has comment: http://stackoverflow.com/comment/37100943
has title: Loading Wicket Panels dynamically in a
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24062007
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
answer count: 2
tagged with: wicket
possible better answer: http://stackoverflow.com/a/24061908

http://stackoverflow.com/a/24076274
has body: A Notes mail document has an item "Received" which contains information from every server it has passed. You can't find out client's IP address this way (I think that's impossible) but you get the server's IP address at least. It is not that easy to get ip address from item "Received" though because there are several items "Received" and with document's methods you always get only the last created. As a workaround you have to read item and remove item in a cycle so that you get all items "Received". Here is the Java code for getting the ip address closest to sender: private String getIPSender(Document doc) { String ip = ""; if (doc != null) { try { while (doc.hasItem("Received")) { Item item = doc.getFirstItem("Received"); if (item.getValueString().contains("[")) { ip = item.getValueString(); } item.remove(); } if (!ip.isEmpty()) { ip = ip.substring(ip.indexOf("[") + 1); ip = ip.substring(0, ip.indexOf("]")); } } catch (Exception e) { ip = ""; } } return ip; }
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24075506
answers question: http://stackoverflow.com/q/24075506
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/37156019
has text: Thank you. The problem with Ubuntu is I have a 3 TB HD on a non UEFI machine, and do need windows accessible. I tried Ubuntu on a VM but it ran pretty sluggish so at the moment Ubuntu (much to my chagrin) is not an option (unless I can figure out how to set it up on a flash drive). Anyway, I will look up how to set up a profile and go from there. Thanks for your help thus far.
score: 0
comment on: http://stackoverflow.com/a/24087740
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37210264
comment on: http://stackoverflow.com/q/24094683
type: Comment
type: QuestionComment
has text: Show us how you load the JSON. You broke the data way before the code you posted here.
score: 0

http://stackoverflow.com/q/23985256
has title: Texture Not Displayed: OpenGL (JOGL)
type: AnsweredQuestion
tagged with: opengl
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23986783
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23986783
has body: I am trying to draw several images on screen. However, images by themself are not displayed. Only area where they have to be has different to background color. Can you help me to find error? I saw few topic, where simillar projlem was cause by looking on texture from oppoisite side. But i dont understand how to change side prperly. package game; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.DisplayMode; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.KeyStroke; import com.jogamp.opengl.util.FPSAnimator; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureIO; public class StartingClass implements GLEventListener { private static GraphicsEnvironment graphicsEnviorment; private GLU glu = new GLU(); private int texture; private static int B_WIDTH = 800; private static int B_HEIGHT = 600; private Dog dog; private Wolf wolf; private ArrayList&lt;Sheep&gt; sheeps; private boolean ingame; @Override public void display(GLAutoDrawable drawable) { // TODO Auto-generated method stub final GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); // Clear…
tagged with: jogl

http://stackoverflow.com/comment/36926639
comment on: http://stackoverflow.com/a/23966913
type: AnswerComment
score: 0
type: Comment
has text: I am using myEclipse and have configured tomcat6, yes i have modified.

http://stackoverflow.com/a/24086726
answers question: http://stackoverflow.com/q/24086682
has body: If I understand what you are saying, you want constructors with default values. Below is an example: public class MyClass { private int i; public MyClass() { this(2); } public MyClass(Integer i) { this.i = i; } }
downvote count: 2
has comment: http://stackoverflow.com/comment/37148106
has comment: http://stackoverflow.com/comment/37148052
upvote count: 0
score: -2
type: Answer
has comment: http://stackoverflow.com/comment/37148039
has comment: http://stackoverflow.com/comment/37148086

http://stackoverflow.com/q/24019854
tagged with: sql
downvote count: 0
type: UnansweredQuestion
has title: search on Long value in Database with CriteriaBuilder
score: 3
tagged with: java
tagged with: hibernate
tagged with: database
type: Question
has body: im trying to search for an "Order" in my "Order"-table in my database, and i'm not finding it because of the get() method, which accepts just strings and not long values. Here is the code: public List&lt;OrderItemEntity&gt; findOrderItem(OrderItem orderitem){ long id = orderitem.getId(); EntityManager em = emf.createEntityManager(); try { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;OrderItemEntity&gt; cq = cb.createQuery(OrderItemEntity.class); Root&lt;OrderItemEntity&gt; root = cq.from(OrderItemEntity.class); cq.where(cb.equal(root.get("id"), String.valueOf(id))); &lt;&lt;---- THIS LINE!! TypedQuery query = em.createQuery(cq); List&lt;OrderItemEntity&gt; result = query.getResultList(); System.out.println("orderID found is: " + result.get(0).getId()); return result; } finally { em.close(); } } can anyone help? How could I cast that "id" in a string value? Thanks!
tagged with: jpa
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24019927
upvote count: 3

http://stackoverflow.com/comment/37021373
score: 0
comment on: http://stackoverflow.com/q/24018150
type: QuestionComment
has text: And would also solve your problem instantly...
type: Comment

http://stackoverflow.com/q/24019198
answer count: 1
score: 0
type: UnansweredQuestion
has body: Trying to import import GUI.layouts.RXCardLayout; but it can't be resolved. It is an extension of CardLayout that someone made and I found it online. Anyone know what the right import is?
tagged with: java
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/24024557
has title: Trying to import RXCardLayout

http://stackoverflow.com/q/24034340
has comment: http://stackoverflow.com/comment/37053993
has comment: http://stackoverflow.com/comment/37051287
type: Question
tagged with: boolean
has comment: http://stackoverflow.com/comment/37051268
has title: How to read Checkboxes status in Jlist
tagged with: jcheckbox
has answer: http://stackoverflow.com/a/24034701
answer count: 1
has comment: http://stackoverflow.com/comment/37051180
linked to: http://stackoverflow.com/q/7620579
score: 0
tagged with: jlist
tagged with: swing
has comment: http://stackoverflow.com/comment/37050989
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37051802
has body: I am developing a GUI where I have included some Checkboxes into a Jlist but I cannot read their status. Below i have an example of my code final JScrollPane scrollPaneWat = new JScrollPane(); scrollPaneWat.setBounds(526, 248, 152, 140); Pane.add(scrollPaneWat); scrollPaneWat.hide(); @SuppressWarnings("unchecked") final JList&lt;?&gt; list = new JList(new CheckListRendererClasses[] { new CheckListRendererClasses("a"), new CheckListRendererClasses("b"), new CheckListRendererClasses("c"), new CheckListRendererClasses("d"), new CheckListRendererClasses("e"), new CheckListRendererClasses("f"), new CheckListRendererClasses("g"), scrollPaneWat.setViewportView(list); list.setBackground(Color.LIGHT_GRAY); list.setFont(new Font("Times New Roman", Font.ITALIC, 14)); list.setCellRenderer(new CheckListRenderer()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent event){ JList list = (JList) event.getSource(); int index = list.locationToIndex(event.getPoint()); CheckListRendererClasses item = (CheckListRendererClasses) list.getModel().getElementAt(index); item.setSelected(! item.isSelected()); list.repaint(list.getCellBounds(index, index)); } }); I have tried this: for (int i = 0; i &lt; 7; i++) { Object sel = list.getModel().getElementAt(i); System.out.print(sel.toString()); } and I get back a, b, c, d, e, f, g Also, when i tried this: System.out.println(list.isSelectedIndex(1)); if I tick the Checkbox a, it prints true. But if the Checkbox a is ticked and I tick one more (so now I have ticked the Checkbox a and c) it returns false. It's like it keeps my last choice. What I want is, for example if I have ticked the a, c, d Checkboxes to be able to make a for loop and see everytime if a checkbox at value i is ticked or not. Thank you
tagged with: java
accepted answer: http://stackoverflow.com/a/24034701

http://stackoverflow.com/comment/37018952
has text: Oops, my mistake. But the point is that it may be an encoding problem on your database connection. Use a debugger to check the string that you from the text field before sending it to the database — and to rule out possible encoding issues related to your *terminal*, maybe write a loop to print each character of the string as an integer, so you can see the actual Unicode codepoint numbers.
score: 1
comment on: http://stackoverflow.com/q/24017029
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23951373
favorite count: 0
has title: Not closing quartz scheduler connection after wrapping it in aspect
has comment: http://stackoverflow.com/comment/36896104
tagged with: spring
score: 2
tagged with: connection-pooling
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: quartz-scheduler
type: Question
tagged with: aspect
upvote count: 2
has comment: http://stackoverflow.com/comment/36903455
has comment: http://stackoverflow.com/comment/36900318
has comment: http://stackoverflow.com/comment/36897808
has body: I have problem with my aspect process. I have scheduled quartz job witch I wrapped in aspect. When I do it without aspect I don't have problems , but when I wrap it in aspect after process is executed several times an application seems to be in a hang state while trying to connect to database. The logs show several J2CA0045E errors due to ConnectionWaitTimeoutExceptions as well as other errors referring to problems with obtaining free connections from the pool. When I look for my free connections there are none available. It seems like my aspect is not closing connections. I don't understand why is this happening because when I don't use aspect everything is doing well and connections are closed. My aspect configuration in applicationContext.xml is like this : &lt;!-- Aspect --&gt; &lt;bean id="logAspect" class="hr.kket.cscada.web.util.aspect.LoggingAspect" /&gt; &lt;aop:config proxy-target-class="true"&gt; &lt;aop:aspect id="aspectLoggging" ref="logAspect" &gt; &lt;aop:pointcut id="syncUdwAspect" expression="execution(* hr.kket.cscada.services.balancing.BalancingService.syncAllUdwForGasDay(..))" /&gt; &lt;!-- @Around --&gt; &lt;aop:around method="logProcess" pointcut-ref="syncUdwAspect" /&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; My loggingAspect class is like this : @Aspect public class LoggingAspect { public Object logProcess(ProceedingJoinPoint joinPoint) throws Throwable { &lt;!-- some code before --&gt; int br = dbparameter;// if(br == 0) { log.error('some message'); } else { insertSomethingInDB();//inside I open and close connection, this works well. try { Object result = joinPoint.proceed();// connection of this job is not closing with aspect &lt;!-- some code after --&gt; insertSomethingInDB();//inside I open and close connection, this works well. return result; } catch (Exception e) { log.info(e.getMessage()); &lt;!-- some code here --&gt; throw e; } } return null; } } Does anyone know what could be the problem? Thanks in advance!

http://stackoverflow.com/comment/36955315
type: Comment
has text: "As you can see in the java code…" I don't see any Java code in the question. Please add it to the question.
type: QuestionComment
comment on: http://stackoverflow.com/q/23983165
score: 0

http://stackoverflow.com/q/23988164
answer count: 1
tagged with: security
score: 0
has answer: http://stackoverflow.com/a/23989337
has body: Alright, I'd like to know my current way to encrypt a network connection(will be explained in the next few lines) is safe and efficient. Also I'm trying to keep in mind that I want to use as less bytes(to transfer) as possible, as this might be used for Android. My current way is by using the two encryption methods: RSA(keysize= 512) and AES(keysize= 128) What I did is: Server generates an RSA Public Key and a Private Key. When a client connects, the server sends the Public RSA Key to the client. The client generates an AES Key and encrypts the AES Key using the public RSA Key provided by the server. The client sends his encrypted AES Key and the server decrypts the encrypted AES Key using the Private RSA Key. Now if I am correct it's impossible to sniff any packets from the client side as you can't possibly decrypt the AES Key(no private key). Is this a secure way? Or is there some sort of backdoor somewhere? This isn't my only question though; Because my application is built in Java, it's always possible to reverse engineer it. Since the client generates the AES Key and saves it in memory, is it possible to get hold of the AES Key? Final question: It takes me around 300ms to generate a keypair using this code: I'd like your people's opinions and/or improvements. private RSAKeySet(RSAPublicKey publicKey, PrivateKey privateKey) { this.publicKey = publicKey; this.privateKey = privateKey; byte[] mod = publicKey.getModulus().toByteArray(); byte[] exp = publicKey.getPublicExponent().toByteArray(); localPublicKeySpec = ByteBuffer.allocate(mod.length + exp.length + 8); localPublicKeySpec.putInt(mod.length); localPublicKeySpec.put(mod); localPublicKeySpec.putInt(exp.length); localPublicKeySpec.put(exp); localPublicKeySpec.flip(); } public static final RSAKeySet generateKeys(int keySize) throws GeneralSecurityException { RSAKeySet set; long start = System.currentTimeMillis(); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(keySize); KeyPair kp = k…
tagged with: aes
tagged with: netty
accepted answer: http://stackoverflow.com/a/23989337
type: AnsweredQuestion
tagged with: java
tagged with: rsa
has title: Safe way to encrypt a network application
type: Question

http://stackoverflow.com/comment/37036320
comment on: http://stackoverflow.com/q/24021475
score: 1
has text: Do you need to parse or just format? If the latter, and all you have is a pattern, you can put some dummy character like `\u2060` (zero-width joiner).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24026992
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37040836
answers question: http://stackoverflow.com/q/24026946
has comment: http://stackoverflow.com/comment/37040325
downvote count: 0
has body: You cannot directly "delete" an object in Java -- the garbage collector takes care of all that work. Removing an item from the ArrayList simply removes the reference to that item from the ArrayList -- nothing more, nothing less. The object might remain in the heap for the rest of your program, or it might be collected immediately; it depend on what else is going on in the program and whether the garbage collector thinks it should free up some space. In fact, automatically deleting the object would probably be a bad choice, as it's possible that there is some other reference to the object that would be invalidated by automatic deletion. For regular arrays, setting the reference at the index to be removed to null (and/or shifting other elements around) is the standard way of "removing" an object from an object array. If you didn't do that, you would be holding on to a reference after it should have been released, resulting in a potential memory leak.
has comment: http://stackoverflow.com/comment/37040365
type: Answer

http://stackoverflow.com/a/24115112
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37218753
score: 31
upvote count: 31
has comment: http://stackoverflow.com/comment/85065825
has comment: http://stackoverflow.com/comment/37225783
accepted answer of: http://stackoverflow.com/q/24043397
has body: Here's code you can use for clients to programatically add your CA at runtime. You don't need to put it in any store - just carry around the PEM encoded file. You can even hard code it into your program so there's no separate file to manage. static String CA_FILE = "ca-cert.pem"; ... FileInputStream fis = new FileInputStream(CA_FILE); X509Certificate ca = (X509Certificate) CertificateFactory.getInstance("X.509") .generateCertificate(new BufferedInputStream(fis)); KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(null, null); ks.setCertificateEntry(Integer.toString(1), ca); TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, tmf.getTrustManagers(), null); ... You will need a trusted distribution channel to ensure your program is not modified while sitting on the server waiting to be picked or while traveling down the wire while being installed. openssl s_client -host www.envmgr.com -port 443 -showcerts > cert_chain.crt You should only need to trust the root certificate, and not the entire chain. The server is responsible for sending all intermediate certificates required to build the chain. If the server is not sending all intermediate certificates required to build the chain, then the server is misconfigured. The problem you are experiencing is called the "Which Directory" problem. Its a well known problem in PKI. Essentially, it means a client does not know where to go to fetch a missing intermediate certificate. You solve it by having the server send all required intermediates along with the server's certifcate. See OWASP's TLS Cheatsheet and Rule - Always Provide All Needed Certificates. Just bike shedding, but there's a whole nother can of worms here with Java (especially Java 7 and lower): SSLContext ctx = SSLContext.getInstance("TLSv1"); ctx.init(null, tmf.getTrustManagers(), null); You can improve upon it,…
answers question: http://stackoverflow.com/q/24043397

http://stackoverflow.com/q/24004891
possible better answer: http://stackoverflow.com/a/24005874
downvote count: 1
has body: I am getting the following error: java.io.NotSerializableException: cscie55.project.AccountInfo My AccountInfo class doesn't implement java.io.Serializable. Do I have to make it Serializable? If so, can someone help me with how to do it? The following is part of my Client class: public class Client extends UnicastRemoteObject implements ATMListener { public Client() throws RemoteException { } private static AccountInfo getAccountInfo(int accountNumber, int pin) { //AccountInfo accountInfo = new AccountInfo(accountNumber, pin); return new AccountInfo(accountNumber, pin); } public static void main(String[] args) { ATM atm; try { ATMFactory factory = (ATMFactory)Naming.lookup("atmfactory"); atm = factory.getATM(); Client clientListener = new Client(); atm.addListener(clientListener); Client.testATM(atm); } catch (MalformedURLException mue) { mue.printStackTrace(); } catch (NotBoundException nbe) { nbe.printStackTrace(); } catch (UnknownHostException uhe) { uhe.printStackTrace(); } catch (RemoteException re) { re.printStackTrace(); } } AccountInfo class: public final class AccountInfo { private final int accountNumber; private final int pin; public AccountInfo(int accountNumber, int pin) { this.accountNumber = accountNumber; this.pin = pin; } public int getAccountNumber() { return accountNumber; } public int getPin() { return pin; } } Accounts are created in BankImpl class: public class BankImpl extends UnicastRemoteObject implements Bank { public static LinkedHashMap&lt;Integer, Account&gt; accounts; public BankImpl() throws RemoteException { accounts = new LinkedHashMap&lt;Integer, Account&gt;(); //constructor creates 3 accounts Account account1 = new Account(0000001, 1234, 0, true, true, true); Account account2 = new Account(0000002, 2345, 100, true, false, true); Account account3 = new Account(0000003, 3456, 500, false, true, true); //assigns all the accounts to a collection accounts.put(0000001, account1); accounts.put(0000002, account2); accounts.put(0000003, acco…
type: Question
has answer: http://stackoverflow.com/a/24005874
accepted answer: http://stackoverflow.com/a/24004940
tagged with: serializable
score: 0
answer count: 2
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/24004940
type: AnsweredQuestion
has title: Java NotSerializableException:
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/37090184
comment on: http://stackoverflow.com/q/24055289
score: 0
type: Comment
type: QuestionComment
has text: Use LinerarLayout instead of RelativeLayout, it will solve your problem.

http://stackoverflow.com/a/24083888
has comment: http://stackoverflow.com/comment/37144809
score: 0
accepted answer of: http://stackoverflow.com/q/24081941
answers question: http://stackoverflow.com/q/24081941
type: AcceptedAnswer
has body: String sql="SELECT * FROM "+tesztvalt+""; PreparedStatement pst = conn.prepareStatement(sql); ResultSet rs = pst.executeQuery(); while (rs.next()) { tabla.setModel(model); } You have a couple of problems: You are using the PreparedStatement incorrectly. Your code may work (I'm not sure), but it does not take advantage of the features of the PreparedStatement. The code that read the data from the ResultSet makes no sense because, well you aren't even reading any data from the ResultSet. To use a PreparedStatement the code is something like: String sql = "Select * from ?"; PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString( 1, tesztvalt ); stmt.executeQuery(); Now the PreparedStatement will build the SQL query with the proper delimiters so you don't need to worry about that. Read the section from the JCBC tutorial on Using Prepared Statements for more information. If you want to read all the data from a specific table, then check out the TableFromDatabaseExample.java code found in Table From Database. It shows how to build the query as well as how to access the column names and data.
type: Answer
has comment: http://stackoverflow.com/comment/37144107

http://stackoverflow.com/comment/36931870
type: AnswerComment
comment on: http://stackoverflow.com/a/23970470
score: 0
type: Comment
has text: @pratik I have sent it,plz refresh your mail and see

http://stackoverflow.com/q/24077682
tagged with: java
has comment: http://stackoverflow.com/comment/37322289
score: -1
tagged with: eclipse
type: Question
upvote count: 1
has body: I am running the samples shipped with the Paho Java client: http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.java.git/ Wether it is their own example, or a standalone hello world Paho demo from other sources, or even in conjunction with Spring Integration, the client somehow happens to receive a message more than one time, if its payload exceeds 200MB (this is not an exact figure, since I tested by gradually increasing the payload by 5MB message by message). My broker is Mosquitto. I tried all QOS configurations, Still the same. Remarkably, this does not happen when working with the Paho Python library, using the same setup. So my environment (network, broker, publishing client, etc.) should be fine.
tagged with: paho
tagged with: mqtt
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has title: Message over MQTT received twice and three times if its payload exceeds 200MB
has comment: http://stackoverflow.com/comment/37322359
has answer: http://stackoverflow.com/a/24082041

http://stackoverflow.com/comment/36940794
has text: What have you already tried?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23975640

http://stackoverflow.com/a/24054539
downvote count: 0
score: 1
has body: You may have found a bug. Is this only happening with Async Loggers or also when you configure a plain (synchronous) logger? Also, have you tried using a filePattern that looks like this: filePattern="/apps/bea/mb-logs/$${date:yyyy-MM-dd}/router.%d{yyyy-MM-dd-HH}.log"? I have a (admittedly vague) suspicion that the $${date:...} part might be related. If neither of the above makes any difference, could you please file a Jira ticket on the log4j2 issue tracker? https://issues.apache.org/jira/browse/LOG4J2
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37099045
answers question: http://stackoverflow.com/q/24051421

http://stackoverflow.com/comment/36999511
has text: Please don't silently swallow Exceptions.
comment on: http://stackoverflow.com/q/24006655
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36907729
type: QuestionComment
comment on: http://stackoverflow.com/q/23956901
has text: What are you trying to do with the date? If you're not going to display it back, may I suggest using `System.currentTimeMillis()`? http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#currentTimeMillis()
score: 0
type: Comment

http://stackoverflow.com/comment/36897085
type: QuestionComment
comment on: http://stackoverflow.com/q/23951856
has text: It also comes from properties files configured through spring. Check for any properties file entry in your dispatcher.xml
score: 0
type: Comment

stream
tags question: http://stackoverflow.com/q/23966365
tags question: http://stackoverflow.com/q/24009683
tags question: http://stackoverflow.com/q/23966640
tags question: http://stackoverflow.com/q/23954876
type: Tag
tag name: stream
tags question: http://stackoverflow.com/q/23971624

http://stackoverflow.com/comment/36920510
score: 1
comment on: http://stackoverflow.com/q/23964231
type: Comment
type: QuestionComment
has text: You're leaving out key code that would help us diagnose your problem, so to solve this, you'll have to improve your question, or we'll have to engage in a little voodoo, but one perhaps related concern I have is that your description and code snippets suggests that you have program logic present inside of your paintComponent method, and if so, this should not be.

http://stackoverflow.com/comment/36912787
type: Comment
type: QuestionComment
has text: Everything I'm doing is in Matlab, and I see what you're saying, and agree that it's a little weird, but if `arr` is a `com.mongodb.BasicDBList` and I do `arr.get(0)` Matlab returns a `double` and not an `Object`. Is there another way I can check? I'm not very fluent in Java.
score: 0
comment on: http://stackoverflow.com/q/23959402

http://stackoverflow.com/a/24095858
has comment: http://stackoverflow.com/comment/37165562
downvote count: 0
has comment: http://stackoverflow.com/comment/37165614
answers question: http://stackoverflow.com/q/24095832
has body: Try with below regex (\d+)\s+(year|years) Get the digit at group 1 using Matcher#group() that looks for the groups enclosed in parenthesis (). Read more about Java Regex Pattern DEMO Sample code: String url = "2 years of experiences of databse, XXXBBXBXB 3 years databse and sql experiences, UUYFS 3 year experiences"; Pattern pattern = Pattern.compile("(\\d+)\\s+(year|years)"); Matcher matcher = pattern.matcher(url); while (matcher.find()) { System.out.println(matcher.group(1)); } output: 2 3 3 EDIT: Try below pattern as per your comment: (\d+)\s+(years of experience|year experience)
has comment: http://stackoverflow.com/comment/37165618
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37165514

http://stackoverflow.com/q/23942014
has comment: http://stackoverflow.com/comment/36879808
type: Question
has body: Sorry but I not Have a solution for my problem. Can you help me? I have an application on Eclipse and it work correctly with openCV, but if export it in a jar executable jar, I have the error from the command prompt when launching the jar: Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at grafic.WindowInterface.windowsValidate(WindowInterface.java:695) at grafic.WindowInterface.validate(WindowInterface.java:677) at grafic.WindowInterface$4.widgetSelected(WindowInterface.java:388) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758) at grafic.WindowInterface.open(WindowInterface.java:122) at grafic.WindowInterface$1.run(WindowInterface.java:105) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at grafic.WindowInterface.main(WindowInterface.java:101) I have intalled the open CV(2.4.9) from this tutorial. I have added on Windows sistem path this variable : C:\Program Files\Java\opencv\build\x86\vc10\bin; I have create the executable jar as in this tutorial. Have you suggestions?Why the application work correctly on eclipse and not work in the executable jar? Thanks for help.
tagged with: executable
tagged with: java
has title: UnsatisfiedLinkError Java OpenCV and executable jar Eclipse
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36879929
score: 0
answer count: 2
tagged with: jar
has answer: http://stackoverflow.com/a/26508747
has answer: http://stackoverflow.com/a/23968169
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36880018
linked to: http://stackoverflow.com/q/1611357

unsupported-class-version
type: Tag
tags question: http://stackoverflow.com/q/24100736
tag name: unsupported-class-version

oauth-2.0
tag name: oauth-2.0
type: Tag
tags question: http://stackoverflow.com/q/24057122
tags question: http://stackoverflow.com/q/23978321

http://stackoverflow.com/comment/36985196
type: QuestionComment
type: Comment
score: 0
has text: Am I right if I say that what you want is first a way to convert an empty args[0] to null and second a way to treat that null as a true 0 to achieve compatibility with your future usage of Drools ?
comment on: http://stackoverflow.com/q/23997618

http://stackoverflow.com/comment/36942833
has text: The number of ways this might be achieved and near limitless, without further context, it's impossible to answer with any certainty
score: 0
comment on: http://stackoverflow.com/q/23976499
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24102593
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37179680
type: Question
upvote count: 0
score: -2
answer count: 1
has body: Why my if-else statement doesn't execute when gender == "m" or gender == "f" ? Scanner input = new Scanner(System.in); do { System.out.print("Please enter 'm' for male and 'f' for female child: "); String gender = input.next(); System.out.print("The height of the mother in inches: "); int motherHeight = input.nextInt(); System.out.println("The height of the father in inches: "); int fatherHeight = input.nextInt(); if(gender == "m") { double childHeight = ((motherHeight * 13/12) + fatherHeight) / 2; System.out.println(childHeight); } else if (gender == "f") { double childHeight = ((fatherHeight * 13/14) + motherHeight) / 2; System.out.println(childHeight); } } while(input.hasNext());
has comment: http://stackoverflow.com/comment/37181008
favorite count: 0
has comment: http://stackoverflow.com/comment/37179595
has comment: http://stackoverflow.com/comment/37179713
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37179523
has comment: http://stackoverflow.com/comment/37179337
has comment: http://stackoverflow.com/comment/37179428
downvote count: 2
has answer: http://stackoverflow.com/a/24102600
accepted answer: http://stackoverflow.com/a/24102600
has title: if-else statement does not execute in Java
type: AnsweredQuestion

http://stackoverflow.com/a/24067213
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24066699
answers question: http://stackoverflow.com/q/24066699
type: Answer
score: 1
has body: Haversine is for geographic calculations, where the curving globe influences distances. Especially for short distances irrelevant. Given an earth radius R: Δ y = (ΔLatitude mod 360) * 2π R / 360 But a Δ longitude gets 0 when reaching a pole (latitude = ±90). Δ x = (ΔLongitude mod 360) * 2π R * (90 - |avg latitude|) / 90 / 360 ~~~~~~~~~~~~~~~~~~~~~~~~~~ (The underlined part should be something like cos(avg latitude in radians) but SQL rarely provides a cosine function.) And hence distance = √(Δx² + Δy²)
upvote count: 1

http://stackoverflow.com/comment/37063138
has text: I don't use Tomcat actually, just configuration is made on Tomcat classes. Because there is no tomcat folder, I couldn't enable jmx on tomcat. Is this still valid then?
comment on: http://stackoverflow.com/a/24038080
type: Comment
score: 0
type: AnswerComment